Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  index 0 in cplex

    Posted 01/22/18 10:03 AM

    Originally posted by: felycite28


    Hi folks  ,

    Can anyone tell me a good way for defining the invetory level at t=0?

    I[N][0]==0, when I do thi direcly , naturally, I am getting an error ?

     

    Thank you so much in advance


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: index 0 in cplex

    Posted 01/22/18 11:44 AM

    Can you please be more specific? What is the error you get? How is l defined?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: index 0 in cplex

    Posted 01/22/18 02:13 PM

    Originally posted by: felycite28


    I am getting "out of range "I(N)":0

    I have N machines in period t , at the beginning of period where t=0, the inventory level must be=0 

    this is what I am trying to do

    in I(N)(T) the variable itself , N is the numbr of machines, T is the number of periods

    Thank you so much in advance


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: index 0 in cplex

    Posted 01/22/18 03:36 PM

    Are your machines/numbered from 1 or numbered from 0? Could you show the code defining l, N, T and the offending constraint?


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: index 0 in cplex

    Posted 01/22/18 04:42 PM

    Originally posted by: felycite28


    Hello ,

    range m=1..N;//number of the machines , N=5

    range t=1..T;//number of the periods , N=3

    dvar int I[m][t]; //inventory variable

    each period I am working with N machine so at the beginning of each period I will have some inventory from the previous but I have to say to the model , at the beginning where t=0 , there is no inventory . So I am trying to say I[5][0]=0

    Thank you


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: index 0 in cplex

    Posted 01/23/18 01:50 AM

    Your range t only ranges from 1 through 5, so there is no index 0 in this range. This is why you get an error when trying to reference l[5][0]. This variable just does not exist. I can see at least the following two ways to fix your problem:

    1. Define an additional 'range t0 = 0..T' and then define 'dvar int l[m][t0]', then state your constraint.
    2. Everywhere you use l[.][0] in your model use a hard-coded 0 instead. The keyword "if" may be helpful in doing that.

    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: index 0 in cplex

    Posted 01/23/18 04:36 AM

    Originally posted by: felycite28


    Thank you Daniel , I think it will work but I tried first way , since I have I (m)(t) for the range t=1...T, when I define I(m)(t0) for t0=0...T, it gives me the  I is already defined error . Somehow I have to use "I "for I(N)(0) . How can I fix it ? I guess I could not understand if part you explained exactly

    Thank you for your help

     


     


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: index 0 in cplex

    Posted 01/23/18 05:13 AM

    You have to replace 'dvar int l[m][t]' by 'dvar int l[m][t0]'.
     


    #CPLEXOptimizers
    #DecisionOptimization