Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Can I have vectors inside IloOplDataElements?

  • 1.  Can I have vectors inside IloOplDataElements?

    Posted Mon August 11, 2008 11:31 PM

    Originally posted by: SystemAdmin


    [thiago.serra said:]

    Hi everyone,

    I´m trying to build an iterative model, so that I solve a production problem, and the remainder of inventory is set for the next time horizon, like this:


    Inventory = new IloOplDataElements();
    for (p in Opl.Products) {
    Inventory.startingInventory[p] = Opl.inventory[p][lastDay];
    }


    Though I could set variables inside other instances of IloOplDataElements, it did not work with vectors, as stated above.
    Can I do such thing? If yes, how? If not, why?

    Thanks for reading,
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Can I have vectors inside IloOplDataElements?

    Posted Fri August 15, 2008 07:24 PM

    Originally posted by: SystemAdmin


    [thiago.serra said:]

    Well, I've realized that it is not possible to do this [b]directly[/b], since scripting languagens (including OPL Script) are not strongly-typed (and are not meant to be, anyway). So, before the for loop of my code above, I had to make the environment understand that Inventory.startingInventory is a vector. I did so with the following workaround:

    Inventory.startingInventory = Opl.startingInventory;

    Since there is a copy of the old inventory vector in the old model, I can create a new source for Inventory, "copy" the vector type from the old model and then put on it the new values with the very same for loop.

    Since I've not found this anywhere,  I hope this post might help other users.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer