Wikunia / ConstraintSolver.jl

ConstraintSolver in Julia: Blog posts ->
https://opensourc.es/blog/constraint-solver-1
MIT License
136 stars 13 forks source link

More complex constraints in RHS of an indicator / reification #248

Open hakank opened 3 years ago

hakank commented 3 years ago

It would be great to be able to write more complex expressions, such as indicators and reifications in the RHS of an indicator / reification. For example (from http://hakank.org/julia/constraints/monks_and_doors.jl )

@constraint(model, m7 := { m3 => m6})  

@constraint(model, m8 := { (m7 == 1 && m8 == 1) => m1==1 )  
Wikunia commented 3 years ago

The first version can work by changing it to:

@constraint(model, m7 := { m3 => {m6 == 1}})  

which isn't implemented yet but would be easy. It's probably hard to have

@constraint(model, m7 := { m3 => {m6 > 1}})

that working at the moment as > is not implemented directly and I'm not sure yet how to best allow this inside an indicator constraint which is also inside of a reified constraint. I might go for implementing it though such that m6 > 1 fails and m6 == 1 works first.

Wikunia commented 2 years ago

The first is now implemented. Will check what I can do to support a different lhs of a reified or indicator constraint. Also support for > or >= is still not implemented.