Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple constraint programming solver

I'm trying to get familiar with constraint programming.

All documentation/videos I've seen so far just contain description of top-level concepts and code examples based on CP-libraries utilization (like Choko, Gecode, JaCoP etc).

I'd like to implement at least something simple in Java without any libraries.

Are there any resources where I can find working code in Java/C#/C++/Python which implements main CP ideas? (at least "send more money" problem solution).

(or, maybe, if somebody can explain it here, it would be great).

like image 833
Roman Avatar asked Jun 26 '13 13:06

Roman


1 Answers

It depends on what are you trying to do.

1- If you want to get started with Constraint Programming (CP) tools, you need first to understand modelling in this approach. For that, you have be able to define a given problem as a set of constraints then you post your model to a solver (that already knows how to deal with these constraints).

I personally find the G12_MiniZinc_Distribution (available via http://www.minizinc.org/) and its latest tutorial a very good way to start (the latest distribution cames with a lot of models). There is also online models if you want to see how a CP model looks like (w.r.t minizinc syntax) : http://www.hakank.org/minizinc.

2- If you have an advanced theoretical understanding of CP, you may directly see the implementation of some techniques (e.g. propagators) from available libraries since developing a CP Solver from scratch is (IMO) a foolish idea. These are some open-source solvers/libraries : G12, Choco, Mistral, Or-Tools.

like image 187
Med Avatar answered Nov 13 '22 03:11

Med