# NL constrained optimization with generalized function

I have a objective function H, which follows following constrains: p - c - a > 0 && p > c > a && 0 < p < 1 && 0 < c < 1 && 0 < a < 1 && 0 < f[s] && Derivative[1][f][s] > 0 && Derivative[2][f][s] < 0 To have unique global maxima, I am assuming hessian of H to be negative definite. So, one more condition I got from here. But when I am using Maximize[{obj, const}, {var}] I am not able to get answer. Please help!

Edit 1: After a bit research on necessary conditions for KKT conditions I came to know that inequalities should be convex. Now I wonder how to tell Mathematica that these constrains are convex 0 < f[s] && Derivative[1][f][s] > 0 && Derivative[2][f][s] < 0

I can see the following code does not work.

    H = (-a - c + p) (1 - (2 p - f[s] Subscript[k, 2])/(
f[s] (2 Subscript[k, 1] + Subscript[k, 2])))
D[H, {{p, s}, 2}]
(*{{-(4/(f[s]*(2*Subscript[k, 1] +
Subscript[k, 2]))),
(2*(-a - c + p)*Derivative[1][f][
s])/(f[s]^2*
(2*Subscript[k, 1] +
Subscript[k, 2])) +
(Subscript[k, 2]*
Derivative[1][f][s])/
(f[s]*(2*Subscript[k, 1] +
Subscript[k, 2])) +
((2*p - f[s]*Subscript[k, 2])*
Derivative[1][f][s])/
(f[s]^2*(2*Subscript[k, 1] +
Subscript[k, 2]))},
{(2*(-a - c + p)*Derivative[1][f][
s])/(f[s]^2*
(2*Subscript[k, 1] +
Subscript[k, 2])) +
(Subscript[k, 2]*
Derivative[1][f][s])/
(f[s]*(2*Subscript[k, 1] +
Subscript[k, 2])) +
((2*p - f[s]*Subscript[k, 2])*
Derivative[1][f][s])/
(f[s]^2*(2*Subscript[k, 1] +
Subscript[k, 2])),
(-a - c + p)*
(-((2*Subscript[k, 2]*
Derivative[1][f][s]^2)/
(f[s]^2*(2*Subscript[k, 1] +
Subscript[k, 2]))) -
(2*(2*p - f[s]*Subscript[k, 2])*
Derivative[1][f][s]^2)/
(f[s]^3*(2*Subscript[k, 1] +
Subscript[k, 2])) +
(Subscript[k, 2]*
Derivative[2][f][s])/
(f[s]*(2*Subscript[k, 1] +
Subscript[k, 2])) +
((2*p - f[s]*Subscript[k, 2])*
Derivative[2][f][s])/
(f[s]^2*(2*Subscript[k, 1] +
Subscript[k, 2])))}}*)


For Hessian matrix [A B, C D] to be negative definite require A<0 and A D-BC>0 Here as f[s], k1, k2 >0 hence $$-(4/(f[s] (2 Subscript[k, 1]+Subscript[k, 2])))<0$$ for sure Checking AD- BC

