2
$\begingroup$

I want to get the lagrange multipliers for an LP problem solution calculated using CPLEX. I am using it via Python.

The problem is an LP problem with continuous variables with a linear objective function and elements of solution vector $x$ are linearly constrained to be in the interval $[0,1]$. Here are the main cplex calls.

my_prob = cplex.Cplex()
my_prob.objective.set_sense(my_prob.objective.sense.minimize)
my_prob.variables.add(obj=my_obj,
                      lb=my_lb,
                      ub=my_ub,
                      names=my_colNames)

my_prob.linear_constraints.add(lin_expr=my_rows,
                               senses=my_sense,
                               rhs=my_rhs)

my_prob.solve()
x = my_prob.solution.get_values()

$x$ contains the solution. I want to know what function returns the Lagrange multipliers of the solution. I now think the answer is

l = my_prob.solution.get_dual_values()

Can someone please confirm.

$\endgroup$
1
  • $\begingroup$ Is your problem an LP? (You specified that the objective was linear but left the constraints unspecified.) If so, by "lagrange multipliers" do you mean the solution to the dual LP? $\endgroup$
    – prubin
    Commented May 1, 2021 at 21:11

2 Answers 2

4
$\begingroup$

From the official CPLEX documentation here (CPLEX 20.1): SolutionInterface.get_dual_values() does indeed return the Lagrange/dual values.

$\endgroup$
1
  • $\begingroup$ as far as I know, and at least in the subgradient method to solve MIPs, if one working on the Lagrangian dualized function in an exact manner, e.g. solving by a mip solver, using dual value of the constraint would not be useful. $\endgroup$
    – A.Omidi
    Commented Dec 5, 2022 at 20:33
3
$\begingroup$

First of all, you should determine the sign of the multipliers based on the objective function direction and how the complicating constraints are violated. Then you have to use a standard method like subgradient optimization to solve the lagrangian dualized problem to determine the optimal value of the multipliers. For more details:

  • Marshall L. Fisher, An applications-oriented guide to lagrangian relaxation, Interfaces 15(1985), no. 2, 10-21.
  • Richard Kipp Martin, Large scale linear and integer optimization; a unified approach, Kluwer,1999.
  • Fundamentals of Supply Chain Theory by Lawrence V. Snyder.
$\endgroup$
2
  • $\begingroup$ I looked at this. - do you think this is correct ? stackoverflow.com/questions/66827883/… $\endgroup$
    – Dom
    Commented May 1, 2021 at 18:09
  • $\begingroup$ @Dom, I think you should start with an algorithm to optimize the Lagrangian dualized such as the subgradient method, etc. Some times the multipliers are set either zero or equal to the marginal value of the complicating constraint at the start of the algorithm. I hope it helps. $\endgroup$
    – A.Omidi
    Commented May 1, 2021 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.