examples/nonogram.rb
# constraint type 1. exact one variable in each number is true
constraint type 1. exact one variable in each number is true
constraint type 1 . exact one variable in each number is true
def define_constraint_type_1(solver, r)
  r.each do |r2|
    solver << r2
    r2.combination(2) {|v1, v2| solver << [-v1, -v2] }
  end
end
def define_constraint_type_1 ( solver , r ) r . each do | r2 | solver << r2 r2 . combination ( 2 ) { | v1 , v2 | solver << [ - v1 , - v2 ] } end end
constraint type 1. exact one variable in each number is true
constraint type 1 . exact one variable in each number is true
# r : [[p,q,r], [s,t,u]]
solver
r