I want to solve the MILP problem with CPLEX-C#. The size of my problem is large and in order to improve the CPU time I want to use initial solution. I want to add this solution into cplex and start to solve the problem with this given initial solution. I used the following code:
try
{
startvar = new INumVar[numberOfAllNode * numberOfAllNode];
startval = new double[numberOfAllNode * numberOfAllNode];
for (int i = 0, idx = 0; i < numberOfAllNode; i++)
for (int j = 0; j < numberOfAllNode; j++)
{
startvar[idx] = X[i][j];
startval[idx] = start[i][j];
idx++;
}
startvar = null;
startval = null;
cplex.AddMIPStart(startvar, startval,Cplex.MIPStartEffort.SolveMIP);
}
catch (ILOG.Concert.Exception)
{
throw;
}
In this code I have multidimensional array decision variables X[i][j]
(binary decision variable) and the values are equal to start[i][j]
. The values of the start[i][j]
are stored as double [] array
as parameter. When I run the code, following errors are appeared:
Warning: No solution found from 1 MIP starts.
Root node processing (before b&c):
Real time = 5.07 sec. (2238.50 ticks)
Parallel b&c, 4 threads:
Real time = 0.00 sec. (0.00 ticks)
Sync time (average) = 0.00 sec.
Wait time (average) = 0.00 sec.
------------
Total (root+branch&cut) = 5.07 sec. (2238.50 ticks)
Couldn't Solve The Problem!
I have two questions: 1) in which part of the model I have to put this code? ( I mean after the all constraints and adding objective value and calling addMin or addMax or before them?)
2) When I commend out startvar = null; startval = null;
I have following error:
An unhandled exception of type 'ILOG.CPLEX.Cplex.UnknownObjectException' occurred in CPLEX.exe
Additional information: CPLEX Error: object is unknown to IloCplex
I would appreciate if you could help in order to handle this issue.