Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

error: not an array type

  • 1.  error: not an array type

    Posted 09/02/15 06:08 AM

    Originally posted by: Cplex


    Hey guys!

     

    I have a problem with the following model in CPLEX:


    //Indizes

    range I = 1..3;     
    range T = 1..2;     
    range Q = 1..5;     
    range K = 1..2;      


    //parameters

    int c[I][T] =...; 
    int P =...;         
    int D =...;           
    int b[I][Q] =...;  
    int B[Q][T] =...;   
    int t[I][K] =...;   


    //decision variables

    dvar boolean x[I][T];      


    //objective

    dexpr int Kosten = sum(i in I,t in T) c[i][t]*x[i][t];
    minimize Kosten;


    //constraints

    subject to{

        forall(i in I)
          sum(t in T) x[i][t] == 1;
          
        forall(t in T)
          sum(i in I) x[i][t] <= P;
          
        forall(q in Q,t in T)
          sum(i in I) b[i][q]*x[i][t] <= B[q][t];

        forall(k in K,t in T)
          sum(i in I) t[i][k]*x[i][t] <= D;

    }

     

    In the last constraint it says that t[i][k] is not an array type. I can't figure out the problem.

    Any hints are highly appreciated.

     

    Thanks in advance!


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: error: not an array type

    Posted 09/02/15 12:11 PM

    Hi

    you get this error because you have t both in

    int t[I][K] =...;

    and in

    forall(k in K,t in T)

    The second one overloads the first one and then t is considered not as an array but as an element in T!

    regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer