# Gecode/r troubles with constraints definition in a CSP

**URL:** <https://www.ruby-forum.com/t/gecode-r-troubles-with-constraints-definition-in-a-csp/185243>\
**Category:** Ruby\
**Created:** [March 16, 2010, 7:02pm UTC](https://www.ruby-forum.com/t/gecode-r-troubles-with-constraints-definition-in-a-csp/185243 "2010-03-16T19:02:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![save83bg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/49beb7/32.png) [@save83bg](https://www.ruby-forum.com/u/save83bg)\
**Post date:** [March 16, 2010, 7:02pm UTC](https://www.ruby-forum.com/t/gecode-r-troubles-with-constraints-definition-in-a-csp/185243/1 "2010-03-16T19:02:59Z")

</div>

Hi,  
i’m trying the Gecoder-with-gecode library, to solve some CSP problems.

The problem is: given a int\_matrix (with domain 0…1),

```
   sched = int_var_matrix(3, 15,0..1)

```

place 0 and 1’s in order to respect the following constraints:

1. the sum of each column’s value must be 1:

2. the sum of each row’s value must be equal to a given array content:

The 1) and 2) work well, but when i put the 3rd:

1. each row, the first “1” from left, must be positioned after a  
specific index, contained in an array

if i keep just the 1) and 2) and do:

```
  branch_on matricione
  solve!

```

i obtain a solution, but when i put the 3), it appears the following  
error:  
`method_missing': undefined method`must’ for nil:NilClass  
(NoMethodError)  
from scheduling.rb:55

This is strange, because the 3) is very similar to the other ones!!  
Anyone can help me please?  
Thanks  
Saverio
