Пример #1
0
 inline
 std::string
 Test::str(const Gecode::IntArgs& x) {
   std::string s = "";
   for (int i=0; i<x.size()-1; i++)
     s += str(x[i]) + ",";
   return "[" + s + str(x[x.size()-1]) + "]";
 }
Пример #2
0
 /// %Test whether \a x is solution
 virtual bool solution(const SetAssignment& x) const {
   for (int j=0; j<c.size()-1; j++)
     for (int i=0; i<x.size(); i++) {
       if (!in(c[j],x[i]) && in(c[j+1],x[i]))
         return false;
       if (in(c[j],x[i]) && !in(c[j+1],x[i]))
         break;
     }
   return true;
 }
Пример #3
0
 /// %Test whether \a x is solution
 virtual bool solution(const Assignment& x) const {
   for (int j=0; j<c.size()-1; j++)
     for (int i=0; i<x.size(); i++) {
       if (x[i] == c[j+1])
         return false;
       if (x[i] == c[j])
         break;
     }
   return true;
 }
Пример #4
0
 /// Create and register test with maximal coordinate value \a m
 Int2(int m, const Gecode::IntArgs& w0, const Gecode::IntArgs& h0) 
   : Test("NoOverlap::Int::2::"+str(m)+"::"+str(w0)+"::"+str(h0),
          2*w0.size(), 0, m-1), 
     w(w0), h(h0) {
 }