Re: Bug in NMinimize?
- To: mathgroup at smc.vnet.net
- Subject: [mg108457] Re: Bug in NMinimize?
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Thu, 18 Mar 2010 04:34:01 -0500 (EST)
Hi Janos, You are being really unkind to Mathematica here ;-). You are asking her to solve an impossible problem and when it can't do it you denounce it to the world... Actually, it will tell you what the problem is if you specify any of the possible Method options explicitly, for example: NMinimize[{1,x+y>==1,2 x+2 y<==0,Element[x,Integers]},{x,y},Method->"DifferentialEvolution"] During evaluation of In[24]:== NMinimize::incst: NMinimize was unable to generate any initial points satisfying the inequality constraints {-y-Round[x]+1<==0,2 y+2 Round[x]<==0}. The initial region specified may not contain any feasible points. Changing the initial region or specifying explicit initial points may provide a better solution. >> During evaluation of In[24]:== NMinimize::nosat: Obtained solution does not satisfy the following constraints within Tolerance -> 0.001: {-x-y+1<==0,2x+2 y<==0}. >> {1.,{x->0,y->0.2}} Actually I agree with you, and I think the default (without specifying the Method) should also produce some sort of message. If instead you use Minimize you will be told that there is no solution Minimize[{1, x + y >== 1, 2*x + 2*y <== 0}, {x, y}] During evaluation of In[27]:== Minimize::infeas:There are no values of {x,y} for which the constraints x+y>==1\[And]2 x+2 y<==0 are satisfied and the objective function 1 is real-valued. >> {Infinity, {x -> Indeterminate, y -> Indeterminate}} but, in this case you must either remove the constraint of x to the integers or add such a constraint or y since Minimize can't deal with variables of different type. Andrzej Kozlowski On 17 Mar 2010, at 10:42, janos wrote: > I am sorry to let you know that > > NMinimize[{1, x + y >== 1, 2 x + 2 y <== 0, Element[x, Integers]}, {x, > y}] > > does give a result: > > {1., {x -> 1, y -> 0.}} > > Any commands or advice? > > Thank you, J==E1nos >