
Building a constraint programming solver in Julia - wikunia
http://opensourc.es/blog/constraint-solver-1
======
all2
Could we use this for arbitrary constraints like for mechanical modeling, or
3d animation?

~~~
jefft255
From a quick glance, this and most software doing “constraint programming”
deal with discrete problems. Not saying those are useless for mechanical
modeling or 3D animation, but those areas typically deal with continuous
constraints which require different solvers. My experience in this is limited
to a single class in CP 3 years ago so take this with a grain of salt!!

~~~
tobmlt
Using interval arithmetic and interval analysis, constraint solving can be
extended to continuous problems. This seems first to have been done in the 80s
by extending Prolog. As you say, most constraint software does not do this,
but I vouch that it both exists and works!

I wrote a relational interval constraint solver for automated CAD design. It
used constraints to eliminate infeasible regions of a design space before a
nonlinear solver would generate the actual geometry. It was pretty fun
puzzling out how to build this thing!

------
siproprio
I tried to follow the instructions and it failed, as julia stuff always tend
to fail (with unhelpful error messages).

    
    
        (ConstraintSolver) pkg> develop .
        [ Info: Assigning UUID 761e04fa-38db-5968-92db-bac8a6ce9725 to user_name
     Resolving package versions...
        ERROR: IOError: stat: unknown error (UNKNOWN)

~~~
wikunia
You probably want to develop on the Constraint solver instead of just
installing, right? Then you can use `] dev
[https://github.com/Wikunia/ConstraintSolver.jl`](https://github.com/Wikunia/ConstraintSolver.jl`)
You currently try to develop a package which already exists and that doesn't
work. Yes the error message is unhelpful.

~~~
wikunia
looks like you used `activate .` to get into `ConstraintSolver Pkg>` then it's
already done and you don't need develop or dev anymore Hope it helps

~~~
siproprio
I just copy and pasted the first terminal commands from the post on the julia
REPL and on windows it errors at line `] develop .`.

On linux, it works.

~~~
wikunia
Ah I see. Can't test it on Windows just assumed it should be the same and it
probably should. Glad it works now for you in linux

------
enriquto
This is very cool! How does it compare with the features offered by GLPK? It
seems to solve a super-set of glpk's problems? What are the tradeoffs of this
generalization?

~~~
wikunia
This is not able to solve linear problems as it's built only for discrete
variables in mind. The approach is more removing values from the search space
to find a feasible solution whereas LP focuses on optimization. There are
problems were both approaches can be used. Currently my solver is quite
limited. Stay tuned

~~~
dnautics
not sure if you were aware, but you could have initialized the grid like this:

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

~~~
stabbles

        Int8[0 0 0 5 4 6 0 0 9;
             0 2 0 0 0 0 0 0 7;
             0 0 3 9 0 0 0 0 4;
             9 0 5 0 0 0 0 7 0;
             7 0 0 0 0 0 0 2 0;
             0 0 0 0 9 3 0 0 0;
             0 5 6 0 0 8 0 0 0;
             0 1 0 0 3 9 0 0 0;
             0 0 0 0 0 0 8 0 6]

