All Projects → Wikunia → ConstraintSolver.jl

Wikunia / ConstraintSolver.jl

Licence: MIT License
ConstraintSolver in Julia: Blog posts ->

Programming Languages

julia
2034 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to ConstraintSolver.jl

Optaplanner
AI constraint solver in Java to optimize the vehicle routing problem, employee rostering, task assignment, maintenance scheduling, conference scheduling and other planning problems.
Stars: ✭ 2,454 (+2193.46%)
Mutual labels:  solver, constraint-programming, constraint-solver
sudokufx
AR Sudoku grabber and solver using JavaCV, JavaFX and Scala
Stars: ✭ 64 (-40.19%)
Mutual labels:  solver, sudoku
optaplanner-quickstarts
OptaPlanner quick starts for AI optimization: many use cases shown in many different technologies.
Stars: ✭ 226 (+111.21%)
Mutual labels:  solver, constraint-solver
Decider
An Open Source .Net Constraint Programming Solver
Stars: ✭ 112 (+4.67%)
Mutual labels:  constraint-programming, constraint-solver
Hodoku
Hodoku is a solver/generator/trainer/analyzer for standard sudoku.
Stars: ✭ 49 (-54.21%)
Mutual labels:  solver, sudoku
LocalSearchSolvers.jl
A Julia package to manage Constraint-Based Local Search (CBLS) solvers.
Stars: ✭ 18 (-83.18%)
Mutual labels:  constraint-programming, constraint-solver
GHOST
General meta-Heuristic Optimization Solving Toolkit
Stars: ✭ 28 (-73.83%)
Mutual labels:  solver, constraint-programming
Alpha
A lazy-grounding Answer-Set Programming system
Stars: ✭ 44 (-58.88%)
Mutual labels:  solver
stiff3
Adaptive solver for stiff systems of ODEs using semi-implicit Runge-Kutta method of third order
Stars: ✭ 13 (-87.85%)
Mutual labels:  solver
NumDiff
Modern Fortran Numerical Differentiation Library
Stars: ✭ 48 (-55.14%)
Mutual labels:  graph-coloring
hsudoku
A native gtk sudoku game written in haskell
Stars: ✭ 31 (-71.03%)
Mutual labels:  sudoku
FirstOrderSolvers.jl
Large scale convex optimization solvers in julia
Stars: ✭ 20 (-81.31%)
Mutual labels:  solver
qpmad
ROS-compatible Eigen-based Goldfarb-Idnani quadratic programming solver
Stars: ✭ 41 (-61.68%)
Mutual labels:  solver
JSMinesweeper
Minesweeper player, solver and analyser in javascript
Stars: ✭ 25 (-76.64%)
Mutual labels:  solver
mbsolve
An open-source solver tool for the Maxwell-Bloch equations.
Stars: ✭ 14 (-86.92%)
Mutual labels:  solver
euler2D-kfvs-Fortran2003
2D solver for Euler equations in quadrilateral grid, using kinetic flux vector splitting scheme, written in OOP F2003
Stars: ✭ 17 (-84.11%)
Mutual labels:  solver
osqp
The Operator Splitting QP Solver
Stars: ✭ 929 (+768.22%)
Mutual labels:  solver
TIGER
implement a full compiler based on c++ 11
Stars: ✭ 17 (-84.11%)
Mutual labels:  graph-coloring
grilops
a GRId LOgic Puzzle Solver library
Stars: ✭ 29 (-72.9%)
Mutual labels:  constraint-solver
Algorithms
Free hands-on course with the implementation (in Python) and description of several computational, mathematical and statistical algorithms.
Stars: ✭ 117 (+9.35%)
Mutual labels:  graph-coloring

Build status codecov Docs Docs

ConstraintSolver.jl

Logo

This package aims to be a constraint solver completely written in Julia. The concepts are more or less fully described on my blog OpenSourc.es. There is of course also the general user manual here which explains how to solve your model.

Goals

  • Easily extendable
  • Teaching/Learning about constraint programming

Installation

You can install this julia package using ] add ConstraintSolver or if you want to change code you might want to use ] dev ConstraintSolver.

Example

You can easily use this package with the same modeling package as you might be used to for solving (non)linear problems in Julia: JuMP.jl.

Sudoku

using JuMP

grid = [6 0 2 0 5 0 0 0 0;
        0 0 0 0 0 3 0 4 0;
        0 0 0 0 0 0 0 0 0;
        4 3 0 0 0 8 0 0 0;
        0 1 0 0 0 0 2 0 0;
        0 0 0 0 0 0 7 0 0;
        5 0 0 2 7 0 0 0 0;
        0 0 0 0 0 0 0 8 1;
        0 0 0 6 0 0 0 0 0]

using ConstraintSolver
# define a shorter name ;)
const CS = ConstraintSolver

# creating a constraint solver model and setting ConstraintSolver as the optimizer.
m = Model(CS.Optimizer) 
# define the 81 variables
@variable(m, 1 <= x[1:9,1:9] <= 9, Int)
# set variables if fixed
for r=1:9, c=1:9
    if grid[r,c] != 0
        @constraint(m, x[r,c] == grid[r,c])
    end
end

for rc = 1:9
    @constraint(m, x[rc,:] in CS.AllDifferent())
    @constraint(m, x[:,rc] in CS.AllDifferent())
end

for br=0:2
    for bc=0:2
        @constraint(m, vec(x[br*3+1:(br+1)*3,bc*3+1:(bc+1)*3]) in CS.AllDifferent())
    end
end

optimize!(m)

# retrieve grid
grid = convert.(Int, JuMP.value.(x))

Supported variables and constraints

You can see a list of currently supported constraints in the docs. In general the solver works only with bounded discrete variables and supports these constraints

  • linear constraints
  • all different
  • table
  • indictoar
  • reified
  • boolean

Examples

A list of example problems can be found on the website by Håkan Kjellerstrand.

Blog posts

If you're interested in how the solver works you can checkout my blog opensourc.es. There are currently around 30 blog posts about the constraint solver and a new one is added about once per month.

Notice

I'm a MSc student in computer science so I don't have much knowledge on how constraint programming works but I'm keen to find out ;)

Support

If you find a bug or improvement please open an issue or make a pull request. Additionally if you use the solver regularly or are interested in further development please checkout my Patreon page or click on the support button at the top of this website. ;)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].