Let’s say your constraint contains a parameter, for example x*cos(t)+y < 1, it must hold for all t\in [0;2pi] . Is it possible to include a constraint like this? I don’t see any solution in the documentation of Minimize/Maximize:
The constraints cons can be any logical combination of:
lhs==rhs equations
lhs!=rhs inequations
lhs>rhs or lhs>=rhs inequalities
{x,y, }?reg region specification
Exists[x,cond,expr] existential quantifiers
I wrote some code, which might look messy, but hope you can see through it and tell me how to make it work. Minimize outputs itself, which is becouse it doesn’t have enough information to solve the problem?
n = 2;
k = Binomial[n,2];
m = n + k;
Xs = Array[x,n];
Ds = Array[d,m];
PHIs = Array[phis,n-1];
Cs = Array[c,n];
c[1]=0
c[2]=0
x[1]=d[1]*Cos[d[3]]*Cos[phis[1]]-d[2]*Sin[d[3]]*Sin[phis[1]]+c[1]
x[2]=d[1]*Sin[d[3]]*Cos[phis[1]]+d[2]*Cos[d[3]]*Sin[phis[1]]+c[2]
expr = x[1]^2-x[2]-2
objfun = -Times @@ Part[Ds,1;;n]
Minimize[{objfun,{phis[1]>=0,phis[1]<=2*Pi,!Exists[phis[1],expr>0]}},{d[1],d[2],d[3]}]
The code supposed to solve:
min -d_1*d_2
s.t x_1^2-x_2-2\leq 0
where x_1=d_1*cos(d_3)*cos(\phi_1)-d_2*sin(d_3)*sin(\phi_1)+c_1 and x_2=d_1*sin(d_3)*cos(\phi_1)+d_2*cos(d_3)*sin(\phi_1)+c_2
for all \phi_1 in the [0;2pi] interval, which can be transformed to the !Exist form according to Frank’s suggestion
This problem is finding the maximal area ellipse in the x_2\geq x_1^2-2 region, given it’s center (0,0).