Skip to content

Latest commit

 

History

History
145 lines (106 loc) · 4.01 KB

README.md

File metadata and controls

145 lines (106 loc) · 4.01 KB

Groovy Constraint Programming

This repo contains examples from an Introduction to Constraint Programming talk:

https://speakerdeck.com/paulk/groovy-constraint-programming

You have 4 options to run the examples:


The Pythagorean subproject is an introductory example comparing an imperative style solution (using a brute-force approach), and a constraint-programming solution (using Choco[1]).

Pythagorean

Run Choco solution via Jupyter/BeakerX: Binder

Command-line arguments for Gradle to run the script: :Pythagorean:run


The McNuggets subproject illustrates solving a fairly simple Frobenius numbers puzzle using Choco[1] and Ojalgo[2].

McNuggets

Command-line arguments for Gradle to see the task names for the available solutions:

:McNuggets:tasks --group="Application"

Then pick one of those tasks to run, e.g. to run the Ojalgo solution:

:McNuggets:runOjalgo

Cryptarithmetic puzzles

This example solves a classic cryptarithmetic puzzle using constraint programming. The Groovy solution is contrasted with brute-force approaches and solutions in other JVM languages.

Constraint programming

See the SendMoreMoney subproject for all the details.

Constraint-programming libraries covered: Choco

Programming languages covered: Clojure, Groovy, Frege, Java, Nashorn, JRuby, Jython, Kotlin, Luaj, Scala, tuprolog.


Diet optimization

This example solves an optimization/linear programming problem. Numerous technologies and approaches are used to solve the problem.

Linear programming

See the Diet subproject for all the details.

Technologies illustrated: Apache Commons Math, Hipparchus, Choco (with and without ibex integration), JaCoP (using scalar-product/weighted-sum and knapsack algorithms), Ojalgo, OptaPlanner, OrTools, SAS/OR.


Genetic algorithms

This example uses genetic algorithms to explore the infinite monkey theorem.

Chimpanzee at keyboard

See the Monkeys subproject for all the details.

Technologies illustrated: Apache Commons Math, Jenetics.


Technology summary

Libraries used:

Choco, Hipparchus, Apache Commons Math, JaCoP, OptaPlanner, OrTools, Jenetics, SAS/OR (commercial product).