Procedure GMP::Instance::CalculateSubGradient(GMP, variableSet, constraintSet, session)

GMP::Instance::CalculateSubGradient

The procedure GMP::Instance::CalculateSubGradient can be used to solve By = x for a given vector x, where B is the basis matrix of a linear program. This procedure can only be called after the linear program has been solved to optimality.

GMP::Instance::CalculateSubGradient(
     GMP,           ! (input) a generated mathematical program
     variableSet,   ! (input) a set of variables
     constraintSet, ! (input) a set of constraints
     [session]      ! (input, optional) a solver session
     )

Arguments

GMP

An element in AllGeneratedMathematicalPrograms. The mathematical program should have model type LP or RMIP.

variableSet

A subset of AllVariables.

constraintSet

A subset of AllConstraints.

session

An element in the set AllSolverSessions.

Return Value

The procedure returns 1 on success, or 0 otherwise.

Note

  • Use the .ExtendedConstraint('RhsChange',*) suffix of the constraints in constraintSet to assign values to the vector x.

  • The suffix .ExtendedVariable('RhsChange',*) of the variables in variableSet will be used to store the subgradient y.

  • The suffixes .ExtendedConstraint and .ExtendedVariable have no unit and are not scaled.

  • This procedure should be called after a normal solve statement or after a successful call to procedure GMP::Instance::Solve.

  • This procedure can also be called after a successful call to the procedure GMP::SolverSession::Execute or the procedure GMP::SolverSession::AsynchronousExecute. In that case the solver session should be passed using the session argument.

  • A column corresponding to a variable in variableSet that is not part of GMP will be ignored. A row corresponding to a constraint in constraintSet that is not part of GMP will also be ignored.

  • This procedure is only supported by CPLEX and GUROBI.

  • This procedure cannot be used if the GMP is created by GMP::Instance::CreateDual.

Example

Assume that ‘MP’ is a linear mathematical program and c(i) is a constraint and v(j) is a variable in this mathematical program. The following example shows how to calculate a subgradient after a normal solve statement.

solve MP;

! The next statement needs to be called once.
AllGMPExtensions += { 'RhsChange' };

c.ExtendedConstraint('RhsChange',i) := 1.0;

GMP::Instance::CalculateSubGradient('MP',AllVariables,AllConstraints);

display v.ExtendedVariable('RhsChange',j);