예제 #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
파일: precede.cpp 프로젝트: MGKhKhD/easy-IP
 /// %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
파일: precede.cpp 프로젝트: MGKhKhD/easy-IP
 /// %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) {
 }