I have a function with a large number of variables that I am trying to minimize subject to some constraints, but for simplicity let us say that it only has two variables, f[x, y]. The constraint is that another function, g[z], must be positive in the interval given by x and y (in my problem I usually have around 200 variables, and it needs to be monotonical in the interval between the minimum and the maximum)
Edit: Following the comment by Daniel Huber, let's define
f[x_, y_] := x^3 + 2 x y + 3
g[z_] := z^2 - 2 z
where f is to be minimized in the region {x, y} [Element] Rectangle[{0, 0}, {4, 4}] subject to g[z] >= 0 for all z in the region Interval[{Min[x_solution, y_solution], Max[x_solution, y_solution]}]
If we did not have this constraint we would find that
Minimize[{f[x, y], constraint}, {x, y}]\[Element] Rectangle[{0, 0}, {4, 4}]
(* {3, {x -> 0, y -> 2}} *)
But g[z] < 0 for z ∈ Interval[{0, 2}]
Instead, the solution that I am looking for would be {19, {x -> 2, y -> 2}}
In my problem, the coefficients in the polynomial of g[z] are part of the variables that I am trying to optimize, while the rest of the variables are what defines the interval in which I want this polynomial to be positive (so I will take the minimum and maximum of these variables when defining the interval, similar to taking the minimum and maximum of x and y in this toy model), and it is not easy to find workarounds like studying the behavior of g[z] before optimizing f[x,y].
Additionally, my function involves a lot of terms and Minimize cannot solve it, so I would prefer solutions involving FindMinimum instead.
I hope the question is clearer now!
f
andg
. $\endgroup$c[x_, y_] = If[x < y, x < 2, y < 2]
and use it as a condition. $\endgroup$