-
Notifications
You must be signed in to change notification settings - Fork 271
Closed
Description
Hi, I have the following objective function
Where n_ij is a matrix of the decision variables. My function is not linear, because of min, thus it is a Non-Linear Integer Programming problem (NILP).
I converted min(a,b) = (a + b)/2 + abs(a-b)/2
I implemented my function in the following way:
def new_npilp(queue , service_rate , accuracy , V, numcores):
model = scipop.Model("npilp")
x = {}
for i in range(len(service_rate)):
x[i]=model.addVar("x"+str(i), vtype="I", lb=0, ub=numcores)
nonlinexp = {}
term1 = {}
term2 = {}
model = scipop.Model("npilp")
model.addCons(scipop.quicksum(x[i] for i in range(len(service_rate))) <= numcores)
for i in range(len(service_rate)):
term1[i] = accuracy[i]*service_rate[i][1]*x[i]
term2[i] = accuracy[i]*queue-scipop.quicksum(service_rate[k][1]*x[k] for k in range(len(service_rate)))
nonlinexp[i] = (term1[i]+term2[i]/2) + abs(term1[i]-term2[i])/2
print(type(nonlinexp[i]))
fun = scipop.quicksum(queue*service_rate[i][1]*x[i] + nonlinexp[i] for i in range(len(service_rate)))
model.setObjective(fun, "maximize")
model.optimize()
However I get the following error:
AssertionError: given coefficients are neither Expr or number but SumExpr
Could someone help me here? How can I solve this using PySCIPOpt? If not, why?
Metadata
Metadata
Assignees
Labels
No labels