# Evaluate constraints with NMaximize?

Posted 7 months ago
701 Views
|
2 Replies
|
1 Total Likes
|
 I have the following problem with the optimization function(s): It seems that my function CDF[...] is not evaluated or the optimization function considers the starting point as infeasible or smth else ... a = 1; b = 1; m = 2; A = 3; B = 1; a1 = {1 , 1, 1}; b1 = {1, 3, 4}; CDF[LogNormalDistribution[5, 2], D2[a, b, m, A, B, a1, b1]] - CDF[LogNormalDistribution[5, 2], D1[a, b, m, A, B, a1, b1]] >= 0.01 Out[129]= True In[130]:= FindMaximum[{z, {CDF[LogNormalDistribution[5, 2], D2[x, y, z, A, B, a1, b1]] - CDF[LogNormalDistribution[5, 2], D1[x, y, z, A, B, a1, b1]] >= 0.01 && x >= 0 && y >= 0 && z >= 0}}, {{x, a}, {y, b}, {z, m}}] During evaluation of In[130]:= FindMaximum::eqineq: Constraints in {False} are not all equality or inequality constraints. With the exception of integer domain constraints for linear programming, domain constraints or constraints with Unequal (!=) are not supported.Many thanks for any suggestion.
2 Replies
Sort By:
Posted 7 months ago
 It is impossible to diagnose without a full example, which requires definitions for D1 and D2.Also the subject header does not quite match the details in the post (it's pretty clear at least to me how such a mistake can arise-- I do similar often enough as code details change).
 OK, these are the full definitions: a = 1; b = 1; m = 2; A = 3; B = 1; a1 = {1 , 1, 1}; b1 = {1, 3, 4}; \[Lambda]1[a_, b_, m_, A_, B_] := a + b/(B - 2*b )*(a - A - Sqrt[(a - A)^2 - 4 *m*(B - 2*b)]) /; 2*b > B; \[Lambda]1[a_, b_, m_, A_, B_] := a + B*m/(a - A) /; 2*b == B && a > A ; \[Lambda]1[a_, b_, m_, A_, B_] := a + b/(B - 2*b )*(a - A - Sqrt[(a - A)^2 - 4 *m*(B - 2*b)]) /; 2 b < B && a >= A + 2 Sqrt[m (B - 2*b)]; \[Lambda]1[a_, b_, m_, A_, B_] := Infinity; \[Lambda]2[a_, b_, m_, A_, B_] := Infinity /; 2 b > B; \[Lambda]2[a_, b_, m_, A_, B_] := Infinity /; 2*b == B && a > A ; \[Lambda]2[a_, b_, m_, A_, B_] := a + b/(B - 2*b )*(a - A + Sqrt[(a - A)^2 + -4 *m*(B - 2*b)]) /; 2 b < B && a >= A + 2 Sqrt[m (B - 2*b)]; \[Lambda]2[a_, b_, m_, A_, B_] := Infinity; PosPart[x_] := x /; x >= 0; PosPart[x_] := 0; D1[a_, b_, m_, A_, B_, a1_, b1_] := Total[Map[PosPart, (\[Lambda]1[a, b, m, A, B] - a1)/(2*b1)]] D2[a_, b_, m_, A_, B_, a1_, b1_] := Total[Map[PosPart, (\[Lambda]2[a, b, m, A, B] - a1)/(2*b1)]] And I apologize, of course "?" is missing in the title. Thank you.