Ignore:
Timestamp:
Mar 25, 2011 3:05:49 PM (8 years ago)
Author:
forrest
Message:

fix bad bound message

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/src/CbcSimpleInteger.cpp

    r1608 r1624  
    424424    olb = model_->solver()->getColLower()[iColumn] ;
    425425    oub = model_->solver()->getColUpper()[iColumn] ;
    426     //#define TIGHTEN_BOUNDS
    427 #ifndef TIGHTEN_BOUNDS
     426    //#define CBCSIMPLE_TIGHTEN_BOUNDS
     427#ifndef CBCSIMPLE_TIGHTEN_BOUNDS
    428428#ifdef COIN_DEVELOP
    429429    if (olb != down_[0] || oub != up_[1]) {
     
    446446        }
    447447#endif
    448 #ifndef TIGHTEN_BOUNDS
     448#ifndef CBCSIMPLE_TIGHTEN_BOUNDS
    449449        model_->solver()->setColLower(iColumn, down_[0]);
    450450#else
     
    452452#endif
    453453        model_->solver()->setColUpper(iColumn, down_[1]);
    454         //#define CBC_PRINT2
     454        //#define CBC_PRINT2
    455455#ifdef CBC_PRINT2
    456456        printf("%d branching down has bounds %g %g", iColumn, down_[0], down_[1]);
     
    496496#endif
    497497        model_->solver()->setColLower(iColumn, up_[0]);
    498 #ifndef TIGHTEN_BOUNDS
     498#ifndef CBCSIMPLE_TIGHTEN_BOUNDS
    499499        model_->solver()->setColUpper(iColumn, up_[1]);
    500500#else
     
    541541        printf("bad lb change for column %d from %g to %g\n", iColumn, olb, nlb);
    542542#endif
     543        //abort();
    543544        model_->solver()->setColLower(iColumn, CoinMin(olb, nub));
    544545        nlb = olb;
     
    548549        printf("bad ub change for column %d from %g to %g\n", iColumn, oub, nub);
    549550#endif
     551        //abort();
    550552        model_->solver()->setColUpper(iColumn, CoinMax(oub, nlb));
    551553    }
     
    576578        upper[iColumn] = up_[1];
    577579    }
     580}
     581// Change (tighten) bounds in object to reflect bounds in solver.
     582// Return true if now fixed
     583bool
     584CbcIntegerBranchingObject::tighten(OsiSolverInterface * solver)
     585{
     586    double lower = solver->getColLower()[variable_];
     587    double upper = solver->getColUpper()[variable_];
     588    assert (upper>lower);
     589    down_[0] = CoinMax(down_[0],lower);
     590    up_[0] = CoinMax(up_[0],lower);
     591    down_[1] = CoinMin(down_[1],upper);
     592    up_[1] = CoinMin(up_[1],upper);
     593    return (down_[0]==up_[1]);
    578594}
    579595#ifdef FUNNY_BRANCHING
Note: See TracChangeset for help on using the changeset viewer.