0

I'm trying to run the scalablewarehouse example from IBM, with the CP algorithm, but when I add the using CP; to the mod file, I get an error on this line:

dvar float Supply[Stores][Warehouses] in 0..1;

And the error:

Decision variables of type dvar float not supported by this algorithm.

How can I fix this?

drec4s
  • 7,946
  • 8
  • 33
  • 54
  • 1
    In https://www.linkedin.com/pulse/making-decision-optimization-simple-alex-fleischer/ see CPO with decimal decision variables https://github.com/AlexFleischerParis/zooopl/blob/master/zoodecimalcpo.mod – Alex Fleischer Feb 01 '22 at 16:12

2 Answers2

1

In Easy optimization see CPO with decimal decision variables

using CP;
{int} Warehouses = {1,2,3,4};
int NbStores = 5;
range Stores = 0..NbStores-1;

int scale=100;
dvar int scaleSupply[Stores][Warehouses] in 0..scale;

dexpr float supply[s in Stores][w in Warehouses] = scaleSupply[s][w]/scale;

subject to
{
  supply[1][1]==0.5;
}
Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15
0

I don't think you can fix it simply. I don't think the CP optimiser supports float variables. You could try scaling those numbers that are supposed to be continuous and handle them as e.g. percentages using integer variables with a range of 0 to 100.

TimChippingtonDerrick
  • 2,042
  • 1
  • 12
  • 13