Main Content

Write Constraints for Problem-Based Cone Programming

To ensure thatsolveorprob2structcallsconeprogfor a second-order cone problem, specify the second-order cone constraints as one of two types:

  • norm(linear expression) + constant <= linear expression

  • sqrt(sum of squares) + constant <= linear expression

Here,linear expressionmeans a linear expression in the optimization variables.sum of squaresmeans a sum of explicit squares of optimization variables, such assum(x.^2). The objective function forconeprogmust be linear in the optimization variables. For more information on the sum of squares form, seeWrite Objective Function for Problem-Based Least Squares.

solveandprob2structalso callconeprogwhen the constraint type has an equivalent form to the two listed:

  • linear expression >= sqrt(sum of squares) + constant

  • linear expression >= norm(linear expression) + constant

  • const*norm(linear expression) + constant <= linear expressionprovidedconst > 0

  • (sum of squares)^0.5instead ofsqrt(sum of squares)

For example,coneprogis the default solver for each of the following two equivalent problem formulations when you callsolve.

x = optimvar('x',3,...'LowerBound',[-Inf,-Inf,0],...'UpperBound',[Inf,Inf,2]); A = diag([1,1/2,0]); d = [0;0;1]; f = [-1,-2,0]; probnorm = optimproblem('Objective',f*x); probsumsq = optimproblem('Objective',f*x); consnorm = norm(A*x) <= d'*x; probnorm.Constraints.consnorm = consnorm; conssumsq = sqrt(sum((A*x).^2)) <= dot(d,x); probsumsq.Constraints.conssumsq = conssumsq; optnorm = optimoptions(probnorm); class(optnorm)
ans = 'optim.options.ConeprogOptions
optsumsq = optimoptions(probsumsq); class(optsumsq)
ans = 'optim.options.ConeprogOptions

If you write the second-order constraints differently, such as the mathematically equivalentsqrt(x'*x),solvecalls a different solver, such asfmincon. In this case, you need to supplysolvewith an initial point, and the solution process can be different (and often is less efficient), as in the following example.

x = optimvar('x',3,...'LowerBound',[-Inf,-Inf,0],...'UpperBound',[Inf,Inf,2]); A = diag([1,1/2,0]); d = [0;0;1]; f = [-1,-2,0]; prob = optimproblem('Objective',f*x); cons = sqrt(x'*A'*A*x) <= d'*x; prob.Constraints.cons = cons; opt = optimoptions(prob); class(opt)
ans = 'optim.options.Fmincon'

See Also

||

Related Topics