7
$\begingroup$

I want to solve a numerical optimization problem using semi-definite programming. Is there a package or add-on that equips mathematica with this functionality?

$\endgroup$
3
$\begingroup$

Semidefinite programming (see here) has been added to Mathematica 12. Example

(*Dimension of matrices*)
d = 5;
(*Create matrices a0,a1,a2*)
a0 = RandomReal[{-1, 1}, {d, d}];
a0 = a0.Transpose@a0;
a1 = IdentityMatrix@d;
v = RandomReal[{-1, 1}, d];
a2 = TensorProduct[v, v];
a = {a0, a1, a2};
(*Vector c on objective function f = c.x*)
c = {3, 1};
(*Compute solution*)
sol = SemidefiniteOptimization[c, a];
(*Check solution*)
A = a0 + sol.{a1, a2};
ev = Sort@Eigenvalues@A;
q = PositiveSemidefiniteMatrixQ@A;
Print["Minimizer {x1,x2} of c.x such that A = a0+x1*a1+x2*a2 is \
positive semidefinite: \n\t", sol, "\nEigenvalues of A: \n\t", ev, "\n\
Is A positive semidefinite?\n\t", q]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.