Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

give reversible property to our own class

  • 1.  give reversible property to our own class

    Posted Wed May 14, 2014 06:08 AM

    Originally posted by: Trust20092009_01


    Hello,

    I know that CP Optimizer provides us with some predefined reversible classes such as IlcRevInt, IlcRevBool, IlcIntSet,... but is there a way to give our own classes this reversible propriety ?  In ILOG Solver we can do with IlcREv macro ( Class Node;   IlcRev(Node); )

     

    I would be very grateful if you can help me.

    Best,

    S.S

     


    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: give reversible property to our own class

    Posted Fri May 16, 2014 11:42 AM

    Originally posted by: Philippe_Refalo


    Hi, 

    The Macro ILCREV was for a pointer of an instance of a class. If you want to have your class reversible it is up to you to save the values of the fields that needs to backtrack when you modify them. If your backtrack involves many changes, then it is probably simpler (and it consumes less memory) to use reversible actions. That is you write a goal that contains the code to be executed to restore the state of your data structure. Have a look at void IloCP::addReversibleAction(const IlcGoal goal) in the documentation.

    Regards 

    Philippe


    #CPOptimizer
    #DecisionOptimization