CPLEX does not find true optimum despite optcr=0

Problems with modeling
Post Reply
chrispahm
User
User
Posts: 13
Joined: 1 year ago

CPLEX does not find true optimum despite optcr=0

Post by chrispahm » 7 months ago

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)
Attachments
cropRot_optCR.gms
(19.68 KiB) Downloaded 28 times

ameeraus
User
User
Posts: 2
Joined: 10 months ago

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

Post by ameeraus » 7 months 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'

chrispahm
User
User
Posts: 13
Joined: 1 year ago

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

Post by chrispahm » 7 months ago

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:
7 months 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'

Post Reply