00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "CouenneTypes.hpp"
00012 #include "CouenneProblemElem.hpp"
00013
00014 #include <cstdio>
00015
00016 using namespace Couenne;
00017
00018
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
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
00037
00038 body_ -> print (out); fflush (stdout);
00039
00040
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 }