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.
We're switching to a new, enhanced user forum.