A
P
Monitor Modeling Language
Click the arrow
to solve (solution appears below)
Load
a new benchmark problem.
How do you use APMonitor?
Visit the
APMonitorCom Channel
BPOPT
IPOPT
APOPT
Try All
Simulate
Estimate
Optimize
Simulate
Estimate
Optimize
Simulate
! Example quadratic programming problem ! ! minimize c * x + 1/2 * x^T * Q * x ! subject to A * x < b ! x > 0 ! ! In this case: ! c = [0.5 -1.5] ! ! Q = [1.0 0.0] ! [0.0 2.5] ! ! A = [2.0 1.0] ! [0.0 0.1] ! ! b = [0.0] ! [0.1] ! Model Parameters ! minimize (c^T * x) + 1/2 * (x^T * Q * x) ! linear terms c[1] = 0.5 c[2] = -1.5 ! quadratic terms ! sparse diagonal Q matrix Q[1][1] = 1.0 Q[2][2] = 2.5 ! inequality constraint ! A * x <= 0 A[1][1] = 2.0 A[1][2] = 1.0 A[2][1] = 0.0 A[2][2] = 0.1 b[1] = 0 b[2] = 0.1 End Parameters Variables x[1] > 0 x[2] > 0 End Variables Equations ! minimize (c^T * x) + 1/2 * (x^T * Q * x) minimize 0.5 * (x[1] * Q[1][1] * x[1]) minimize 0.5 * (x[2] * Q[2][2] * x[2]) minimize c[1]*x[1] + c[2]*x[2] ! subject to A * x <= b A[1][1]*x[1] + A[1][2]*x[2] <= b[1] A[2][1]*x[1] + A[2][2]*x[2] <= b[2] End Equations End Model
Your browser does not support iframes.
Terms and Conditions