Share

elisa

The forum address has changed, you have been automatically redirected. Please update any bookmarks to use the new URL.

Subscribe

Problem in ChangeHeap::addBox

You are viewing a single message from this topic. View all messages.

  1. 2006-11-27 14:47:20 UTC
    If I try to do something like this

    int main(){
    init();

    Model mo;

    RealVar x(Interval(-10,10),"x");
    RealVar y(Interval(-10,10),"y");

    RealConstraint circle(sqr(x) + sqr(y) == 2);
    RealConstraint parabola(y == sqr(x));

    mo = circle;
    mo &= parabola;

    // Definition of solver
    //....

    useBC5();
    IntervalSolver solver(mo);
    solver.useSearchMaxInterval();

    RealVarImplementation *xImp = (RealVarImplementation *)x.getImplementation();
    RealVarImplementation *yImp = (RealVarImplementation *)y.getImplementation();
    SearchTree *xTree = xImp->getSearchTree();

    Interval I, J;

    x.domain().split(I, J);
    //xTree->setBFS();
    xTree->splitBox<Interval>(xImp->getIndexDomain(), I, J);

    //...

    }

    I get Segmentation Fault. And the problem is in the method ChangeHeap::addBox, because it is trying to access an index with value -1

    int addBox(size_t size)
    {
    if (_numBox+1 < _maxBox)
    {
    if (_index[_numBox-1].getValue()+ _index[_numBox-1].getSize()+size < _value + _maxSize) {



    when this method is called _numBox is 0, so, in the last row it is easy to see that _numBox-1 is going to be a problem when used as an index. How can this be?

    If I use the option setBFS in the SearchTree the problem disapears, because Heap's splitBox is used.

    Can you help me?

    Thank you

    Elsa
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.