Simplify[
(-(4/(f[s]*(2*Subscript[k, 1] +
Subscript[k, 2]))))*
((-a - c + p)*
(-((2*Subscript[k, 2]*
Derivative[1][f][s]^2)/
(f[s]^2*(2*Subscript[k, 1] +
Subscript[k, 2]))) -
(2*(2*p - f[s]*Subscript[k,
2])*Derivative[1][f][s]^
2)/(f[s]^3*
(2*Subscript[k, 1] +
Subscript[k, 2])) +
(Subscript[k, 2]*
Derivative[2][f][s])/
(f[s]*(2*Subscript[k, 1] +
Subscript[k, 2])) +
((2*p - f[s]*Subscript[k, 2])*
Derivative[2][f][s])/
(f[s]^2*(2*Subscript[k, 1] +
Subscript[k, 2])))) -
((2*(-a - c + p)*Derivative[1][f][
s])/(f[s]^2*
(2*Subscript[k, 1] +
Subscript[k, 2])) +
(Subscript[k, 2]*
Derivative[1][f][s])/
(f[s]*(2*Subscript[k, 1] +
Subscript[k, 2])) +
((2*p - f[s]*Subscript[k, 2])*
Derivative[1][f][s])/
(f[s]^2*(2*Subscript[k, 1] +
Subscript[k, 2])))*
((2*(-a - c + p)*Derivative[1][
f][s])/(f[s]^2*
(2*Subscript[k, 1] +
Subscript[k, 2])) +
(Subscript[k, 2]*
Derivative[1][f][s])/
(f[s]*(2*Subscript[k, 1] +
Subscript[k, 2])) +
((2*p - f[s]*Subscript[k, 2])*
Derivative[1][f][s])/
(f[s]^2*(2*Subscript[k, 1] +
Subscript[k, 2])))]
(*-((4*((a + c)^2*Derivative[1][f][s]^
2 + 2*p*(-a - c + p)*f[s]*
Derivative[2][f][s]))/
(f[s]^4*(2*Subscript[k, 1] +
Subscript[k, 2])^2))*)

Solve[
-((4*((a + c)^2*Derivative[1][f][
s]^2 + 2*p*(-a - c + p)*
f[s]*Derivative[2][f][s]))/
(f[s]^4*(2*Subscript[k, 1] +
Subscript[k, 2])^2)) == 0,
f[s]]
(*{{f[s] -> ((a + c)^2*
Derivative[1][f][s]^2)/
(2*(a + c - p)*p*
Derivative[2][f][s])}}*)


\text{So, for Hessian to be negative definite we have to have }

\frac{f[s]$$>$$(a+c)^2 f'(s)^2}{2 p (a+c-p) f''(s)}

Maximizing the objective function

Maximize[{H,
f[s] > ((a + c)^2*
Derivative[1][f][s]^2)/
(2*(a + c - p)*p*
Derivative[2][f][s]) &&
p - c - a > 0 && 0 < p < 1 &&
0 < c < 1 && 0 < a < 1 &&
0 < f[s] && Derivative[1][f][
s] > 0 && Derivative[2][f][
s] < 0}, {p, s}]


But it does not work

Following is the drive link to my code if anyone wants to view it: https://drive.google.com/file/d/1M9kE4GeOborZ1l8NQhrVmjNDYhaurYOZ/view?usp=sharing

Not an answer, but some observations.

Solve[-((4*((a + c)^2*Derivative[1][f][s]^2 +
2*p*(-a - c + p)*f[s]*Derivative[2][f][s]))/(f[
s]^4*(2*Subscript[k, 1] + Subscript[k, 2])^2)) == 0, f[s]]


Produces a solvable ODE:

fs = DSolveValue[
f[s] == ((a + c)^2 Derivative[1][f][s]^2)/(
2 (a + c - p) p (f^\[Prime]\[Prime])[s]), f[s], s]


The derivatives can be computed:

dfs = D[fs, s]
dfs2 = D[fs, {s, 2}]


This can be inserted into your constraints:

constraints = {f[
s] > ((a + c)^2*Derivative[1][f][s]^2)/(2*(a + c - p)*p*
Derivative[2][f][s]) && p - c - a > 0 && 0 < p < 1 &&
0 < c < 1 && 0 < a < 1 && 0 < f[s] && Derivative[1][f][s] > 0 &&
Derivative[2][f][s] < 0} /. {f[s] -> fs, f'[s] -> dfs,
Derivative[2][f][s] -> dfs2}


But, the constraints appear to be inconsistent?

Simplify[constraints] (*False*)

• Hi, Thank you for your time and observations. But the Simplify[constraints] has given same output as we get when we try Simplify[a + b > a + b] Jul 28, 2022 at 17:40