It is possible to add random walks in the solver using the RandomWalkDecorator class, by using e.g.
mysolver.setOrder(new RandomWalkDecorator(new VarOrderHeap(),0.005);
It works fine for SAT solvers, however, there is an issue when working with PB solvers, which use a heuristics taking into account the objective function.
The current implementation of PBSolver breaks the Liskov Substitution Principle because there is an instanceof statement in the PBSolver.setObjectiveFunction() method referring to a concrete class.
As such, using a decorator, the objective function is not passed to the VarOrderObjective object.
The solution is to fix properly the LSP issue by:
- creating an IOrderObjective interface to catch the capability to manage the objective function in a heuristics.
- use that interface in PBSolver in the instanceof statement.
- make the VarOrderObjective implement that interface.
- create a subclass of RandomWaldDecorator that implement that interface.