hello,
I coded the following small MIP model and trying to solve it concert technology;
#include<ilcplex/ilocplex.h>
ILOSTLBEGIN
int main() {
IloEnv env;
IloModel model(env);
IloNumVarArray x(env);
x.add(IloNumVar(env, 0, 1, ILOINT));
x.add(IloNumVar(env, 0, 1, ILOINT));
x.add(IloNumVar(env, 0, 1, ILOINT));
x.add(IloNumVar(env, 0, 1, ILOINT));
model.add (8 * x[1] + 2 * x[2] + x[3] + 4 * x[4] <= 10);
model.add(x[1] + x[2]<= 1);
model.add(x[3] + x[4] <= 1);
model.add(IloMaximize(env, 16 * x[1] + 10 * x[2] + 4*x[4]));
IloCplex cplex(model);
cplex.solve();
cout << "Objective Value" << cplex.getObjValue() << endl;
env.end();
system("pause");
return 0;
}
I get two errors at the same time in the output screen it is written :
X& IloArray::operator[] (IloInt i) : Out of bounds operation: index superior to size of array
Assertion failed: (i < _impl->getSize()) || (ILOSTD(cerr) << "X& IloArray::operator[] (IloInt i) : Out of bounds operation: index superior to size of array" << ILOSTD(endl), ilo_stop_assert()), file c:\program files\ibm\ilog\cplex_studio129\concert\include\ilconcert\iloenv.h, line 2248
on the other hand execution is stopped with the message:
Exception non gérée à 0x00007FFECEC3284E (ucrtbase.dll) dans Projet1.exe : Fermeture de programme requise suite à une erreur irrécupérable.
All the variables are binary integer btw;
How can I fix this problem ?
Thank you in advance
#DecisionOptimization#Support#SupportMigration