[gecode-users] Problem with FlatzincSpace deep copy

Mohamed Rezgui kyo.alone at gmail.com
Fri Feb 22 10:04:27 CET 2013


Hi everybody,

I have a bug to copy (deep copy) a FlatzincSpace without branhing (no
Branchers)
when I would like to start a branch and bound in only two decision
variables.

<code>
Printer p;
FlatZincSpace* fs = FlatZincSpace::parse(......);

FlatZincSpace* s_copy = fs->copy(false);
s_copy->shrinkArrays(p);


SearchOptions opt = o;
opt.threads = 1.0; //MonoThread
opt.expand();

Gecode::IntVarArgs vars(2);
vars[0] = s_copy->iv[0];
vars[1] = s_copy->iv[1];


Gecode::branch(*s_copy, vars, Gecode::INT_VAR_NONE(),
Gecode::INT_VAL_MIN());
 Gecode::Search::Engine* bab = Gecode::Search::bab(s_copy, 1.0, opt);

FlatZincSpace* solution = NULL;
solution = static_cast<FlatZincSpace*>(bab->next())
;//<----------------------- Bug here
</code>

the bug is declared in this instruction line 85
file search/sequential/bab.hh
<code>
forceinline
  BAB::BAB(Space* s, size_t sz, const Options& o)
    : Worker(sz), opt(o), d(0), mark(0), best(NULL) {
    current(s); //<----------------------- Bug here
</code>

Precisely when there is an allocation of an actorlink in s->allocated()
file search/worker.hh  line 162
<code>
forceinline void
  Worker::current(const Space* s) {
    if (s == NULL) {
      mem_total -= mem_cur;
      mem_cur = 0;
    } else {
      mem_cur = mem_space + s->allocated(); //<----------------------- Bug
here
      mem_total += mem_cur;
      if (mem_total > memory)
        memory = mem_total;
    }
  }

With Gecode rev13367

Can you help me please ?

Best Regards,
Mohammed REZGUI
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20130222/e88f85c0/attachment.html>


More information about the users mailing list