Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  How can I use IloScalProd in IloExpr?

    Posted 05/28/11 02:42 PM

    Originally posted by: y82li


    for (t = 0; t < nbPeriod; t++)
    {
    IloExpr totalhour (env);
    for (i = 0; i < nbPart; i++)
    {
    totalhour += processingTime[i][t] * x[i][t] + setupTime[i][t] * y[i][t];
    }
    model.add(totalhour <= capacity[t]);
    totalhour.end();
    }

    The above code is to build a capacity constraint in production planning problem. The constraint is that, for each period t, total setup time plus total processing time should be less than planned capacity for period t. Product i=1,2,...,m. t=1,2,...,n.
    x[i][t] is production amount variable for product i in period t.
    y[i][t] is setup variable, whtch is 1, if there is setup for product i in period t, 0 otherwise.
    I got the following errors:
    error C2109: subscript requires array or pointer type.

    Question 1. How can fix this error?
    Question 2. Can I use IloScalprod to build the expression of these constraints?

    Thank you a lot!
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: How can I use IloScalProd in IloExpr?

    Posted 05/28/11 05:01 PM

    Originally posted by: SystemAdmin


    Question 1: The error message suggests that either C++ or CPLEX (not sure which) believes you have stuck a subscript on something that does not deserve it. Are processingTime and setupTime really declared as two-dimensional arrays (depending on time period as well as on product)?

    Question 2: Yes ... but you will need to reverse the order of the subscripts (time first, product second) to use it if you are summing over products within time periods.

    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: How can I use IloScalProd in IloExpr?

    Posted 05/29/11 10:15 AM

    Originally posted by: y82li


    Thank you very much, Prof Rubin.
    #CPLEXOptimizers
    #DecisionOptimization