From: janos on 17 Mar 2010 05:43 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
From: Bill Rowe on 18 Mar 2010 05:32 On 3/17/10 at 4:42 AM, janostothmeister(a)gmail.com (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? You have asked Mathematica to find a numerical minimum for the integer 1. Additionally, you have set up constraints on x an y that have no solution. That is if x + y >= 1 then 2 x + 2 y >= 2 which is clearly incompatible with your 2 x + 2 y <= 0. So, you've asked Mathematica to do the impossible and are surprised you get a nonsense answer?
From: Andrzej Kozlowski on 18 Mar 2010 05:34 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 >
From: Brett Champion on 19 Mar 2010 03:38 On Mar 18, 2010, at 4:34 AM, Andrzej Kozlowski wrote: > 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. > It's a bug. It should issue a message and return unevaluated (which is what happened in the development build I checked.) Brett Champion Wolfram Research
|
Pages: 1 Prev: InterpolatingFunction and NIntegrate Next: Relation Problem in Mathematica |