Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2114

NMaximize inconsistency

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!newsfeed.x-privat.org!news-out.readnews.com!transit3.readnews.com!nx02.iad01.newshosting.com!newshosting.com!novia!newspump.sol.net!post2.nntp.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail
From Jingjing Wang <brightapple2008@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject NMaximize inconsistency
Date Wed, 4 May 2011 23:46:36 +0000 (UTC)
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Sender steve@smc.vnet.net
Approved Steven M. Christensen <steve@smc.vnet.net>, Moderator
Message-ID <ipsogs$89g$1@smc.vnet.net> (permalink)
Lines 56
NNTP-Posting-Date 04 May 2011 22:47:26 GMT
NNTP-Posting-Host dd96ef00.news.twtelecom.net
X-Trace DXC=k=]8:[R<FEZ2?jHgl5=_;YC_A=>8kQj6]Y;@_o827nGS^01nm;E34APEFiONJ7[GoVM@KPJ:\2H_S
X-Complaints-To abuse@twtelecom.net
Xref x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:2114

Show key headers only | View raw


Dear Group,

I wrote an example to test NMaximize for solving optimization problem
with many constraints. Here are the results when I first run it:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
T = 3;

a = Table[x[t], {t, T}]
b = Table[y[t], {t, T}]

{x[1], x[2], x[3]}

{y[1], y[2], y[3]}

NMaximize[{Sum[x[t]^2 - y[t], {t, T}],
  Table[x[t] == x[t - 1]^2 + 2 y[t - 1], {t, T}],
  Table[y[t] == x[t] + x[t + 1], {t, T - 1}], x[0] == 1, y[0] == 1},
 Join[a, b]]

{38465.7, {x[1] -> 3., x[2] -> -15., x[3] -> -195., y[1] -> -12.,
  y[2] -> -210., y[3] -> 15.3005}}

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

But when I tried to run it the next day, NMaixmize doesn't work....

>>>>>>>>>>>>>>>>>>>>>>>>

In[191]:= T = 3;

In[192]:= a = Table[x[t], {t, T}]
b = Table[y[t], {t, T}]

Out[192]= {x[1], x[2], x[3]}

Out[193]= {y[1], y[2], y[3]}

In[194]:= NMaximize[{Sum[x[t]^2 - y[t], {t, T}],
  Table[x[t] == x[t - 1]^2 + 2 y[t - 1], {t, T}],
  Table[y[t] == x[t] + x[t + 1], {t, T - 1}], x[0] == 1, y[0] == 1},
 Join[a, b]]

During evaluation of In[194]:= NMaximize::bcons: The following
constraints are not valid: {x[0]==1,y[0]==1,x[0]^2+2
y[0]==x[1],y[1]==x[1]+x[2],x[1]^2+2
y[1]==x[2],y[2]==x[2]+x[3],x[2]^2+2 y[2]==x[3]}. Constraints should be
equalities, inequalities, or domain specifications involving the
variables. >>

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

 Any idea why?

Thanks!-JJ

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

NMaximize inconsistency Jingjing Wang <brightapple2008@gmail.com> - 2011-05-04 23:46 +0000

csiph-web