Reduce LP/QP/MPLP/MPQP by removing equality constraints
problem.eliminateEquations
eliminateEquations(problem)
problem |
LP/QP/MPLP/MPQP optimization problem given as Opt class. Class: Opt |
f = [-1 1 2];
A = [1 -1 0.4; 0.5 -9 -2; 0.5 -1 0; -5.1 -1 -3];
b = [1; 2; 2; 4];
Ae = [1 0 0]; be = 1;Create the problem
problem = Opt('A',A,'b',b,'f',f,'Ae',Ae,'be',be)
------------------------------------------------- Linear program Num variables: 3 Num inequality constraints: 4 Num equality constraints: 1 Solver: LCP -------------------------------------------------The problem has equality constraint
r = problem.solve
r = xopt: [3x1 double] lambda: [1x1 struct] obj: -6.884 how: 'ok' exitflag: 1
r.xopt
ans = 1 0.548 -3.216We can eliminate the equality constaint by calling
problem.eliminateEquations
------------------------------------------------- Linear program Num variables: 2 Num inequality constraints: 4 Num equality constraints: 0 Solver: LCP -------------------------------------------------The solution and the objective value is different
rn = problem.solve
rn = xopt: [2x1 double] lambda: [1x1 struct] obj: -6.884 how: 'ok' exitflag: 1
rn.xopt
ans = -3.216 0.548The mapping between the variables in the old and new problem are stored inside recover property.
problem.recover
ans = Y: [3x2 double] th: [3x1 double]To get the original solution, use
xold = problem.recover.Y*rn.xopt + problem.recover.th
xold = 1 0.548 -3.216We can see that the solution is the same
r.xopt - xold
ans = 0 0 0
[1] Stephen Boyd and Lieven Vandenberghe: Convex Optimization; Cambridge University Press
[2] Richard W. Cottle, Jong-Shi Pang, Richard E. Stone: Linear complementarity problem, Academic Press Inc. 1992
◀ | qp2lcp | opt | ▶ |
© 2010-2013 Colin Neil Jones: EPF Lausanne, colin.jones@epfl.ch
© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch