Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Problem in populating string arrays

    Posted 10/15/11 08:28 PM

    Originally posted by: UmarWaqas


    Hi, I am trying to implement an OPL model which reads the names from a set and populates an array. The constraints have to be specified on the populated array.
    The population is performed in pre-processing (ILOG OPL script). Please consider the code below:

    /**************************/
    {string} names = {"Mike","Tim"};
    int members;
    string populatedhttp://1..members;

    execute INITIALIZE {

    members = 2;
    var count = 1;
    for (var i in names)
    {
    populatedcount = i;
    count++;
    }
    }

    /* Decision variables */
    dvar int dummyhttp://1..members in 1..10;
    subject to{

    forall (i in 1..members)
    {
    /* Required: this statement just checks whether "Mike" is accessed through "populated" */
    (populated[i] == "Mike") => (dummy[i] != 2);
    }
    }

    /**************************/

    The compiler reports following errors:
    1) CPLEX(default) cannot extract model: IloAlgorithm cannot extract extractable.
    2) CPLEX(default) cannot extract expression: populated[i] == "Mike".
    3) CPLEX(default) cannot extract expression: forall(i in 1..2) populated[i] == "Mike" => dummy[i] != 2.

    I think i am misunderstanding the programming constructs available. Please rectify if possible.
    #ConstraintProgramming-General
    #DecisionOptimization


  • 2.  Re: Problem in populating string arrays

    Posted 10/17/11 04:24 AM

    Originally posted by: SystemAdmin


    In an OPL model, constraints are stated on variables. Integers varaiables are declared like this :

    dvar int x in 1..1000;

    They need to have a integer range of values as a domain.

    In your model, populated is not an array of variables and the string "Mike" canot be a domain value, thus the errors. Note that if your intend is to use constraint programming for solving this model, you need to add

    using CP;

    at the top of the model.
    #ConstraintProgramming-General
    #DecisionOptimization