[AMPL 24558] Reduced cost issue with cplex

Hi team,

I just implemented a simple inventory model with two articles and six months.

The problem arises when I wanted to calculate the reduced cost of the sales variable called S_it. It is assumed that there should only be a reduced cost value >0 in those non-basic variables (with a value of zero at best); and the reduced cost must have a value of zero in those basic variables (with a value >0 in the optimum).

But this is not the case, when executing the ampl code, for example, the variable S_26 (with a value of zero in the optimum) also has a cost reduced to zero. Where is the error?

I attach all files (.dat, .run, and .mod) here: https://pastebin.com/2khH1vc3

Thank you for your time.


AMPL’s .status suffix can be used to see whether a variable is in the optimal basis returned by the solver. Since the variables are nonnegative, variables that are basic may be positive, and must have zero reduced costs; for example:

ampl: display S[1,6].status, S[1,6], S[1,6].rc;
S[1,6].status = bas
S[1,6] = 120
S[1,6].rc = 0

(The status “bas” means basic.) But also it is possible for a basic variable to have the value 0 in an optimal solution, as in the case of S[2,6]:

ampl: display S[2,6].status, S[2,6], S[2,6].rc;
S[2,6].status = bas
S[2,6] = 0
S[2,6].rc = 0

This situation, with both the variable’s value and the variable’s reduced cost equal to 0, is actually common. The variable (such as S[2,6]) is said to be “degenerate” in this case.

Thak you, It is clear now.