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
-
Hi Nooshin,
abs_ is a function from our Python API and does not exist in the C++ API.
Please use GRBModel::addGenConstrAbs()
- Riley
0
Please sign in to leave a comment.
Comments
1 comment