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
-
Official comment
This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
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
Post is closed for comments.
Comments
2 comments