Abs function in Cpp
AnsweredI need to define the absolute value of some varibales in cpp and I have used the provided syntax like :
for (int v = 1; v <= nVehicles; v++) {
for (int i = 1; i <= NA[v - 1].size(); i++) {
for (int m = 1; m <= Mu[(NA[v - 1][i - 1]) - 1]; m++) {
GRBVar ABS;
model->addConstr(ABS == abs_(gap_prev[v][NA[v - 1][i - 1]][m]));}}}
but still I get the error as :"identifier abs_" is undefined! Would you please help me to know the problem?
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 Nooshin,
abs_ is a function from our Python API and does not exist in the C++ API.
Please use GRBModel::addGenConstrAbs()
- Riley
0
Post is closed for comments.
Comments
2 comments