M

Top  Previous  Next

Variables and equations have what is known as a marginal value that is the current shadow price or reduced cost for that item.  The marginal value for a variable is the current reduced cost after a solution plus it helps provide a basis for the model.  The marginal value for an equation is the shadow price for the equation and in general is not defined before solution but if present helps provide a basis for the model.  The attribute is addressed using .M as follows

 

Variable marginal is variablename.M(setdependency)

Equation marginal is equationname.M(setdependency)

 

These are commonly used in calculations to do one of two things

Variable marginals are set at nonzero values pre solution to provide an advanced basis.
Variable and equation marginals are used post optimality in report writing.

 

 incoming(destinaton,"Marg Cost of","meeting needs"," ","Total")  =

         demandbal.m(destinaton);

Example:

(varmodatt.gms)

sinkdemand.M(sink)=1;

sourcesupply.M(source)=1;

solve transport using lp minimizing cost;

shadowprices("demand",sink)=sinkdemand.M(sink);

shadowprices("supply",source)=sourcesupply.M(source);

Note:

The marginal values receives new data after a solve statement is executed.