xcsp3team / pycsp3

A Python Library for modeling combinatorial constrained problems
https://www.pycsp.org
MIT License
60 stars 9 forks source link

How to select heuristic for e.g. variable selection (Ace solver) #44

Closed axelbdt closed 5 months ago

axelbdt commented 5 months ago

Hi,

I have perused the documentation and source code and I couldn't find how select a heuristic for e.g variable selection. I guess it would be something like.

solve(options="varh dom/wdeg")

This obviously doesn't work, I would greatly appreciate an example. Thanks.

axelbdt commented 5 months ago

Found this : https://github.com/xcsp3team/pycsp3-models/blob/acccebde75e237e319f2d670769639d10bc9d859/realistic/GBACP/GBACP.py#L93

solve(options="-varh=PickOnDom -pm=3 -valh=Vals -ale=4")
xcsp3team commented 5 months ago

Hi,

you can have a look at: https://arxiv.org/pdf/2302.05405.pdf Also, see Chapter 8 of https://arxiv.org/pdf/2009.00326.pdf.

a) If you compile the model and run the solver with a command line in a terminal, type something like: python Queens.py -data=8 -solver=[ace,v,args="-s=all -varh=PickOnDom"]

b) If you already have an XCSP3 instance (file), and want to execute the solver with a command line in a terminal, type something like: java -jar ACE.jar Queens-8.xml -s=all -varh=PickOnDom

c) Finally, if you want to execute the solver in a notebook, write something like: solve(options="-s=all -varh=PickOnDom") You can also see the arguments (options) by adding verbose=0 (or verbose=1) as in: solve(verbose=1, options="-s=all -varh=PickOnDom")

I need to add explicitly case c) in the documentation. This will be done in the next release.

Please, tell me if everything is ok for you.

Best.

Christophe

axelbdt commented 5 months ago

This did help a lot. Thank you so much !