From: <gro...@em...> - 2005-03-16 17:07:07
|
The default branching algorithm is a simple algorithm which assigns values to variables (AssignVar). So you can easily do what you want thanks to the Solver API : * pb.getSolver().setVarSelector(IVarSelector varSelector) selects a variable ordering heuristics. So you have to define your own class implementing this interface. For instance, you can use the following code : // imports... public class StaticOrderingHeuristic extends AbstractIntVarSelector { protected IntVar[] vars; public StaticOrderingHeuristic(IntVar[] vars) { this.vars = vars; } public IntVar selectIntVar() { for (int i = 0; i < vars.length; i++) { if (!vars[i].isInstantiated()) { return vars[i]; } } return null; } } if you only give involved variables, it will totally ignore the other variables during the branching algorithm Hope it helps, Guillaume Selon Patrick Prosser <pa...@dc...>: > Hi > I am wanting to implement my own varaible ordering heuristic. In > particular I would like to implement a static ordering heuristic that > selects only some of the variables in the problem. > > cheers > > Patrick > > > -- > Patrick Prosser tel: +44 141 330 4934 > Computing Science fax: +44 141 330 4913 > Glasgow University mail: pa...@dc... > G12 8RZ > http://www.dcs.gla.ac.uk/~pat > > > ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. |