Updated objectivefunktion
This commit is contained in:
@@ -156,10 +156,12 @@ def build_model(name, hyperedges, elmax, el1, el2, el3, excluded_support=None):
|
||||
name="minimize_used_hyperedges",
|
||||
)
|
||||
'''
|
||||
model.setObjective(quicksum(1000 * elmax[e_id] * b[e_id] - x[e_id] for e_id in hyperedges),GRB.MAXIMIZE)
|
||||
|
||||
#model.setObjective(quicksum(1000 * elmax[e_id] * b[e_id] - (1 - elmax[e_id]) * x[e_id] for e_id in hyperedges),GRB.MAXIMIZE)
|
||||
model.setObjective(quicksum(1000 * elmax[e_id] * b[e_id] - (1 / elmax[e_id]) * x[e_id] for e_id in hyperedges if elmax[e_id] != 0),GRB.MAXIMIZE)
|
||||
#model.setObjective(quicksum(1000 * elmax[e_id] * b[e_id] + np.log(elmax[e_id]) * x[e_id] for e_id in hyperedges if elmax[e_id] != 0),GRB.MAXIMIZE)
|
||||
#Excluding creation and destruction only three reactions for three nmr
|
||||
model.addConstr(quicksum(b[e_id] for e_id, (tails, heads) in hyperedges.items() if tails != [] and heads != []) == 3)
|
||||
#model.addConstr(quicksum(b[e_id] for e_id, (tails, heads) in hyperedges.items() if tails != [] and heads != []) == 3)
|
||||
#Restrict number of used edges to prevent using all available
|
||||
#model.addConstr(quicksum(x[e_id] for e_id in hyperedges) <= 16)
|
||||
|
||||
@@ -219,8 +221,8 @@ def main():
|
||||
|
||||
#Chosable parameters
|
||||
modes = ["Product", "Average"]
|
||||
mode = modes[0]
|
||||
normalize = False
|
||||
mode = modes[1]
|
||||
normalize = True
|
||||
|
||||
if normalize:
|
||||
NMR1 = [round(l/sum(NMR1), 2) for l in NMR1]
|
||||
|
||||
Reference in New Issue
Block a user