Open Dogggggggggg opened 2 years ago
if I don't mistake, you only have to do:
model.solve()
c = model.get_cplex()
values = c.solution.get_dual_values([c1.index, c2.index, c3.index])
print(values)
which will internally call the getpi function based on your input. See https://www.ibm.com/docs/en/icos/12.8.0.0?topic=SSSA5P_12.8.0/ilog.odms.cplex.help/refpythoncplex/html/cplex._internal._subinterfaces.SolutionInterface-class.html#get_dual_values for example.
Dear CPLEX developers, I want to get the solutions of LP model and its dual problem simultaneously instead of transforming the primal problem into a dual problem.For example:
from docplex.mp.model import Model model = Model()
x1 = model.continuous_var(lb=0, name='x1') x2 = model.continuous_var(lb=0, name='x2')
model.add_constraint(2x1 + 3x2 <= 24) model.add_constraint(3x1 + 4x2 <= 30) model.add_constraint(3x1 + 2x2 <= 26)
f = 4x1 + 3x2
model.maximize(f)
How can I get the solution of its dual problem directly.