Page 1 of 1

CPLEX does not find true optimum despite optcr=0

Posted: Fri Apr 19, 2019 9:45 am
by chrispahm
Hi everyone,

In a MIP model with

Code: Select all

option optCR=0;
, I face the problem that CPLEX does not return the "true" optimal solution to the problem.
When I manually fix some binaries, I can increase the objective value (without breaking any constraints) by more than 1%.
I'm sure that this is caused by a mistake I made in setting up the model, but I can't seem to find it.

P.S.: I attached the model to this post, in there you may find the binary fixes that lead to the increased optimum at the end of the file (wrapped in $ontext/$offtext)

Re: CPLEX does not find true optimum despite optcr=0

Posted: Sat Apr 20, 2019 11:35 pm
by ameeraus
You did set the upper bound for the variable v_binCatchcrop() earlier in the program to zero and later wanted to fix it to one. CPLEX is usually right. To catch the problem I inserted a bit of code:

* enter this some place before you fix the CatchCrop variables
parameter Catchcropup(curCrops,curPlots) upper bound already set to 0;
Catchcropup(curCrops,curPlots) = v_binCatchcrop.up(curCrops,curPlots);

v_binCatchCrop.fx('Mais - Silomais','ca960201-a2cb-4bab-87af-6bec5cc105af') = 1;

set error(curCrops,curPlots) cannot reset upper bound to 1;
error(curCrops,curPlots) = Catchcropup(curCrops,curPlots) < v_binCatchcrop.up(curCrops,curPlots);
option error:0:0:1; abort$card(error) 'cannot reset upper bound',error;



---- 599 cannot reset upper bound

---- 599 SET error tried to reset upper bound to 1

Mais - Silomais.ca960201-a2cb-4bab-87af-6bec5cc105af

**** Exec Error at line 599: Execution halted: abort$1 'cannot reset upper bound'

Re: CPLEX does not find true optimum despite optcr=0

Posted: Wed Apr 24, 2019 1:45 pm
by chrispahm
Thanks @ameeraus for the reply and the elegant solution to my problem.
As you might have guessed, I totally oversaw that my .fx was actually resetting the lower bound of the variable. If I would have actually set a lower bound of 1 (instead of fixing it), I would have received a matrix error stating that the lower bound > upper bound.
Anyways, thanks a lot for the help!
Best
Christoph
ameeraus wrote: 5 years ago You did set the upper bound for the variable v_binCatchcrop() earlier in the program to zero and later wanted to fix it to one. CPLEX is usually right. To catch the problem I inserted a bit of code:

* enter this some place before you fix the CatchCrop variables
parameter Catchcropup(curCrops,curPlots) upper bound already set to 0;
Catchcropup(curCrops,curPlots) = v_binCatchcrop.up(curCrops,curPlots);

v_binCatchCrop.fx('Mais - Silomais','ca960201-a2cb-4bab-87af-6bec5cc105af') = 1;

set error(curCrops,curPlots) cannot reset upper bound to 1;
error(curCrops,curPlots) = Catchcropup(curCrops,curPlots) < v_binCatchcrop.up(curCrops,curPlots);
option error:0:0:1; abort$card(error) 'cannot reset upper bound',error;



---- 599 cannot reset upper bound

---- 599 SET error tried to reset upper bound to 1

Mais - Silomais.ca960201-a2cb-4bab-87af-6bec5cc105af

**** Exec Error at line 599: Execution halted: abort$1 'cannot reset upper bound'