I am currently sovling an optimization problem using Pulp (I have to using pulp). However, the problem requires the answer of the variables to be perfect squares. Could anyone please help me how to approach with this constraint?
I tried to replace my variable A with B^2 but clearly pulp only supports linear equations. What other ways can I try?
Here is a possible approach. You can use a binary indicator value to indicate which value out of a set of possible values to select. In your case, the set of possible values is the set of perfect squares, but it could be anything.
The complications with this are:
xanytime you want to capture the value of the squared variable because you need to multiply the binary selection variable by the value to capture it.aside: you probably do not need to modify the CBC_CMD like I'm doing here... I just need to point to a specific install
Code
Output (truncated):