0
$\begingroup$

I have the following code;

m = 30 10^2;
s = 10;
t = -Log[2, 10^-(s + 2)];

delta = 455 10^-4;
epsqkd = 10^-(s);

binent[p_] := -p Log[2, p] - (1 - p) Log[2, (1 - p)];

r = 119 10^-2  binent[delta];

epspa[nu_, beta_, alpha_] := 
  1/2 Sqrt[
    2^(-(m - beta m) (1 - binent[delta + nu]) + r (m - beta m) + t + 
       alpha m)];

gammaFunc[n_, k_, merr_, m_] := 1/(merr + 1) + 1/(m - merr + 1);

epspe[nu_, eta_, beta_] := 
  Sqrt[Exp[-2 m beta m eta^2/(m - beta m + 1)] + 
    Exp[-2 gammaFunc[m - beta m, beta m, m (delta + eta), 
       m] ((m - beta m)^2 (nu - eta)^2 - 1)]];
vars = {alpha, beta, nu, eta}; 

cons = {alpha m, (epsqkd - (2^-t + 2 epspe[nu, eta, beta] + 
       epspa[nu, beta, alpha ])) == 0, 10^-5 <= alpha <= 10^-1, 
  3 10^-1 < beta <= 1/2, 0 < nu < 1/2 - delta, 0 < eta < nu};

res = NMaximize[cons, vars, Method -> "RandomSearch", WorkingPrecision -> 64, MaxIterations -> 100]

I cant get the program to satisfy all the constraints. Either one or both of the following constraints fails;

(*constraint 1*)

(epsqkd - (2^-t + 2 epspe[nu, eta, beta] + 
       epspa[nu, beta, alpha ])) == 0 
(*constraint 2*)

0 < eta < nu

I have tried enforcing constraint 1 by multiplying the constraint with a large value, say $10^{10}$. In my caseepsqkd have extremely low values; around $10^{-6} - 10^{-10}$. But if the constraint 1 is satisfied constraint 2 fails.

How can I get NMaximize to follow all the constarints? How could I modify constraint 2?

$\endgroup$

1 Answer 1

0
$\begingroup$

It appears that the feasible set is empty. Indeed,

m = 30  10^2;s = 10;t = -Log[2, 10^-(s + 2)];delta = 455  10^-4;
epsqkd = 10^-(s);binent[p_] := -p  Log[2, p] - (1 - p)  Log[2, (1 - p)];
r = 119  10^-2   binent[delta];
epspa[nu_, beta_, alpha_] := 
 1/2  Sqrt[
2^(-(m - beta  m)  (1 - binent[delta + nu]) + r  (m - beta  m) + 
   t + alpha  m)];
gammaFunc[n_, k_, merr_, m_] := 1/(merr + 1) + 1/(m - merr + 1);
epspe[nu_, eta_, beta_] := 
Sqrt[Exp[-2  m  beta  m  eta^2/(m - beta  m + 1)] + 
Exp[-2  gammaFunc[m - beta  m, beta  m, m  (delta + eta),    m]*
((m - beta  m)^2  (nu - eta)^2 - 1)]];
vars = {alpha, beta, nu, eta};
NMaximize[{epsqkd-(2^-t+2 epspe[nu,eta,beta]+epspa[nu,beta,alpha]),
10^-5<=alpha<=10^-1&&3 10^-1<beta<=1/2&&0<nu<1/2-delta&&0<eta<nu},vars,
WorkingPrecision->20]

{-0.000081182641556415618068, {alpha -> 0.000010000000000000000000, beta -> 0.31629013471512422490, nu -> 0.12003314154983810468, eta -> 0.085835852708882336123}}

Therefore, the restriction epsqkd-(2^-t+2 epspe[nu,eta,beta]+epspa[nu,beta,alpha])==0 cannot be satisfied.

$\endgroup$

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.