Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  problem with CPLEX Optimalization Studio

    Posted 01/11/11 06:46 PM

    Originally posted by: sej123


    Hi for all,
    I'm new at this forum so please be placable.
    I start to experiment with CPLEX but I have some errors :/
    When the formula is written there is no mistakes but when I run the configuration there are some errors.
    I try to make mathematical model to solve to problem of the company to maximize the profits.
    this is fragment of the model:
    
    subject to
    { forall(t in 1..T) 
    {        he[t]<=Et[t]; sum(t in 1..T) he[t]<=E; Y[t-1]+X[t]-sum(p in 1..P)m[p][t]*Z[p]==Y[t]; X[t]<=M[t]; Y[t]<=RS; 
    } forall(t in 1..T,p in 1..P) 
    { s[p][t-1]+n[p][t]+m[p][t]+r[p][t]==D[p][t]+s[p][t]; 
    } forall(p in 1..P) 
    { S0[p]==s[p][0]; 
    }
    }
    

    And there are mistakes:
    
    CPLEX(
    
    default) cannot extract expression: forall(t in 1..12) (((he[(t)] <= Et[(t)] && sum(t in 1..12) he[(t)] <= 100) && Y[(t+(-1))]+X[(t)]+(sum(p in 1..10) m[(p)][(t)]*Z[(p)])*(-1) == Y[(t)]) && X[(t)] <= M[(t)]) && Y[(t)] <= 10000.   CPLEX(
    
    default) cannot extract model: IloAlgorithm cannot extract extractable.   Index out of bound 
    
    for array 
    "Y": 0.   OPL cannot extract expression: ((((he[(t)] <= Et[(t)] && sum(t in 1..12) he[(t)] <= 100) && Y[(t+(-1))]+X[(t)]+(sum(p in 1..10) m[(p)][(t)]*Z[(p)])*(-1) == Y[(t)]) && X[(t)] <= M[(t)]) && Y[(t)] <= 10000) && Y[0] == 0.
    

    Thank for your time and help.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: problem with CPLEX Optimalization Studio

    Posted 01/12/11 05:42 AM
    Hi

    what is the range of your decision variable array Y? I think it does not contain 0 and it should because of your constraint

    Y[t-1]+X[t]-sum(p in 1..P)m[p][t]*Z[p]==Y[t];
    


    and that is why you get

    Index out of bound for array "Y": 0.

    Alex
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: problem with CPLEX Optimalization Studio

    Posted 01/12/11 04:01 PM

    Originally posted by: sej123


    Thank you very much for your help.
    It solved the problem
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: problem with CPLEX Optimalization Studio

    Posted 10/30/16 06:20 PM

    Originally posted by: telangana


    Hi ,

    int n = ...;//number of weeks
    int W0 = ...;//number of workers
    int I0 = ...;//initial inventory
    int j = ...;//number of units produced per week
    int k =...;// cost of hiring a worker 
    int l = ...;//cost of firing a worker 
    int r = ...;//salary to employ worker 
    int p =...;//production cost 
    int e= ...;//inventoy cost 


     range weeks =1..n; 
     
     int demand[weeks]=...;
     int W[weeks]=...;
     int H[weeks]=...;
     int F[weeks]=...;
     int I[weeks]=...;
     int C[weeks]=...;
     //variable
      dvar int x[weeks];
      //objective function
      minimize  sum(t in weeks) (k*H[t]+l*F[t]+r*W[t]+p*x[t]+e*I[t]);
      //constraints
      subject to 
      {
      forall(t in 1..n )
        conso1:
        W[t]== W[t+(-1)]+H[t]-F[t];
        
        forall(t in 1..n)
          conso2:
        I[t]==I[t-1]+x[t]-demand[t];
         
         W0==5;
         I0==20;
        
          
      }
       And there are errors:

    Index out of bound for array "W": 0.

    OPL cannot extract expression: conso1: W[t] == W[(t+(-1))]+H[t]+F[t]*(-1).

    CPLEX(default) cannot extract expression: forall(t in 1..5) conso2: I[t] == I[(t+(-1))]+x[t]+demand[t]*(-1).

    and the range of weeks is 1..5.

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: problem with CPLEX Optimalization Studio

    Posted 10/31/16 03:56 AM

    Hi,

    can you attach also the .dat so that other users may help you ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer