Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  errors of migrating old OPL model to new version CPLEX

    Posted 07/08/15 03:25 PM

    Originally posted by: ZJay


    Hi all, I'm migrating an OPL model from old version(IBM ILOG CPLEX 12.1.0 IBM ILOG CP Optimizer 2.3 IBM ILOG Concert Technology 2.9) to IBM ILOG CPLEX Optimization Studio 12.6.1.0. 

    I got an error "cannot extract expression: item(feasiblePackages[c],<c.bid>).price"

    from the the function : minimize sum (c in customers: (card(c.bid.serviceIds) > 0))(X[c] * item(feasiblePackages[c], <c.bid>).price);

    Is it about the function item() of the new version CPLEX? I didn't find any usable information about that.

     

    Another wired problem is in one of my code snippet :

    tuple ServiceBoundle

    {
        sorted {string} serviceIds;     
    }

    ...

    ServiceBoundle boundles[1..customerCount+numExtraNurses][1..maxFeasiblePackagesCount];

    ...

    (boundles[i3][i5] == boundles[i3][i4]) //This statement always returns true, for example, comparing these two values

    <{"V9" "V11" "V13" "V15" "V16"}> and <{"V2" "V4" "V7" "V9" "V12" "V15" "V16" "V17" "V20"}> returns true. I don't know why does this happen.

     

    Please help if you have any idea about that. Appreciate in advance

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: errors of migrating old OPL model to new version CPLEX

    Posted 07/10/15 01:58 PM

    Hi,

    can you post your entire model so that others can try ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: errors of migrating old OPL model to new version CPLEX

    Posted 10/16/15 05:15 PM

    Originally posted by: ZJay


    Thanks AlexFleischer, Sorry for the late reply, I'm not allowed to post the entire model for some reasons. While I still stuck on this problem. I doubt it's because the function item() could only use index to access the elements in the tuple sets, at least in my model. I tried change <c.bid> to 0 in the expression( item(feasiblePackages[c], <c.bid>) ), and it works. For sure I won't get the correct solution, while at least it runs.

    Following is the tuples and objective function, I hope it would help for other kind people to look into this problem.

    tuple FeasiblePackage
    {
        key ServiceBoundle serviceBoundle;
        int initialprice;
        int bc;
        int price;
        int isBid;
    }

    tuple Customer

    {
        key string cid;
        ServiceBoundle bid;
        int isAssigned;
        int isInFinalState;
    }

    tuple ServiceBoundle
    {
        sorted {string} serviceIds;     
    }

    {Service} services = ...;
    {Service} serviceUnion;

    {Customer} customers=...;

    {FeasiblePackage} feasiblePackages[customers]=...;

     

    dvar boolean X[c in customers];
    minimize sum (c in customers: (card(c.bid.serviceIds) > 0))(X[c] * item(feasiblePackages[c], <c.bid>).price);


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: errors of migrating old OPL model to new version CPLEX

    Posted 10/19/15 12:31 PM

    Hi,

    let me suggest a workaround:

        tuple ServiceBoundle
    {
         {string} serviceIds;     
    }
     
     tuple FeasiblePackage
    {
        key ServiceBoundle serviceBoundle;
        int initialprice;
        int bc;
        int price;
        int isBid;
    }

    tuple Customer

    {
        key string cid;
        ServiceBoundle bid;
        int isAssigned;
        int isInFinalState;
    }

     

     

    {Customer} customers={<"A",<{"A"}>,1,2>};

    {FeasiblePackage} feasiblePackages[customers]=[{<<{"A"}>,1,2,3,4>}];

    int price[c in customers]=first({f | f in  feasiblePackages[c] : c.bid == f.serviceBoundle }).price;

    execute
    {


    price;
    }

    dvar boolean X[c in customers];
    minimize sum (c in customers: (card(c.bid.serviceIds) > 0))(X[c]
    //* item(feasiblePackages[c], <c.bid>).price
    *price[c] // THIS IS THE WORKAROUND
    );

    subject to
    {
    }

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer