Decision Optimization

Decision Optimization

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

 View Only
  • 1.  change value integer OPL C++

    Posted Fri March 08, 2024 08:08 AM

    Hello, 

    After solving the model in C++ I need to change the value of an integer I defined in my .mod file, and than solve again.

    In the  mulprod_main.cpp example they use the following to modify a value from an array

    dataElements.getElement("Capacity").asNumMap().set("flour", capFlour);

    Is there an equivlent way to change the value of an IloInt? 

    Thank you

    Sam



    ------------------------------
    Samuele Viaro
    ------------------------------


  • 2.  RE: change value integer OPL C++
    Best Answer

    Posted Sat March 09, 2024 06:20 AM

    Hi,

    in mulprod.mod, Capacity is declared in

    float Capacity[Resources] = ...;

    This does not work for scalars so to update an int value you can write in the .mod

    int valueToChange[Singleton] = ...;

    where Singleton is a set with one element



    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------



  • 3.  RE: change value integer OPL C++

    Posted Sat March 09, 2024 07:52 AM

    Thank you Alex... I'll give it a try!



    ------------------------------
    Samuele Viaro
    ------------------------------