views:

30

answers:

2

I want to limit the result to only square numbers ( I am using excel plugin). How do I enforce this?

As in, Minimize Goal X subject to a condition that X is a square number.

+2  A: 

Create an adjustable cell, Y and restrict it to be an integer. Set the equation that you are trying to minimize equal to Y^2.

Mark
Thanks a bunch! Even though you mistook that I am working on Excel Solver plugin (I was actually trying to solve this using Microsoft Solver Foundation http://www.amsterdamoptimization.com/msf.html)But the idea helped though!! I used your suggestion in OML and it worked!For others looking for a similar solution in OML, simply add another decision Y of Integer domain and add a constraint that Y = X*X. Like this:Model[ Decisions[....], Decisions[Integers[10000,31622],y],Constraints[ x == y*y,...]]
Benny
+1  A: 

Mark's answer helped. The solution in OML would look like

Model[ 

Decisions[ .... ],  

Decisions[  
Integers[10000,31622],y  
],  

Constraints[  
x == y*y,  
... ]  

]
Benny