Topic
  • 1 reply
  • Latest Post - ‏2014-05-16T15:42:26Z by Philippe_Refalo
Trust20092009_01
Trust20092009_01
6 Posts

Pinned topic give reversible property to our own class

‏2014-05-14T10:07:38Z |

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

 

Updated on 2014-05-14T10:07:47Z at 2014-05-14T10:07:47Z by Trust20092009_01
  • Philippe_Refalo
    Philippe_Refalo
    50 Posts

    Re: give reversible property to our own class

    ‏2014-05-16T15:42:26Z  

    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

    Updated on 2014-05-16T15:50:50Z at 2014-05-16T15:50:50Z by Philippe_Refalo