I'm working on LP iterative rounding using concert c++. My ILP and LP codings work properly. However when i try to round LP iterativly i get infeasible soulution. In every iteration i try to find maximum value of decision variable x which is float number between 0-1 and make it 1(actually i'm adding it as a new constraint). However sometimes i get infeasible solution which actually shouldn't be a case. Error is as below: Infeasible indicator constraint presolve time:3.53 sec. Error:cplex Error 1217: No solution exists.
I'm working on a graph and trying to find a shorthest path. My ILP find path properly. However i need LP solution for big graphs. For that purpose wrote a LP formula. As result I got float numbers. Here I iteratively rounding one edge to 1. Finally i try to get a path.
And my code is as below:
do
{
max=0;
for(int i=0; i<edgesize*2;i++)
{
if(cplex.getValue(x[i])>0 && cplex.getValue(x[i])<1 && cplex.getValue(x[i])>max )
{
max = cplex.getValue(x[i]);
}
}
if(max !=0)
{
for(int i=0; i<edgesize*2;i++)
{
if(cplex.getValue(x[i])==max)
{
model.add(x[i]==1);
break;
}
}
}
cplex.extract(model);
cplex.solve();
cplex.out() << "Optimal value: " << cplex.getObjValue() << endl;
it++;
} while(max !=0);
What would be a problem here? How can i solve it? Thanks in Advance.
I am a beginner in programming. I am trying to solve MILP
by C
and cplex concert technology
When i run I received the following message
Pr=1.00 X ILO Array::operator[][](Iloint i): out of bound operation: index superior to size of array
Assertaion failed: (i<_impl->get size()) ||(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 file\ibm\ilog\cplex-studio 125\concert\include\ilconcert\iloenv.h, line 2204
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.