Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Help with a String Constraint

    Posted 03/31/16 10:24 PM

    Originally posted by: BEA123


    I would like to create a model that pulls its data from Access, but I cannot execute the following constraint:

    forall (p in period)

     workers[p]-workers[p-1]==hire[p]-fire[p];

    where period is the string used to reference the access data base.  I guess my real question is it even possible to create a constraint that references the previous string value, e.g. workers in NOV - workers in OCT, or is there another way to connect to access without using strings that will allow me to execute the above constraint?

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Help with a String Constraint

    Posted 04/01/16 02:28 AM

    I think what you are looking for is this (also see the reference documentation about sets):

    {string} period = { "JAN", "FEB", "MAR" };
    dvar int workers[period];
    dvar int hire[period];
    dvar int fire[period];
     
    minimize 0;
    subject to {
      forall (p in period : p != first(period))
        workers[p]-workers[prev(period, p)]==hire[p]-fire[p];
    }
    

    Note that there is a Forum dedicated to OPL. You may be better off asking your question there.


    #CPLEXOptimizers
    #DecisionOptimization