mathematical-optimizationcplexconstraint-programmingilogoperations-research

IBM CPLEX - Warehouse location CP


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?


Solution

  • 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;
    }