Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.8K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

FindMaximum::nrlnum when solving signomial problem

Posted 10 years ago

I am trying to solve the following signomial optimisation problem:

nVariables = 20;
objectiveFunction = Sum[Log2[1 + 208930 g[i]], {i, nVariables}];
domainConstraints = 
  Apply[And, Table[0 <= g[i] <= Sqrt[0.02], {i, nVariables}]];
constraints = energyConstraints && domainConstraints;
variables = Table[g[i], {i, nVariables}];
FindMaximum[{objectiveFunction, constraints}, variables]

where variable energyConstraints is complicated quadratic form constraint. For example

energyConstraints[[1]]

gets

  10934.2 g[1]^2 - 1429.54 g[1] g[2] + 10856. g[2]^2 - 
  2846.57 g[1] g[3] + 2660.53 g[3]^2 - 4693.62 g[1] g[4] + 
  5564.54 g[4]^2 - 326.326 g[1] g[5] + 171.894 g[3] g[5] + 
  246.495 g[4] g[5] + 9.19287 g[5]^2 + 5.17916 g[1] g[6] + 
  65.4551 g[6]^2 + 5703.37 g[7]^2 + 185.581 g[1] g[8] - 
  1085.53 g[6] g[8] + 9019.75 g[8]^2 + 1477.01 g[1] g[9] + 
  2419.84 g[2] g[9] + 2158.35 g[3] g[9] + 1507.87 g[4] g[9] + 
  85.0152 g[5] g[9] + 224.787 g[6] g[9] + 2494.17 g[7] g[9] - 
  5118.69 g[8] g[9] + 10234.8 g[9]^2 + 3594.23 g[1] g[10] + 
  2745.93 g[2] g[10] - 2281.44 g[3] g[10] - 2603.06 g[4] g[10] - 
  123.566 g[5] g[10] + 303.574 g[7] g[10] - 10135.4 g[9] g[10] + 
  8087.06 g[10]^2 + 829.946 g[1] g[11] + 1628.96 g[2] g[11] - 
  1005.62 g[4] g[11] - 54.9912 g[5] g[11] + 213.422 g[6] g[11] - 
  3613.45 g[8] g[11] + 2693.06 g[9] g[11] + 1786.45 g[10] g[11] + 
  3321.34 g[11]^2 - 2473.01 g[1] g[12] + 4583.47 g[2] g[12] - 
  2625.2 g[4] g[12] - 2.39978 g[5] g[12] - 4295. g[9] g[12] + 
  1559.2 g[10] g[12] - 4555.8 g[11] g[12] + 7895.83 g[12]^2 - 
  2311.77 g[1] g[13] + 1708.81 g[2] g[13] + 1155.91 g[3] g[13] + 
  80.5025 g[5] g[13] + 126.269 g[6] g[13] - 2122.62 g[8] g[13] + 
  1986.7 g[9] g[13] - 1345.11 g[10] g[13] + 938.737 g[11] g[13] + 
  71.6679 g[12] g[13] + 1063.26 g[13]^2 + 1391.33 g[1] g[14] + 
  1738.55 g[2] g[14] - 1253.92 g[3] g[14] - 2791.54 g[4] g[14] - 
  132.866 g[5] g[14] - 55.0533 g[9] g[14] - 744.141 g[10] g[14] + 
  1120.1 g[11] g[14] + 1642.48 g[12] g[14] + 368.753 g[13] g[14] + 
  2968.09 g[14]^2 + 5144.74 g[1] g[15] - 3098.36 g[2] g[15] - 
  8326.81 g[7] g[15] - 5031.61 g[9] g[15] + 2493.13 g[10] g[15] - 
  7571.42 g[12] g[15] - 1060.92 g[13] g[15] - 3254.18 g[14] g[15] + 
  14354.7 g[15]^2 - 3546.54 g[2] g[16] - 2456.06 g[9] g[16] - 
  2453.47 g[11] g[16] - 1268.56 g[13] g[16] - 2418.14 g[14] g[16] + 
  4397.03 g[16]^2 + 323.904 g[1] g[17] - 356.019 g[2] g[17] - 
  19.8684 g[5] g[17] + 57.84 g[6] g[17] - 920.521 g[7] g[17] - 
  988.37 g[8] g[17] - 252.162 g[9] g[17] - 27.3935 g[10] g[17] + 
  247.476 g[11] g[17] - 220.29 g[12] g[17] - 134.28 g[13] g[17] - 
  245.28 g[14] g[17] + 1454.8 g[15] g[17] + 185.738 g[17]^2 + 
  563.582 g[1] g[18] + 7.82084 g[5] g[18] - 479.507 g[7] g[18] + 
  635.902 g[9] g[18] - 707.531 g[10] g[18] - 319.451 g[13] g[18] - 
  1201.33 g[14] g[18] - 1539.59 g[15] g[18] + 81.4226 g[17] g[18] + 
  903.201 g[18]^2 - 2779.46 g[1] g[19] - 1840.6 g[7] g[19] + 
  1934.22 g[9] g[19] - 4161.95 g[10] g[19] - 2098.78 g[11] g[19] - 
  4337.8 g[15] g[19] + 154.595 g[17] g[19] + 1374.56 g[18] g[19] + 
  4197.17 g[19]^2 - 63.1605 g[1] g[20] + 1452.64 g[2] g[20] - 
  273.535 g[9] g[20] + 335.505 g[10] g[20] + 336.133 g[13] g[20] + 
  239.703 g[20]^2 <= 1 

When solving by FindMaximum, I obtain FindMaximum::nrlnum error

FindMaximum::nrlnum: The function value {0.414741 +0. I,0.195062 +0. I,0.122928 +0. I,0.374518 +0. I,0.270671 +0. I,<<10>>,0.419655 +0. I,-0.0193688+0. I,0.0753935 +0. I,0.227088 +0. I,0.0396516 -2.74433*10^-15 I} is not a list of real numbers with dimensions {20} at {g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15],g[16],g[17],g[18],g[19],g[20]} = {0.00477212,0.00441384,0.00539416,0.00485674,0.00539739,0.00556549,0.00511965,<<6>>,0.00483714,0.0050438,0.00465757,0.00573873,0.00521535,0.00454342,0.00461002}. >>

Complete energyConstraints and the whole code is in the attachment. Any ideas how to go around? Using Mathematica 10.2.0 on Mac OS X

Attachments:
POSTED BY: Miroslav Hekrdla
2 Replies

Exactly as you said Sean, the problem is in rounding effects that produce complex numbers. I wrapped my constraints by Re[] operator and obtain the solution. Thanks a lot!

POSTED BY: Miroslav Hekrdla

Your objective function (the function you're trying to minimize) outputs Complex numbers!

If you want to use FindMaximum, you must give it a function that only returns Real numbers. Sometimes imaginary components enter when there is some small numerical error. In that case you can wrap the objective function in either the Chop function or the Re Function.

POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard