简体   繁体   中英

How to create/post and delete/unpost constraints during search in Choco

I have got a project in Choco solver, but I have a question about the external effects during the search.

I have got a planning graph with (let's say) BoolVars organised in layers and durations assigned to the layers, which mean that some action starts and some ends. The variable selection is static from the end of the plan to the start of the plan (the choice of the actions in layer is arbitrary).

I am researching a solution that uses a simplex algorithm to help with assigning the durations, as between the start and the end of an action A we need to have a duration equal to N . There are some more constraints in between.

The additional constraints are created based on the instantiation of the BoolVars, however they are organized in an external matrix, so when an end action of the action A is added, in the effect an additional row is added to the matrix and current constraints are reformulated. On backtracking we would like to modify the matrix in the reverse way ie remove the row and unpost the constraints.

Is there some way to realize this complex behavior in Choco?

Do you know in advance what constraint is triggered if a boolean is set to true?If yes, use reification (create the constraint at the beginning but associate them with boolvars instead of posting them).

For professional support on Choco Solver, you can contact https://www.cosling.com/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM