Thanks Alex. This is very useful. Unfortunately I am stuck with 12.5 on the remote hpc.
Looking at my code - I believe I actually don't need the write/read MIPstart if I iteratively change a lowerbound and call cplex.solve() at each iteration. As I am not generating a new model. It seems that cplex keeps the solution from the previous problem as MIP start. Is it correct?
main
{
var init = 682; // start with this ctSpeciesSaved.LB=init;
var upto = 400; // iterate until
thisOplModel.generate();
thisOplModel.ctSpeciesSaved.LB=init; // first LB is init
writeln("Solve "+thisOplModel.ctSpeciesSaved.LB);
cplex.solve();
var curr = cplex.getObjValue();
var upcost = thisOplModel.budget; //new upperbound constraint for next iteration
writeln();
writeln("OBJECTIVE: ",curr);
thisOplModel.postProcess(); // write and process solution in csv file.
var newSaved = init-1; // new target
while (newSaved > upto){
thisOplModel.ctSpeciesSaved.LB = newSaved; // update LB constraint
thisOplModel.ctCost.UB = upcost; // update UB constraint
writeln("Solve"+newSaved);
cplex.solve(); // solve
curr = cplex.getObjValue();
writeln();
writeln("OBJECTIVE: ",curr);
upcost = thisOplModel.budget; // update upcost
writeln("Write CSV file");
thisOplModel.postProcess();
newSaved= newSaved - 1; // update newSaved
}
}
Execution on CPLEX 12.5
<<< setup
Solve 682
Tried aggregator 1 time.
MIP Presolve eliminated 1156 rows and 920538 columns.
MIP Presolve added 4499 rows and 4499 columns.
MIP Presolve modified 4024 coefficients.
Reduced MIP has 4638 rows, 48278 columns, and 109559 nonzeros.
Reduced MIP has 31984 binaries, 16294 generals, 0 SOSs, and 0 indicators.
Presolve time = 5.83 sec. (869.66 ticks)
Probing time = 0.05 sec. (7.17 ticks)
Clique table members: 112.
MIP emphasis: optimality.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 16 threads.
Root relaxation solution time = 1.30 sec. (48.69 ticks)
Nodes Cuts/
Node Left Objective IInf Best Integer Best Bound ItCnt Gap
0 0 6.44747e+09 166 6.44747e+09 211
0 0 6.44747e+09 293 Cuts: 162 517
0 0 6.44747e+09 371 Cuts: 136 775
* 0+ 0 6.44791e+09 6.44747e+09 775 0.01%
Cover cuts applied: 5
Flow cuts applied: 3
Mixed integer rounding cuts applied: 173
Zero-half cuts applied: 30
Gomory fractional cuts applied: 46
Root node processing (before b&c):
Real time = 9.53 sec. (2688.02 ticks)
Parallel b&c, 16 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) = 9.53 sec. (2688.02 ticks)
OBJECTIVE: 6447907838.182847
Solve681
2 of 2 MIP starts provided solutions.
MIP start 'm2' defined initial solution with objective 6.4479e+09.
Tried aggregator 2 times.
MIP Presolve eliminated 0 rows and 640765 columns.
MIP Presolve added 80 rows and 80 columns.
MIP Presolve modified 3673 coefficients.
Aggregator did 39 substitutions.
Reduced MIP has 1336 rows, 323593 columns, and 2236411 nonzeros.
Reduced MIP has 254541 binaries, 69052 generals, 0 SOSs, and 0 indicators.
Presolve time = 15.83 sec. (3207.09 ticks)
....
Many thanks,
iadine
------------------------------
iadine chades
------------------------------
Original Message:
Sent: Thu April 08, 2021 02:07 PM
From: ALEX FLEISCHER
Subject: unknown property 'writeMIPStarts'
Hi,
I suggest to move your cplex 12.5 to a more recent version.
If you cannot then you may use scripting to write the .mst
The opposite of what is done in https://community.ibm.com/community/user/datascience/communities/community-home/digestviewer/viewthread?MessageKey=9a8f8762-9eb2-4688-9a76-6d3b791a072c&CommunityKey=ab7de0fd-6f43-47a9-8261-33578a231bb7&tab=digestviewer#bm9a8f8762-9eb2-4688-9a76-6d3b791a072c
regards
------------------------------
[Alex] [Fleischer]
[EMEA CPLEX Optimization Technical Sales]
[IBM]
Original Message:
Sent: Wed April 07, 2021 07:45 AM
From: iadine chades
Subject: unknown property 'writeMIPStarts'
Hi everyone,
I wrote an opl model with 20.1 to solve ~1000 ILPs, each ILP has a different constraint value. I use MIPStarts to speed up the process (but still will take about 2-3 weeks).// simplified version:
main
{
var init = 1000;
var upto = 0;
thisOplModel.generate();
thisOplModel.ctSpeciesSaved.LB=init;
writeln("Solve "+thisOplModel.ctSpeciesSaved.LB);
cplex.solve();
var filename = "c:/Temp/mipstart"+init+".mst";
cplex.writeMIPStarts(filename, 0, 1); // works with 20.1 not with 12.5
thisOplModel.postProcess();
var newSaved = init-1; // new constraint
while (newSaved > upto){
thisOplModel.ctSpeciesSaved.LB = newSaved;
cplex.readMIPStarts(filename);
writeln("Solve"+newSaved);
cplex.solve();
cplex.writeMIPStarts(filename, 0, 1); // writing
writeln("Write CSV file");
thisOplModel.postProcess();
newSaved= newSaved - 1;
}
}
I have access to a hpc that has IBM ILOG cplex optimization Studio 12.5 - My hope was to send batch jobs to speed up the calculation of solutions. Unfortunately I get an error on 12.5 that I wasn't getting on 20.1.
***ERROR[SCRIPT_002] at 149:0 warmstart.mod: Scripting runtime error: unknown property 'writeMIPStarts'.
I have struggle finding documentation for 12.5 and help online.
Is there a work around? My best guess is that writeMIPStarts cannot be used with oplrun 12.5. but I am not sure how to write an alternative version that doesn't call write/readMIPStarts.
Thanks in advance!
------------------------------
iadine chades
------------------------------
#DecisionOptimization