# Accessing Lagrange Multipliers in CPLEX

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)
lb=my_lb,
ub=my_ub,
names=my_colNames)

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()


• 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?
– prubin
May 1, 2021 at 21:11

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

• 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. Dec 5, 2022 at 20:33

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.
• I looked at this. - do you think this is correct ? stackoverflow.com/questions/66827883/…
– Dom
May 1, 2021 at 18:09
• @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. May 1, 2021 at 20:32