How can I solve infinite quadratic programs using the Optimization Toolbox?

15 次查看(过去 30 天)
The problem occurs if I have a quadratic:
.5*x'*H*x + f'*x
where H is indefinite (i.e. has both negative and positive eigenvalues) or negative definite and f has all zero elements. If this is the case, then the algorithm fails.
This problem does not happen when "f" has any nonzero elements.

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2022-10-14
Please follow this link to our website to review the limitation of QUADPROG:
The solution to indefinite or negative definite problems is often unbounded. In this case, "exitflag" is returned with a negative value to show a minimum was not found. Note that when a finite solution does exist, QUADPROG may only give local minima since the problem may still be nonconvex.
Try using the FMINCON function instead. Your objective function should be structured as:
myobjfun = @(x, H, c) (.5*x'*H*x + c'*x);
If you are using a version prior to MATLAB 7.0 (R14), you will need to create an inline function:
myobjfun = inline('(.5*x'*H*x + c'*x)', 'x', 'H', 'c');
The following function file computes the gradient of the quadratic and the first derivative matrix for the constraints, which in this case is just A':
function [g, gcon] = myg(x, H, c, A)
g = H*x + c;
gcon=A';
Then, FMINCON can be called using:
[x,optout] = fmincon(myobjfun, x0, A, b, [], [], lb, ub, @myg)
In general, QUADPROG should be preferred over FMINCON when possible, but for some particular problems, QUADPROG will not work.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Quadratic Programming and Cone Programming 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by