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

Go to the documentation of this file.
00001 /* $Id: constraint.cpp 154 2009-06-16 18:52:53Z 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 Common Public License (CPL)
00009  */
00010 
00011 #include "CouenneTypes.hpp"
00012 #include "CouenneProblemElem.hpp"
00013 
00014 #include <cstdio>
00015 
00016 // output nonlinear constraint
00017 
00018 void CouenneConstraint::print (std::ostream &out) {
00019 
00020   bool samebounds = ((lb_ -> Type () == CONST) &&
00021                      (ub_ -> Type () == CONST) && 
00022                      (fabs (lb_ -> Value () - ub_ -> Value ()) < COUENNE_EPS));
00023 
00024   // left hand side (a in a <= h(x) <= b)
00025 
00026   if (lb_ && 
00027       !samebounds &&
00028       ((lb_ -> Type  () != CONST) ||
00029        (lb_ -> Value () > - COUENNE_INFINITY))) {
00030 
00031     lb_ -> print (out); fflush (stdout);
00032     out  << " <= "; fflush (stdout);
00033   }
00034 
00035   // body: h(x) in a <= h(x) <= b
00036 
00037   body_ -> print (out); fflush (stdout);
00038 
00039   // right hand side
00040 
00041   if (ub_ && ((ub_ -> Type  () != CONST) || 
00042               (ub_ -> Value () <  COUENNE_INFINITY))) {
00043 
00044     out << ' ';
00045     if (!samebounds) out << "<";
00046     out << "= "; fflush (stdout);
00047     ub_ -> print (out); fflush (stdout);
00048   } 
00049 
00050   out << std::endl;
00051 }

Generated on Mon May 3 03:05:21 2010 by  doxygen 1.4.7