My Google OR-tools / CP Solver page
Google Optimization Tools (Operations Research Tools developed at Google, a.k.a. Google CP Solver, a.k.a. Google or-tools) consists of support for constraint programming and LP/MIP.
Project group: or-tools-discuss
The solver is available via Git: https://github.com/google/or-tools. Please see Installing OR-Tools on how to install, required libraries etc.
Examples (Git repository): github.com/google/or-tools/tree/stable/examples.
Many of my older CP models are available in the OR-tools repo: Contrib.
References
See Google Operations Research C++ Reference .
See below for my Python models using the new CP-SAT solver.
See below for my Python models using the old CP solver.
See below for my Java models.
See below for my LP/MIP models.
See further below for my C# models.
All these models are available from my GitHub repo github.com/hakank/hakank/tree/master/google_or_tools as well.
My OR-tools / Python models for the new CP-SAT solver
Here are my Python models for OR-tools CP-SAT solver. Most are ports from my old OR-tools CP solver models adjusted for the CP-SAT solver; they has the same filename with "_sat" added.
Many of these models imports cp_sat_utils.py which includes the following utilities / constraints (decompositions):
-
SimpleSolutionPrinter
-
SimpleSolutionPrinter2
-
ListPrinter
-
SimpleSolutionCounter
-
count_vars(model, x, val, c)
-
atmost(model, val, x, n)
-
atleast(model, val, x, n)
-
exactly(model, val, x, n)
-
increasing(model, x)
-
increasing_strict(model, x)
-
decreasing(model, x)
-
decreasing_strict(model, x)
-
alldifferent_except_0(model, a)
-
reif(model, expr)
-
reif2(model, expr, not_expr)
-
flatten(a)
-
array_values(model, x)
-
circuit(model, x)
-
scalar_product(model, x, y, s)
-
memberOf(model, x, val)
-
toNum(model, a, n, base=10)
-
my_cumulative(model, s, d, r, b)
-
prod(model, x, p)
-
knapsack(model, values, weights, n)
-
global_cardinality(model, x, domain, gcc)
-
regular_table(model, x, Q, S, d, q0, F)
-
regular_element(model,x, Q, S, d, q0, F)
-
no_overlap(model, s1, d1, s2, d2)
-
permutation3(model, from_a, perm_a, to_a)
Here are the models:
- 3_jugs_automaton_sat.py: 3 jugs problem using
AddAutomaton
constraint.
- 3_jugs_regular_sat.py: 3 jugs problem using
regular
constraint.
- 3sum_sat.py: 3SUM problem
- 50_puzzle_sat.py: 50 puzzle (Sam Loyd)
- 5x5_puzzle_sat.py: 5x5 puzzle (Martin Chlond)
- 2012_CMO_problem_sat.py: 2012 problem (from 2012 CMO)
- a_puzzle_sat.py: "A Puzzle", 8809=6,... (from God Plays Dice "A Puzzle"
- a_round_of_golf_sat.py: A round of golf problem (Dell Logic Puzzles)
- abbots_puzzle_sat.py: Abbot's puzzle (Dudeney)
- added_corner_sat.py: Added cordner puzzle
- age_changing_sat.py: Age changing puzzle (Enigma 1224)
- all_interval_sat.py: All interval problem (CSPLib problem #7)
- alldifferent_except_0_sat.py: Decomposition of global constraint
all_different_except_0
- alphametic_sat.py: General alphametic solver (i.e. problems like "SEND+MORE=MONEY")
- appointment_scheduling_sat.py: Appointment scheduling (matrix and 'set' approach)
- assignment_sat.py: Simple assignment problem
- atmost_test_sat.py: Tests of global constraints
atmost
, atleast
, and exactly
- broken_weights_sat.py: Broken weights puzzle
- bus_schedule_sat.py: Bus scheduling
- car_sat.py: Car sequencing (from Pascal Van Hentenryck "OPL Optimization Programming Language", page 184ff)
- circuit_sat.py: Decomposition of global constraint
circuit
- coins3_sat.py: Minimum mumber of coins that allows one to pay exactly any amount smaller than one Euro (from the ECLiPSe book)
- coins_grid_sat.py: Tony Hurlimann's coin grid problem
- coloring_cp_sat.py: Simple map coloring problem, CP version
- coloring_ip_sat.py: Simple map coloring problem, IP approach
- combinatorial_auction2_sat.py: Combinatorial auction
- contiguity_regular_sat.py: Decomposition of global constraint
global contiguity
(using regular
constraint)
- contiguity_automaton_sat.py: Decomposition of global constraint
global contiguity
using AddAutomaton
constraint
- costas_array_sat.py: Costas array problem
- covering_opl_sat.py: Set covering (OPL)
- crew_sat.py: Crew allocation problem
- crossword2_sat.py: Simple crossword problem
- crypta_sat.py: Crypta, alphametic problem (standard Prolog benchmark)
- crypto_sat.py: Crypto, alphametic problem (standard Prolog benchmark)
- curious_set_of_integers_sat.py: Curious set of integers (Martin Gardner)
- debruijn_binary_sat.py: "Arbitrary" de Bruijn sequences
- diet1_sat.py: Simple diet problem (optimization of a diet).
- discrete_tomography_sat.py: Discrete tomography
Data files:
- divisible_by_9_through_1_sat.py: Divisible by 9 through 1 for a "truncated" number. Includes a
modulo
decomposition.
- dudeney_sat.py: Dudeney numbers
- einav_puzzle_sat.py: Einav puzzle
- eq10_sat.py: Eq 10, standard benchmark problem
- eq20_sat.py: Eq 20, standard benchmark problem
- fill_a_pix_sat.py: Fill-a-pix problem.
Data files:
- furniture_moving_sat.py: Optimizing furniture moving (Marriott and Stuckey). Contains an experimental decomposition of the global constraint
cumulative
- furniture_moving_add_cumulative_sat.py: Optimizing furniture moving (Marriott and Stuckey). Using the built-in constraint
AddCumulative
- futoshiki_sat.py: Futoshiki puzzle (grid puzzle)
- generating_numbers_sat.py: Permutation set problem
- generating_numbers2_sat.py: Permutation set problem. Much faster than generating_numbers_sat.py:
- giant_cat_army_riddle_sat.py: Giant Cat Army riddle
- grocery_sat.py: Grocery problem
- hidato_sat.py: Hidato puzzle.
- just_forgotten_sat.py: Just forgotten puzzle (Enigma 1517)
- kakuro_sat.py: Kakuro puzzle
- kenken2_sat.py: KenKen puzzle
- killer_sudoku_sat.py: Killer Sudoku puzzle
- knapsack_cp_sat.py: Knapsack problem
- labeled_dice_sat.py: Labeled dice problem, from Jim Orlin's Colored letters, labeled dice: a logic puzzle (follow up: Update on Logic Puzzle)
- langford_sat.py: Langford's number problem (CSPlib problem 24)
- least_diff_sat.py: Least Diff problem (alphametic problem)
- lectures_sat.py: Lectures, schedule problem from Biggs "Discrete Mathematics"
- magic_square_mip_sat.py: Magic square problem (MIP approach)
- magic_square_sat.py: Magic square problem (CP approach)
- magic_square_and_cards_sat.py: Magic square and card problem (Martin Gardner)
- map_sat.py: Simple map coloring problem. Variant: map2_sat.py.
- marathon2_sat.py: Marathon puzzle (XPress example)
- max_flow_taha_sat.py: Maximum flow problem (Taha)
- max_flow_winston1_sat.py: Maximum flow problem (Winston)
- minesweeper_sat.py: Minesweeper
Data files:
- mr_smith_sat.py: Mr Smith problem, logic problem (from IF Prolog)
- nonogram_automaton_sat.py: Nonogram solver using
AddAutomaton
.
- nonogram_table_sat.py: Nonogram solver using a decomposition of global constraint
regular
(one using element
constraint and one using table
constraint). Note: It uses the module nonogram_utils_sat.py.
run_nonogram_sat.py compares the two solvers: nonogram_automaton_sat.py and nonogram_table_sat.py
Problem instances:
- nontransitive_dice_sat.py: Nontransitive dice
- nqueens_sat.py: N queens problem.
- number_lock_sat.py: Number lock problem (Crack the code) (MindYourDecisions)
- nurse_rostering_sat.py: Simple nurse rostering using global constraint (decomposition)
regular
- nurse_rostering_automaton_sat.py: Simple nurse rostering using the faster
AddAutomaton
- olympic_sat.py: Olympic puzzle (alphametic, standard Prolog benchmark)
- organize_day_sat.py: Organize a day, simple scheduling problem (from ECLiPSe)
- ormat_game_sat.py: Ormat Game
- p_median_sat.py: P-median problem (from OPL)
- pandigital_numbers_sat.py: Pandigital numbers in "any" base
- perfect_square_sequence_sat.py: Perfect square sequence
- permutation_symmetry_sat.py: Permutation symmetry breaking
- photo_problem_sat.py: Photo problem
- place_number_puzzle_sat.py: Place number puzzle
- post_office_problem2_sat.py: Post office problem (Winston)
- quasigroup_completion_sat.py: Quasigroup completion
Data files:
- regexp_sat.py: Generating all strings from a regular expressions
- regexp_automaton_sat.py: Generating all strings from a regular expressions, using
AddAutomaton
- regular_automaton_sat.py: Example of using
AddAutomaton
- regular_sat.py: Decomposition of global constraint
regular
constraint.
- rogo2_sat.py: Rogo grid puzzle solver
Problem instances:
- safe_cracking_sat.py: Safe cracking puzzle (from Oz primer)
- scheduling_speakers_sat.py: Scheduling speakers (Rina Dechter)
- secret_santa_sat.py: Secret santa problem
- secret_santa2_sat.py: Secret santa problem II (optimizing "santa distance")
- send_more_money_any_base_sat.py: SEND+MORE=MONEY in "any" base
- send_more_money_scalar_product_sat.py: SEND+MORE=MONEY using scalar products
- send_most_money_sat.py: SEND+MOST=MONEY (maximize MONEY)
- seseman_sat.py: Seseman Convent problem.
- set_covering_sat.py: Set covering, placing of firestations (Winston)
- set_covering2_sat.py: Set covering, number of security telephons on a campus (Taha)
- set_covering3_sat.py: Set covering, senators making a committe (Murty)
- set_covering4_sat.py: Set covering (and set partition), work scheduling (Lundgren, Roennqvist, Vaerbrand "Optimeringslaera")
- set_covering_deployment_sat.py: Set covering deployment
- set_covering_skiena_sat.py: Set covering problem (Steven Skiena)
- set_partition_sat.py: Set partition
- sicherman_dice_sat.py: Sicherman dice
- ski_assignment_sat.py: Ski assignment problem
- stable_marriage_sat.py: Stable Marriage problem (from Van Hentenryck's OPL book and some more problem instances)
- strimko2_sat.py: Strimko puzzle (Latin squares with "streams").
Some data files:
- subset_sum_sat.py: Subset sum problem (Katta G. Murty)
- sudoku_sat.py: Sudoku, checking over hundred instances of sizes 9x9, 16x16, and 25x25 (mostly from the Gecode collection). The instances are in sudoku_problems.py
- sudoku_17_hints_sat.py: Checks all 49151 Sudoku instances with 17 hints from Gordon Royle
- sudoku_mip_sat.py: Sudoku solver (MIP approach)
- survo_puzzle_sat.py: Survo puzzle
Data files:
- toNum_sat.py: Converts inter to/from an array of digits
- timpkin_sat.py: Mrs Timkpin's age problem (Dudeney)
- traffic_lights_sat.py: Traffic lights problem (CSPLib problem 16)
- tsp_circuit_sat.py: TSP problem using decomposition of the
circuit
constraint (and circuit_path
)
- tsp_circuit_add_circuit_sat.py: TSP problem using built-in constraint
AddCircuit
- volsay_sat.py: Volsay simple optimization problem. Alternative models: volsay2_sat.py, volsay3_sat.py
- who_killed_agatha_sat.py: Who killed agatha? (The Dreadsbury Mansion Murder Mystery, an automated reasoning problem)
- word_square_sat.py: Word square
- young_tableaux_sat.py: Young tableaux and partitions
- xkcd_sat.py: xkcd knapsack problem
My OR-tools / Python models for the old CP solver
Here are my Google CP Solver / Python models (OR-tools' old CP solver). All program files contains more information about the problem as well as references to other implementations of the same problem. The first blog posts about these models are A first look at Google CP Solver/Python (Google or-tools), Improvements of some Google CP Solver models, and Some new Google CP Solver/Python models.
Most of these model has now been ported to the newer CP-SAT solver, see above.
- 3_jugs_regular.py: 3 jugs problem using
regular
constraint. A variant: 3_jugs_regular2.py
- a_round_of_golf.py: A round of golf problem (Dell Logic Puzzles)
- all_interval.py: All interval problem (CSPLib problem #7)
- alldifferent_except_0.py: Decomposition of global constraint
all_different_except_0
- alphametic.py: General alphametic solver (i.e. problems like "SEND+MORE=MONEY")
- assignment.py: Simple assignment problem
- broken_weights.py: Broken weights puzzle
- bus_schedule.py: Bus scheduling
- car.py: Car sequencing (from Pascal Van Hentenryck "OPL Optimization Programming Language", page 184ff)
- circuit.py: Decomposition of global constraint
circuit
- coins3.py: Minimum mumber of coins that allows one to pay exactly any amount smaller than one Euro (from the ECLiPSe book)
- coins_grid.py: Tony Hurlimann's coin grid problem
- coloring_cp.py: Simple map coloring problem, CP version
- combinatorial_auction2.py: Combinatorial auction
- contiguity_regular.py: Decomposition of global constraint
global contiguity
(using regular
constraint)
- costas_array.py: Costas array problem
- covering_opl.py: Set covering (OPL)
- crew.py: Crew allocation problem
- crossword2.py: Simple crossword problem
- crypta.py: Crypta, alphametic problem (standard Prolog benchmark)
- crypto.py: Crypto, alphametic problem (standard Prolog benchmark)
- curious_set_of_integers.py: Curious set of integers (Martin Gardner)
- debruijn_binary.py: "Arbitrary" de Bruijn sequences
- diet1.py: Simple diet problem (optimization of a diet). Variant: diet1_b.py
- discrete_tomography.py: Discrete tomography
Data files:
- divisible_by_9_through_1.py: Divisible by 9 through 1 for a "truncated" number. Includes a
modulo
decomposition.
- einav_puzzle.py: Solving A programming puzzle from Einav. A (slightly) faster variant by Laurent Perron: einav_puzzle2.py
- eq10.py: Eq 10, standard benchmark problem
- eq20.py: Eq 20, standard benchmark problem
- fill_a_pix.py: Fill-a-pix problem.
Data files:
- furniture_moving.py: Optimizing furniture moving (Marriott and Stuckey). Contains an experimental decomposition of the global constraint
cumulative
- futoshiki.py: Futoshiki puzzle (grid puzzle)
- grocery.py: Grocery problem
- hidato.py: Hidato puzzle. However, hidato_laurent.py is Laurent Perron's much faster (and more elegant) version.
- just_forgotten.py: Just forgotten puzzle (Enigma 1517)
- kakuro.py: Kakuro puzzle
- kenken2.py: KenKen puzzle
- killer_sudoku.py: Killer Sudoku puzzle
- knapsack2.py: Simple knapsack problem
- labeled_dice.py: Labeled dice problem, from Jim Orlin's Colored letters, labeled dice: a logic puzzle (follow up: Update on Logic Puzzle)
- langford.py: Langford's number problem (CSPlib problem 24)
- least_diff.py: Least Diff problem (alphametic problem)
- lectures.py: Lectures, schedule problem from Biggs "Discrete Mathematics"
- magic_square.py: Magic square problem
- magic_square_and_cards.py: Magic square and card problem (Martin Gardner)
- map.py: Simple map coloring problem
- marathon2.py: Marathon puzzle (XPress example)
- max_flow_taha.py: Maximum flow problem (Taha)
- max_flow_winston1.py: Maximum flow problem (Winston)
- minesweeper.py: Minesweeper
Data files:
- mr_smith.py: Mr Smith problem, logic problem (from IF Prolog)
- nonogram_regular.py: Nonogram solver (using a decomposition of global constraint
regular
). Laurent Perron's improved version (uses table
in the regular
) nonogram_table.py, and later nonogram_table2.py
Problem instances:
- nqueens.py: N queens problem.
- nqueens2.py: N queens problem, faster version.
- nqueens3.py: N queens problem, faster than nqueens.py and nqueens2.py
- nontransitive_dice.py: Nontransitive dice
- nurse_rostering.py: Simple nurse rostering using global constraint (decomposition)
regular
- olympic.py: Olympic puzzle (alphametic, standard Prolog benchmark)
- organize_day.py: Organize a day, simple scheduling problem (from ECLiPSe)
- ormat_game.py: Ormat Game
- p_median.py: P-median problem (from OPL)
- pandigital_numbers.py: Pandigital numbers in "any" base
- perfect_square_sequence.py: Perfect square sequence
- photo_problem.py: Photo problem
- place_number_puzzle.py: Place number puzzle
- post_office_problem2.py: Post office problem (Winston)
- quasigroup_completion.py: Quasigroup completion
Data files:
- regexp.py: Generating all strings from a regular expressions
- regular.py: Decomposition of global constraint
regular
(experimental). Laurent Perron's improved version: regular_table.py, and later regular_table2.py
- rogo2.py: Rogo grid puzzle solver
Problem instances:
- safe_cracking.py: Safe cracking puzzle (from Oz primer)
- secret_santa.py: Secret santa problem
- secret_santa2.py: Secret santa problem II (optimizing "santa distance")
- send_more_money_any_base.py: SEND+MORE=MONEY in "any" base
- send_more_money_scalar_product.py: SEND+MORE=MONEY using scalar products
- send_most_money.py: SEND+MOST=MONEY (maximize MONEY)
- scheduling_speakers.py: Scheduling speakers (Rina Dechter)
- seseman.py: Seseman Convent problem. Variant: seseman_b.py
- set_covering.py: Set covering, placing of firestations (Winston)
- set_covering2.py: Set covering, number of security telephons on a campus (Taha)
- set_covering3.py: Set covering, senators making a committe (Murty)
- set_covering4.py: Set covering (and set partition), work scheduling (Lundgren, Roennqvist, Vaerbrand "Optimeringslaera")
- set_covering_deployment.py: Set covering deployment
- set_covering_skiena.py: Set covering problem (Steven Skiena)
- set_partition.py: Set partition
- sicherman_dice.py: Sicherman dice
- ski_assignment.py: Ski assignment problem
- stable_marriage.py: Stable Marriage problem (from Van Hentenryck's OPL book and some more problem instances)
- strimko2.py: Strimko puzzle (Latin squares with "streams").
Some data files:
- subset_sum.py: Subset sum problem (Katta G. Murty)
- sudoku_4x4.py: Sudoku, simple 4x4 problem
- survo_puzzle.py: Survo puzzle
Data files:
- toNum.py: Converts inter to/from an array of digits
- traffic_lights.py: Traffic lights problem (CSPLib problem 16)
- who_killed_agatha.py: Who killed agatha? (The Dreadsbury Mansion Murder Mystery, an automated reasoning problem)
- word_square.py: Word square
- young_tableaux.py: Young tableaux and partitions
- xkcd.py: xkcd knapsack problem
My Google CP Solver / Java models
2011-03-17: Google released a Java interface to the CP Solver, and I have just
started to implement models for this, which is basically a port of some Python models.
2011-03-29: Blogged about it in A first look at Google or-tools' Java interface
To simplify my life, all examples has been placed in the package com.google.ortools.constraintsolver.samples
. Some (if not all) models is also available at the Git repo .
- AllDifferentExcept0.java: A decomposition of the global constraint
alldifferent_except_0
- AllInterval.java: All interval problem (CSPLib #7)
- Circuit.java: A decomposition of the global constraint
circuit
- CoinsGrid.java: Tony Hurlimann's coin grid problem
- CoveringOpl.java: Set covering (OPL)
- Crossword.java: Simple crossword problem
- DeBruijn.java: "Arbitrary" de Bruijn sequences
- Diet.java: Simple diet optimization problem
- DivisibleBy9Through1.java: Divisible by 9 through 1 for a "truncated" number. Includes a
modulo
decomposition.
- LeastDiff.java: Least difference problem (minimize the difference of ABCDE-FGHIJ, where all digits A..J are different)
- MagicSquare.java: Magic Square
- Map.java: Simple map coloring problem
- Map2.java: Simple map coloring problem, alternative version
- Minesweeper.java: Minesweeper solver (uses the same data file as for the Python model minesweeper.py, see above)
- NQueens.java: n-queens problem
- NQueens2.java: n-queens problem, faster version
- QuasigroupCompletion.java: Quasigroup completion (uses the same data file as for the Python model quasigroup_completion.py, see above)
- SendMoreMoney.java: Solve SEND+MORE=MONEY
- SendMoreMoney2.java: Solve SEND+MORE=MONEY (5 different encodings).
- SendMostMoney.java: Solve SEND+MOST=MONEY, and show all solutions with maximal value of MONEY.
- Seseman.java: Seseman convent problem.
- SetCovering.java: Set covering, placing of firestations (Winston)
- SetCovering2.java: Set covering, number of security telephons on a campus (Taha)
- SetCovering3.java: Set covering, senators making a committe (Murty)
- SetCovering4.java: Set covering (and set partiton), work scheduling (Lundgren, Roennqvist, Vaerbrand "Optimeringslaera")
- SetCoveringDeployment.java: Set covering deployment
- StableMarriage.java: Stable Marriage problem (from Van Hentenryck's OPL book and more problem instances)
- Strimko2.java: Strimko puzzle (Latin squares with "streams").
- Sudoku.java: Sudoku
- SurvoPuzzle.java: Survo puzzle (uses the same data file as for the Python model survo_puzzle.py, see above)
- ToNum.java: Converts inter to/from an array of digits
- WhoKilledAgatha.java: Who killed agatha? (The Dreadsbury Mansion Murder Mystery, an automated reasoning problem)
- Xkcd.java: Xkcd knapsack problem.
- YoungTableaux.java: Young tableaux and partitions
My Google or-tools LP/MIP models in Python
2011-03-31: Blogged Google or-tools has released support for LP/IP
- 3_jugs_mip.py: 3 jugs problem, MIP version
- assignment6_mip.py: Assignment problem (from GLPK), MIP version
- blending.py: Blending problem (from OPL), MIP version
- coins_grid_mip.py: Tony Hurlimann's coin grid problem, MIP version
- coloring_ip.py: Simple map coloring problem, MIP version
- diet1_mip.py: Simple diet problem (optimization of a diet), MIP version
- game_theory_taha.py: Game theory, 2 person, zero-sum game. LP version
- knapsack_mip.py: Knapsack problem (from GLPK), MIP version
- least_square.py: Solving a fourth grade least square equation, LP version
- magic_square_mip.py: Magic square problem, MIP version
- production.py: Production planning problem, LP version (from OPL)
- stigler.py: Stigler's 1939 diet problem (from GLPK)
- sudoku_mip.py: Sudoku solver, MIP version
- volsay.py: Volsay LP problem (from OPL)
- volsay2.py: Volsay LP problem, using arrays (from OPL)
- volsay3.py: Volsay LP problem, with components (from OPL)
My OR-tools C# models (old CP system)
2012-02-05: Blogged about this in A first look at Google or-tools C# interface
Please note that I'm developing these programs in Mono (under Ubuntu Linux 11.10, 64-bit); they will hopefully also run on other .NET/Mono platforms. Quite a few are rather faitful ports from the Java versions, and some (but not that faithful ports) from the Python models.
Many (if not all) of these models has been pushed to the or-tools Git repo
For compiling and running these models using Mono, something like this should work:
$ export OR_TOOLS=../or-tools/svn/or-tools-read-only
$ export MONO_PATH=$MONO_PATH:$OR_TOOLS
$ mono-csc -lib:$OR_TOOLS /r:Google.OrTools.ConstraintSolver.dll model.cs
$ ./model.exe
- 3_jugs_regular.cs: 3 jugs problem using
regular
constraint.
- a_puzzle.cs: The "8809 = 6 ..." puzzle (See God plays dice: A puzzle)
- a_round_of_golf.cs: A round of golf problem (Dell Logic Puzzles)
- alldifferent_except_0.cs: Decomposition of global constraint
alldifferent_except_0
- all_interval.cs: All interval problem
- appointment_scheduling_set.cs: Appointment scheduling (set approach, random generating the problem instances ) (from the Stack Overflow question: Appointment scheduling algorithm (N people with N free-busy slots, constraint-satisfaction))
- assignment.cs: Simple assignment problem
- broken_weights.cs: Broken weights puzzle
- bus_schedule.cs: Bus scheduling (Taha)
- circuit.cs: Decomposition of global constraint
circuit
- circuit2.cs: Decomposition of global constraint
circuit
which also extracts the path.
- coins3.cs: Minimum mumber of coins that allows one to pay exactly any amount smaller than one Euro (from the ECLiPSe book)
- coins_grid.cs: Tony Hurlimann's coin grid problem
- combinatorial_auction2.cs: Combinatorial auction
- contiguity_regular.cs: Decomposition of global constraint
global contiguity
(using a decomposition of regular
constraint)
- contiguity_transition.cs: Decomposition of global constraint
global contiguity
(using the built-in TransitionConstraint
)
- costas_array.cs: Costas array problem
- covering_opl.cs: Set covering (OPL)
- crew.cs: Crew allocation problem
- crossword.cs: Simple crossword problem
- crypta.cs: Crypta, alphametic problem (standard Prolog benchmark)
- crypto.cs: Crypto, alphametic problem (standard Prolog benchmark)
- curious_set_of_integers.cs: Curious set of integers (Martin Gardner)
- debruijn.cs: Classical or "arbitrary" de Bruijn sequences (useful for generating all de Bruijn sequences)
- diet.cs: Simple diet (minimization) problem.
- discrete_tomography.cs: Discrete tomography
Data files (same as for Python)
- divisible_by_9_through_1.cs: Divisible by 9 through 1 for a "truncated" number. Also includes a decomposition of a
modulo
constraint.
- dudeney.cs: Dudeney Numbers
- einav_puzzle.cs: Solving A programming puzzle from Einav. (This is a port of Laurent Perron's optimized version: einav_puzzle2.py)
- fill_a_pix.cs: Fill-a-pix problem.
Data files (same as for Python above):
- furniture_moving.cs: Optimizing furniture moving (Marriott and Stuckey). Contains a decomposition of the global constraint
cumulative
.
- futoshiki.cs: Futoshiki puzzle (grid puzzle)
- golomb_ruler.cs: Golomb ruler
- grocery.cs: Grocery problem
- hidato_table.cs: Hidato puzzle (a port of Laurent Perron's Python model hidato_table.py, from the or-tools/Python distribution)
- just_forgotten.cs: Just forgotten puzzle (Enigma 1517)
- kakuro.cs: Kakuro puzzle
- kenken2.cs: KenKen puzzle
- killer_sudoku.cs: Killer Sudoku puzzle
- labeled_dice.cs: Labeled dice problem, from Jim Orlin's Colored letters, labeled dice: a logic puzzle (follow up: Update on Logic Puzzle)
- langford.cs: Langford's number problem (CSPlib problem 24)
- least_diff.cs: Least difference problem (minimize the difference of ABCDE-FGHIJ)
- lectures.cs: Lectures, schedule problem from Biggs "Discrete Mathematics"
- magic_sequence.cs: Magic sequence
- magic_square.cs: Magic squares problem
- magic_square_and_cards.cs: Magic square and card problem (Martin Gardner)
- map.cs: Simple map coloring.
- map2.cs: Simple map coloring. Alternative version using a matrix to represent the neighbours.
- marathon2.cs: Marathon puzzle (XPress example)
- max_flow_taha.cs: Maximum flow problem (Taha)
- max_flow_winston1.cs: Maximum flow problem (Winston)
- minesweeper.cs: Minesweeper
Data files (same as for Python and Java above)
- mr_smith.cs: Mr Smith problem, logic problem (from IF Prolog)
- nontransitive_dice.cs: Nontransitive dice
- nqueens.cs: N-queens problem.
- nurse_rostering_regular.cs: Simple nurse rostering using global constraint (decomposition)
regular
- nurse_rostering_transition.cs: Simple nurse rostering using global constraint (using the built-in
TransitionConstraint
)
- olympic.cs: Olympic puzzle (alphametic, standard Prolog benchmark)
- p_median.cs: P-median problem (from OPL)
- pandigital_numbers.cs: Pandigital numbers in "any" base
- partition.cs: Partition problem
- partition_into_subsets_of_equal_values.cs: Subset partitions (problem from the Stack Exchange Q: Partitioning set into subsets with respect to equality of sum among subsets).
- partition_into_subsets_of_equal_values2.cs: A variant which randomizes the problem instance.
- partition_into_subsets_of_equal_values3.cs: Pre-calculate the sum in each subset (
s.Sum() div num_subsets
)
- perfect_square_sequence.cs: Perfect square sequence
- photo_problem.cs: Photo problem (Mozart/Oz)
- picking_teams.cs: Picking teams where the objective is to minimize the difference of total strength of each team.
- picking_teams2.cs: Picking teams where the objective is to minimize the difference of total strength of each team. Additional: arbitrary number of teams and a more liberal handling of the number of team members (and the sum of team points).
- place_number_puzzle.cs: Place number puzzle
- post_office_problem2.cs: Post office problem (Winston)
- quasigroup_completion.cs: Quasigroup completion
Data files (same as for Python and Java above)
- regex.cs: Generating all strings from a regular expressions
- rogo2.cs: Rogo grid puzzle solver
Data files:
- scheduling_speakers.cs: Scheduling speakers (Rina Dechter)
- secret_santa.cs: Secret santa problem
- secret_santa2.cs: Secret santa problem II (optimizing "santa distance")
- send_more_money.cs: SEND+MORE=MONEY alphametic problem
- send_more_money2.cs: SEND+MORE=MONEY using scalar product
- send_most_money.cs: SEND+MOST=MONEY, where we maximize MONEY and then show all solution with MONEY maximized
- seseman.cs: Solving the Seseman convent problem
- set_covering.cs: Set covering, placing of firestations (Winston)
- set_covering2.cs: Set covering, number of security telephons on a campus (Taha)
- set_covering3.cs: Set covering, senators making a committe (Murty)
- set_covering4.cs: Set covering (and set partition), work scheduling (Lundgren, Roennqvist, Vaerbrand "Optimeringslaera")
- set_covering_deployment.cs: Set covering deployment
- set_covering_skiena.cs: Set covering problem (Steven Skiena)
- set_partition.cs: Set partition
- sicherman_dice.cs: Sicherman dice
- ski_assignment.cs: Ski assignment problem
- stable_marriage.cs: Stable Marriage problem (from Van Hentenryck's OPL book and some more problem instances)
- stable_marriage_random.cs: Stable Marriage problem, randomized problem instances (based on stable.marriage.cs)
- strimko2.cs: Strimko puzzle (Latin squares with "streams")
- subset_sum.cs: Subset sum problem (Katta G. Murty)
- sudoku.cs: Sudoku solver
- sudoku_4x4.cs: Sudoku solver (simple 4x4 problem)
- survo_puzzle.cs: Survo puzzle
Data files (same as for Python and Java above:
- to_num.cs: Channeling between a number and an array (useful for some alphametic problems)
- traffic_lights.cs: Traffic lights problem (CSPLib problem 16)
- volsay.cs: Volsay LP problem, LinearSolver (from OPL)
- volsay2.cs: Volsay LP problem, using arrays, LinearSolver (from OPL)
- volsay3.cs: Volsay LP problem, with components, LinearSolver (from OPL)
- wedding_optimal_chart.cs: Finding an optimal seating chart for a wedding (see Improbable Research: Finding an optimal seating chart for a wedding)
- who_killed_agatha.cs: Who killed agatha? (The Dreadsbury Mansion Murder Mystery, an automated reasoning problem)
- word_square.cs: Word square
- xkcd.cs: Solving the xkcd Knapsack problem
- young_tableaux.cs: Young tableaux and partitions
- zebra.cs: Zebra problem (Lewis Caroll)
Also, see my other pages about constraint programming systems:
* My Constraint Programming Blog, especially the Google CP Solver category
* Constraint Programming
* Common constraint programming problems
* My MiniZinc page
* My Zinc page
* My JaCoP page
* My JaCoP/Scala page
* My Choco page
* My Gecode/R page
* My Comet page
* My Gecode page
* My ECLiPSe page
* My Tailor/Essence' page
* My SICStus Prolog page
* My OscaR page
* My JSR-331 page
* My Numberjack page
* My AIMMS+CP page
* My B-Prolog page
* My Choco3 page
* My Picat page
* My z3/python page
* My SWI-Prolog page
Back to my homepage
Created by Hakan Kjellerstrand hakank@gmail.com