src/libminisyncpp/minisync.cpp
/*
 * Helper instance method to add a constraint linear equation given a lower-bound and an upper-bound point.
 */
Helper instance method to add a constraint linear equation given a lower-bound and an upper-bound point.
Helper instance method to add a constraint linear equation given a lower - bound and an upper - bound point .
bool MiniSync::Algorithms::Base::addConstraint(LPointPtr lp, HPointPtr hp)
{
    auto pair = std::make_pair(lp, hp);
    if (lp->getX() == hp->getX()) return false;
    else if (lp->getX() < hp->getX() && this->low_constraints.count(pair) == 0)
    {
        this->low_constraints.emplace(pair, std::make_shared<ConstraintLine>(*lp, *hp));
        return true;
    }
    else if (lp->getX() > hp->getX() && this->high_constraints.count(pair) == 0)
    {
        this->high_constraints.emplace(pair, std::make_shared<ConstraintLine>(*lp, *hp));
        return true;
    }
    return false;
}
bool MiniSync :: Algorithms :: Base :: addConstraint ( LPointPtr lp , HPointPtr hp ) { auto pair = std :: make_pair ( lp , hp ) ; if ( lp -> getX ( ) == hp -> getX ( ) ) return false ; else if ( lp -> getX ( ) < hp -> getX ( ) && this -> low_constraints . count ( pair ) == 0 ) { this -> low_constraints . emplace ( pair , std :: make_shared < ConstraintLine > ( * lp , * hp ) ) ; return true ; } else if ( lp -> getX ( ) > hp -> getX ( ) && this -> high_constraints . count ( pair ) == 0 ) { this -> high_constraints . emplace ( pair , std :: make_shared < ConstraintLine > ( * lp , * hp ) ) ; return true ; } return false ; }
Helper instance method to add a constraint linear equation given a lower-bound and an upper-bound point.
Helper instance method to add a constraint linear equation given a lower - bound and an upper - bound point .