Gecoders,

I am struggling with finding the best way to cut a hole in a view during 
propegation without doing a simple for loop. I originally thought I should use 
a Range and Iterator and execute the minus_v method, but I can't find an easy 
way to construct one easily using specific values other than using a value 
array of ints but I would still need a loop to initialize the array. What is 
the best way to do this with the least computation?

The end goal of this propagator is to put a gap between two domains however 
there is no guarantee that x0 < x1  so you really can't reduce much on the 
domain until one is assigned a start. Additionally you can't use an offset view 
because you only want the offset to apply if the task is the earlier one one.

virtual ExecStatus propagate(Space& home, const ModEventDelta&)  {
            if (x0.assigned())
            {
                  //create a range that x1 cant equal over (x0.val - offset1, 
x0.val + offset0)
                  for (int i = x0.val() - offset1; i < x0.val() + offset0; ++i)
                  {
                        GECODE_ME_CHECK(x1.nq(home, i));
                  }
            }
            else if (x1.assigned())
            {
                  //create a range that x0 cant equal over (x1.val - offset0, 
x1.val + offset1)
                  for (int i = x1.val() - offset0; i < x1.val() + offset1; ++i)
                  {
                        GECODE_ME_CHECK(x0.nq(home, i));
                  }
            }

            if (x0.max() + offset0 <= x1.min() || x1.max() + offset1 <= 
x0.min())
                  return home.ES_SUBSUMED(*this);
            else
                  return ES_FIX;
      }

David Zaremby
Senior Software Engineer
LSS / Strategic Products

Lockheed Martin Simulation, Training & Support
12506 Lake Underhill Road, MP-823
Orlando, FL 32825
_______________________________________________
Gecode users mailing list
[email protected]
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to