/home/coin/SVN-release/OS-2.4.0/Couenne/src/problem/constraint.cpp

Go to the documentation of this file.
00001 /* $Id: constraint.cpp 490 2011-01-14 16:07:12Z pbelotti $ */
00002 /*
00003  * Name:    constraint.cpp
00004  * Author:  Pietro Belotti
00005  * Purpose: methods of the classes CouenneConstraint and LinearConstraint
00006  *
00007  * (C) Carnegie-Mellon University, 2006. 
00008  * This file is licensed under the Eclipse Public License (EPL)
00009  */
00010 
00011 #include "CouenneTypes.hpp"
00012 #include "CouenneProblemElem.hpp"
00013 
00014 #include <cstdio>
00015 
00016 using namespace Couenne;
00017 
00018 // output nonlinear constraint
00019 void CouenneConstraint::print (std::ostream &out) {
00020 
00021   bool samebounds = ((lb_ -> Type () == CONST) &&
00022                      (ub_ -> Type () == CONST) && 
00023                      (fabs (lb_ -> Value () - ub_ -> Value ()) < COUENNE_EPS));
00024 
00025   // left hand side (a in a <= h(x) <= b)
00026 
00027   if (lb_ && 
00028       !samebounds &&
00029       ((lb_ -> Type  () != CONST) ||
00030        (lb_ -> Value () > - COUENNE_INFINITY))) {
00031 
00032     lb_ -> print (out); fflush (stdout);
00033     out  << " <= "; fflush (stdout);
00034   }
00035 
00036   // body: h(x) in a <= h(x) <= b
00037 
00038   body_ -> print (out); fflush (stdout);
00039 
00040   // right hand side
00041 
00042   if (ub_ && ((ub_ -> Type  () != CONST) || 
00043               (ub_ -> Value () <  COUENNE_INFINITY))) {
00044 
00045     out << ' ';
00046     if (!samebounds) out << "<";
00047     out << "= "; fflush (stdout);
00048     ub_ -> print (out); fflush (stdout);
00049   } 
00050 
00051   out << std::endl;
00052 }

Generated on Thu Sep 22 03:05:59 2011 by  doxygen 1.4.7