lemon/lp_base.h
changeset 2072 224d3781b00b
parent 1993 2115143eceea
child 2085 1970a93dfaa8
equal deleted inserted replaced
27:ee80fff0ca2a 28:0430ef28e5dd
   157     typedef double Value;
   157     typedef double Value;
   158     ///The infinity constant
   158     ///The infinity constant
   159     static const Value INF;
   159     static const Value INF;
   160     ///The not a number constant
   160     ///The not a number constant
   161     static const Value NaN;
   161     static const Value NaN;
       
   162 
       
   163     static inline bool isNaN(const Value& v) { return v!=v; }
   162     
   164     
   163     ///Refer to a column of the LP.
   165     ///Refer to a column of the LP.
   164 
   166 
   165     ///This type is used to refer to a column of the LP.
   167     ///This type is used to refer to a column of the LP.
   166     ///
   168     ///
  1103 
  1105 
  1104     ///@{
  1106     ///@{
  1105 
  1107 
  1106     ///\e Solve the LP problem at hand
  1108     ///\e Solve the LP problem at hand
  1107     ///
  1109     ///
  1108     ///\return The result of the optimization procedure. Possible values and their meanings can be found in the documentation of \ref SolveExitStatus.
  1110     ///\return The result of the optimization procedure. Possible 
       
  1111     ///values and their meanings can be found in the documentation of 
       
  1112     ///\ref SolveExitStatus.
  1109     ///
  1113     ///
  1110     ///\todo Which method is used to solve the problem
  1114     ///\todo Which method is used to solve the problem
  1111     SolveExitStatus solve() { return _solve(); }
  1115     SolveExitStatus solve() { return _solve(); }
  1112     
  1116     
  1113     ///@}
  1117     ///@}
  1288   inline LpSolverBase::Constr operator<=(const LpSolverBase::Value &n,
  1292   inline LpSolverBase::Constr operator<=(const LpSolverBase::Value &n,
  1289 					 const LpSolverBase::Constr&c) 
  1293 					 const LpSolverBase::Constr&c) 
  1290   {
  1294   {
  1291     LpSolverBase::Constr tmp(c);
  1295     LpSolverBase::Constr tmp(c);
  1292     ///\todo Create an own exception type.
  1296     ///\todo Create an own exception type.
  1293     if(!isnan(tmp.lowerBound())) throw LogicError();
  1297     if(!LpSolverBase::isNaN(tmp.lowerBound())) throw LogicError();
  1294     else tmp.lowerBound()=n;
  1298     else tmp.lowerBound()=n;
  1295     return tmp;
  1299     return tmp;
  1296   }
  1300   }
  1297   ///\e
  1301   ///\e
  1298   
  1302   
  1301   inline LpSolverBase::Constr operator<=(const LpSolverBase::Constr& c,
  1305   inline LpSolverBase::Constr operator<=(const LpSolverBase::Constr& c,
  1302 					 const LpSolverBase::Value &n)
  1306 					 const LpSolverBase::Value &n)
  1303   {
  1307   {
  1304     LpSolverBase::Constr tmp(c);
  1308     LpSolverBase::Constr tmp(c);
  1305     ///\todo Create an own exception type.
  1309     ///\todo Create an own exception type.
  1306     if(!isnan(tmp.upperBound())) throw LogicError();
  1310     if(!LpSolverBase::isNaN(tmp.upperBound())) throw LogicError();
  1307     else tmp.upperBound()=n;
  1311     else tmp.upperBound()=n;
  1308     return tmp;
  1312     return tmp;
  1309   }
  1313   }
  1310 
  1314 
  1311   ///\e
  1315   ///\e
  1315   inline LpSolverBase::Constr operator>=(const LpSolverBase::Value &n,
  1319   inline LpSolverBase::Constr operator>=(const LpSolverBase::Value &n,
  1316 					 const LpSolverBase::Constr&c) 
  1320 					 const LpSolverBase::Constr&c) 
  1317   {
  1321   {
  1318     LpSolverBase::Constr tmp(c);
  1322     LpSolverBase::Constr tmp(c);
  1319     ///\todo Create an own exception type.
  1323     ///\todo Create an own exception type.
  1320     if(!isnan(tmp.upperBound())) throw LogicError();
  1324     if(!LpSolverBase::isNaN(tmp.upperBound())) throw LogicError();
  1321     else tmp.upperBound()=n;
  1325     else tmp.upperBound()=n;
  1322     return tmp;
  1326     return tmp;
  1323   }
  1327   }
  1324   ///\e
  1328   ///\e
  1325   
  1329   
  1328   inline LpSolverBase::Constr operator>=(const LpSolverBase::Constr& c,
  1332   inline LpSolverBase::Constr operator>=(const LpSolverBase::Constr& c,
  1329 					 const LpSolverBase::Value &n)
  1333 					 const LpSolverBase::Value &n)
  1330   {
  1334   {
  1331     LpSolverBase::Constr tmp(c);
  1335     LpSolverBase::Constr tmp(c);
  1332     ///\todo Create an own exception type.
  1336     ///\todo Create an own exception type.
  1333     if(!isnan(tmp.lowerBound())) throw LogicError();
  1337     if(!LpSolverBase::isNaN(tmp.lowerBound())) throw LogicError();
  1334     else tmp.lowerBound()=n;
  1338     else tmp.lowerBound()=n;
  1335     return tmp;
  1339     return tmp;
  1336   }
  1340   }
  1337 
  1341 
  1338   ///\e
  1342   ///\e