lemon/lp_base.h
changeset 489 2a136de8e3f2
parent 471 fb5af0411793
child 490 2eb5c8ca2c91
equal deleted inserted replaced
3:edbd7a7fc1b3 4:3e6eba53de92
   595       Value &upperBound() { return _ub; }
   595       Value &upperBound() { return _ub; }
   596       ///The const version of \ref upperBound()
   596       ///The const version of \ref upperBound()
   597       const Value &upperBound() const { return _ub; }
   597       const Value &upperBound() const { return _ub; }
   598       ///Is the constraint lower bounded?
   598       ///Is the constraint lower bounded?
   599       bool lowerBounded() const {
   599       bool lowerBounded() const {
   600         return _lb != -INF && !isnan(_lb);
   600         return _lb != -INF && !isNaN(_lb);
   601       }
   601       }
   602       ///Is the constraint upper bounded?
   602       ///Is the constraint upper bounded?
   603       bool upperBounded() const {
   603       bool upperBounded() const {
   604         return _ub != INF && !isnan(_ub);
   604         return _ub != INF && !isNaN(_ub);
   605       }
   605       }
   606 
   606 
   607     };
   607     };
   608 
   608 
   609     ///Linear expression of rows
   609     ///Linear expression of rows
  1664   ///\relates LpBase::Constr
  1664   ///\relates LpBase::Constr
  1665   ///
  1665   ///
  1666   inline LpBase::Constr operator<=(const LpBase::Value &n,
  1666   inline LpBase::Constr operator<=(const LpBase::Value &n,
  1667                                    const LpBase::Constr &c) {
  1667                                    const LpBase::Constr &c) {
  1668     LpBase::Constr tmp(c);
  1668     LpBase::Constr tmp(c);
  1669     LEMON_ASSERT(isnan(tmp.lowerBound()), "Wrong LP constraint");
  1669     LEMON_ASSERT(isNaN(tmp.lowerBound()), "Wrong LP constraint");
  1670     tmp.lowerBound()=n;
  1670     tmp.lowerBound()=n;
  1671     return tmp;
  1671     return tmp;
  1672   }
  1672   }
  1673   ///Create constraint
  1673   ///Create constraint
  1674 
  1674 
  1676   ///
  1676   ///
  1677   inline LpBase::Constr operator<=(const LpBase::Constr &c,
  1677   inline LpBase::Constr operator<=(const LpBase::Constr &c,
  1678                                    const LpBase::Value &n)
  1678                                    const LpBase::Value &n)
  1679   {
  1679   {
  1680     LpBase::Constr tmp(c);
  1680     LpBase::Constr tmp(c);
  1681     LEMON_ASSERT(isnan(tmp.upperBound()), "Wrong LP constraint");
  1681     LEMON_ASSERT(isNaN(tmp.upperBound()), "Wrong LP constraint");
  1682     tmp.upperBound()=n;
  1682     tmp.upperBound()=n;
  1683     return tmp;
  1683     return tmp;
  1684   }
  1684   }
  1685 
  1685 
  1686   ///Create constraint
  1686   ///Create constraint
  1688   ///\relates LpBase::Constr
  1688   ///\relates LpBase::Constr
  1689   ///
  1689   ///
  1690   inline LpBase::Constr operator>=(const LpBase::Value &n,
  1690   inline LpBase::Constr operator>=(const LpBase::Value &n,
  1691                                    const LpBase::Constr &c) {
  1691                                    const LpBase::Constr &c) {
  1692     LpBase::Constr tmp(c);
  1692     LpBase::Constr tmp(c);
  1693     LEMON_ASSERT(isnan(tmp.upperBound()), "Wrong LP constraint");
  1693     LEMON_ASSERT(isNaN(tmp.upperBound()), "Wrong LP constraint");
  1694     tmp.upperBound()=n;
  1694     tmp.upperBound()=n;
  1695     return tmp;
  1695     return tmp;
  1696   }
  1696   }
  1697   ///Create constraint
  1697   ///Create constraint
  1698 
  1698 
  1700   ///
  1700   ///
  1701   inline LpBase::Constr operator>=(const LpBase::Constr &c,
  1701   inline LpBase::Constr operator>=(const LpBase::Constr &c,
  1702                                    const LpBase::Value &n)
  1702                                    const LpBase::Value &n)
  1703   {
  1703   {
  1704     LpBase::Constr tmp(c);
  1704     LpBase::Constr tmp(c);
  1705     LEMON_ASSERT(isnan(tmp.lowerBound()), "Wrong LP constraint");
  1705     LEMON_ASSERT(isNaN(tmp.lowerBound()), "Wrong LP constraint");
  1706     tmp.lowerBound()=n;
  1706     tmp.lowerBound()=n;
  1707     return tmp;
  1707     return tmp;
  1708   }
  1708   }
  1709 
  1709 
  1710   ///Addition
  1710   ///Addition