Ahora está siguiendo esta publicación
- Verá actualizaciones en las notificaciones de contenido en seguimiento.
- Podrá recibir correos electrónicos, en función de las preferencias de comunicación que haya establecido.
apm_quadprog Quadratic programming.
y = apm_quadprog(H,f,A,b,Aeq,beq,LB,UB,X0) writes a quadratic programming model in APMonitor Modeling Language and attempts to solve the quadratic programming problem:
min 0.5*x'*H*x + f'*x subject to: A*x <= b, Aeq*x = beq
x
lb and ub are a set of lower and upper bounds on the design variables, x, so that the solution is in the range lb <= x <= ub. Use empty matrices for any of the arguments. Set lb(i) = -1e20 if x(i) has no lower limit and set ub(i) = 1e20 if x(i) has no upper limit. x0 is the initial guess and starting point to x. This is similar to the Matlab quadprog solver but uses different solvers such as IPOPT, APOPT, and BPOPT to solve the QP. Additional nonlinear constraints can be added to the qp.apm model for nonlinear programming solution with support for possible mixed-integer variables.
The solution is returned in the structure y with y.names (variable names), y.values (variable values), y.nvar (number of variables), and y.x (a structure containing each variable and value).
Example usage is below:
clear all; close all; clc
disp('APM MATLAB available for download at http://apmonitor.com')
addpath('apm')
%% example Quadratic program
H = [1 -1; -1 2];
f = [-2; -6];
A = [1 1; -1 2; 2 1];
b = [2; 2; 3];
Aeq = [];
beq = [];
lb = zeros(2,1);
ub = [];
x0 = [];
%% generate APMonitor QP model
y1 = apm_quadprog(H,f,A,b,Aeq,beq,lb,ub,x0);
%% compare solution to quadprog (MATLAB)
y2 = quadprog(H,f,A,b,Aeq,beq,lb,ub,x0)
disp('Validate Results with MATLAB linprog')
for i = 1:nx,
disp(['x[' int2str(i) ']: ' num2str(y1.values(i)) ' = ' num2str(y2(i))])
end
Citar como
John Hedengren (2026). Quadratic Programming with Nonlinear Programming Solvers (https://la.mathworks.com/matlabcentral/fileexchange/49596-quadratic-programming-with-nonlinear-programming-solvers), MATLAB Central File Exchange. Recuperado .
Categorías
Más información sobre Quadratic Programming and Cone Programming en Help Center y MATLAB Answers.
Información general
- Versión 1.0.0.0 (20 KB)
Compatibilidad con la versión de MATLAB
- Compatible con cualquier versión
Compatibilidad con las plataformas
- Windows
- macOS
- Linux
| Versión | Publicado | Notas de la versión | Action |
|---|---|---|---|
| 1.0.0.0 |
