Reduced cost issue with cplex

18 views
Skip to first unread message

dmo...@gmail.com

unread,
Feb 22, 2023, 11:24:54 PM2/22/23
to AMPL Modeling Language
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.

Regards,

AMPL Google Group

unread,
Feb 23, 2023, 3:35:17 PM2/23/23
to AMPL Modeling Language
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.


--
Robert Fourer

We're switching to a new, enhanced user forum.
Join it now at discuss.ampl.com.
{#HS:2163977448-114171#}

Daniel M. T.

unread,
Feb 24, 2023, 4:43:09 PM2/24/23
to am...@googlegroups.com
Thak you, It is clear now. 

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ampl/reply-77152-2163977448-6450599186-1677184512-2115039120%40helpscout.net.


--
Daniel Morillo Torres
Ph.D. en Informática
Universitat Politècnica de València
Maestría en Ingeniería de Sistemas
Ingeniería Industrial
Universidad Nacional de Colombia



Reply all
Reply to author
Forward
0 new messages