model.addGenConstrAbs PROBLEM
AnsweredHello GUROBI team,
I am currently trying to develop program for Double Row Layout Program with safety consideration with GUROBI optimizer by adding this constraint below for my bachelor thesis. With this new constraint, the result isn't optimal, i think there is something wrong with implementation of this constraint. Can you help me define the fault possibility? or can you provide me with other form of this constraint with the same meaning? Thank you so much.
for i in N:
for j in N:
if i < j:
orig_var = model.addVar(vtype = grb.GRB.CONTINUOUS)
constant = model.addVar(vtype = grb.GRB.CONTINUOUS)
model.addConstr((orig_var == X[j] - X[i]), name='CS15')
model.addGenConstrAbs(constant, orig_var, "constant")
model.addConstr(((constant >= Rdist[i,j])), name='CS16')
0
-
Hi,
The default lower bound for optimization variables is \(0\). I guess that the value of your \(\texttt{orig_var}\) can be negative, thus you should make it a free variable.
orig_var = model.addVar(lb=-grb.GRB.INFINITY,vtype = grb.GRB.CONTINUOUS)
Best regards,
Jaromił0
Please sign in to leave a comment.
Comments
1 comment