1
$\begingroup$

I have a complex (but still finite-dimensional convex) program in mind for which I want to use Mathematica to solve numerically. For this reason, I was trying my hand on simpler instances. Consider the feasible compact convex program $$\begin{aligned}\max_{a,b,c,d\in[0,1]} &\quad a-3b-2c+d\\\text{s.t.} &\quad \sqrt{ab}+\sqrt{cd}\geq1.\end{aligned}$$

It is feasible of course for $a=b=c=d=1$, and it is convex as the function $(x,y)\in[0,1]^2\mapsto\sqrt{xy}$ is concave. Naively, I thought specifying the method "Convex" to NMaximize would let Mathematica use convex optimization methods, instead it throws an error which is the title of this post. The code in question is the following:

NMaximize[a - 3  b - 2  c + d, 
  {0 <= a <= 1, 0 <= b <= 1, 0 <= c <= 1, 0 <= d <= 1,
    Sqrt[a b] + Sqrt[c d] >= 1},
  {a, b, c, d},
  Method -> "Convex"]

My questions are 1) What does specifying Method->"Convex" really do? 2) Does NMaximize always find the minimum of a convex program (it seemed to fail on the more complex instance)?

$\endgroup$

1 Answer 1

0
$\begingroup$

I can say nothing about the Method->"Convex" option (new in 12.3), but there is a workaround.

f[e_?NumericQ] := NMaximize[a - 3 b - 2 c + d, {0 <= a <= 1, 0 <= b <= 1, 
0 <= c <= 1,  0 <= d <= 1, Sqrt[a b] >= e, Sqrt[c d] >= 1 - e}, {a, b, c, d}, 
Method -> "Convex"] // First

and

Plot[f[e], {e, 0, 1}]

and

Table[{e, f[e]}, {e, 0.25, 0.60, 0.01}]

{{0.25, 0.687501}, {0.26, 0.702002}, {0.27, 0.715498}, {0.28, 0.727997}, {0.29, 0.739503}, {0.3, 0.749998}, {0.31, 0.759504}, {0.32, 0.767997}, {0.33, 0.7755}, {0.34, 0.782}, {0.35, 0.7875}, {0.36, 0.791998}, {0.37, 0.795499}, {0.38, 0.797999}, {0.39, 0.7995}, {0.4, 0.800001}, {0.41, 0.799498}, {0.42, 0.798001}, {0.43, 0.795499}, {0.44, 0.792001}, {0.45, 0.787498}, {0.46, 0.782002}, {0.47, 0.775499}, {0.48, 0.767999}, {0.49, 0.759498}, {0.5, 0.749999}, {0.51, 0.7395}, {0.52, 0.728}, {0.53, 0.715499}, {0.54, 0.701999}, {0.55, 0.6875}, {0.56, 0.672}, {0.57, 0.6555}, {0.58, 0.638}, {0.59, 0.619499}, {0.6, 0.599999}}

suggest that the maximum is at e==0.4.

Edit. Version 12.3 instead of 14.1.

$\endgroup$
4
  • $\begingroup$ Method->"Convex" has been documented since version 12.3. $\endgroup$
    – Domen
    Commented Sep 10 at 20:23
  • $\begingroup$ Please note that Sqrt[a b] + Sqrt[c d] >= 1 does not equivalent to Sqrt[a b] >= e && Sqrt[c d] >= 1 - e $\endgroup$
    – cvgmt
    Commented Sep 10 at 23:23
  • $\begingroup$ @Domen: Thank you for the refinement. Fixed. $\endgroup$
    – user64494
    Commented Sep 11 at 4:25
  • $\begingroup$ @cvgmt: Did you think twice before having commented? The code Resolve[ForAll[{a, b, c, d}, a >= 0 && a <= 1 && b >= 0 && b <= 1 && c >= 0 && c <= 1 && d >= 0 && d <= 1, Exists[e, e >= 0 && e <= 1, Equivalent[Sqrt[a* b] + Sqrt[c* d] >= 1, Sqrt[a *b] >= e && Sqrt[c *d] >= 1 - e]]], Reals] outputs True. $\endgroup$
    – user64494
    Commented Sep 11 at 4:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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