1

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.

Charles
  • 50,943
  • 13
  • 104
  • 142
Benny
  • 639
  • 3
  • 11
  • 25

2 Answers2

2

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
  • 36
  • 1
  • 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 Aug 08 '10 at 05:25
2

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

Model[ 

Decisions[ .... ],  

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

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

]
Benny
  • 639
  • 3
  • 11
  • 25