Topic
1 reply Latest Post - ‏2013-09-02T09:47:37Z by ol
Puppy26
Puppy26
17 Posts
ACCEPTED ANSWER

Pinned topic Error as Operator not available for float

‏2013-09-01T10:35:02Z |

Hi all,

I'm a new user of CPLEX.. I'm getting an error as "Operator not available for float" for the case below

  dvar boolean DSSupply [Depots][Shippers];
  dvar boolean CDSupply [Consignees][Depots];
  dvar boolean TDSupply [Terminals][Depots];
  dvar boolean DTSupply [Depots][Terminals];
  dvar boolean DDSupply [Depots][Depots];
dvar boolean Open[Depots];
 
dexpr float DepotValue = ISDepot + CDSupply + TDSupply - DSSupply - DTSupply - DDSupply;

If I modify the above case like below

dexpr float DepotValue = ISDepot + CDSupply [c][d] + TDSupply [t][d] - DSSupply [d][s] - DTSupply [d][t] - DDSupply [d][d];

I'm getting error as Name c does not exist.

Could some one please let me know how I should go ahead to correct this error.

 

Regards,

Prabhu

  • This reply was deleted by Puppy26 2013-09-05T12:48:19Z.
    • ol
      ol
      33 Posts
      ACCEPTED ANSWER

      Re: Error as Operator not available for float

      ‏2013-09-02T09:47:37Z  in response to Puppy26

      Hello,

      you can add a post processing step as in the following example.

      Regards,

      Olivier

       

      using CP;
       
      range I=1..2;
      range J=1..3;
       
      float F[I]= [0.4,0.2];
      int A[J]=[1,3,2];

      dvar boolean y[I][J];

      dexpr float Z =  sum(i in I,j in J)  (F[i]*A[j])*  y[i][j];

      maximize  
      sum(i in I,j in J)  (F[i]+A[j])*  y[i][j];
       
      subject to
      {
        2 >= sum(i in I, j in J) y[i][j];
      }  
       
       
      execute  {
        writeln("Z = ",Z);
      }