# Accessing Lagrange Multipliers in CPLEX

I want to get the lagrange multipliers for a solution from cplex. I am using it via Python.

The problem is continuous with a linear objective function and elements of solution vector $$x$$ are 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.

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

## 1 Answer

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 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 at 20:32