Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
tmp
OS-2.10.2
Couenne
src
problem
constraint.cpp
Go to the documentation of this file.
1
/* $Id: constraint.cpp 490 2011-01-14 16:07:12Z pbelotti $ */
2
/*
3
* Name: constraint.cpp
4
* Author: Pietro Belotti
5
* Purpose: methods of the classes CouenneConstraint and LinearConstraint
6
*
7
* (C) Carnegie-Mellon University, 2006.
8
* This file is licensed under the Eclipse Public License (EPL)
9
*/
10
11
#include "
CouenneTypes.hpp
"
12
#include "
CouenneProblemElem.hpp
"
13
14
#include <cstdio>
15
16
using namespace
Couenne;
17
18
// output nonlinear constraint
19
void
CouenneConstraint::print
(std::ostream &out) {
20
21
bool
samebounds = ((
lb_
-> Type () ==
CONST
) &&
22
(
ub_
-> Type () ==
CONST
) &&
23
(fabs (
lb_
-> Value () -
ub_
-> Value ()) <
COUENNE_EPS
));
24
25
// left hand side (a in a <= h(x) <= b)
26
27
if
(
lb_
&&
28
!samebounds &&
29
((
lb_
-> Type () !=
CONST
) ||
30
(
lb_
-> Value () > -
COUENNE_INFINITY
))) {
31
32
lb_
->
print
(out); fflush (stdout);
33
out <<
" <= "
; fflush (stdout);
34
}
35
36
// body: h(x) in a <= h(x) <= b
37
38
body_
->
print
(out); fflush (stdout);
39
40
// right hand side
41
42
if
(
ub_
&& ((
ub_
-> Type () !=
CONST
) ||
43
(
ub_
-> Value () <
COUENNE_INFINITY
))) {
44
45
out <<
' '
;
46
if
(!samebounds) out <<
"<"
;
47
out <<
"= "
; fflush (stdout);
48
ub_
->
print
(out); fflush (stdout);
49
}
50
51
out << std::endl;
52
}
Couenne::CONST
Definition:
CouenneTypes.hpp:20
Couenne::CouenneConstraint::print
virtual void print(std::ostream &=std::cout)
print constraint
Definition:
constraint.cpp:19
Couenne::CouenneConstraint::ub_
expression * ub_
Upper bound (expression)
Definition:
CouenneProblemElem.hpp:45
COUENNE_EPS
#define COUENNE_EPS
Definition:
CouennePrecisions.hpp:19
Couenne::CouenneConstraint::lb_
expression * lb_
Lower bound (expression)
Definition:
CouenneProblemElem.hpp:44
COUENNE_INFINITY
#define COUENNE_INFINITY
Definition:
CouennePrecisions.hpp:32
CouenneProblemElem.hpp
Couenne::CouenneConstraint::body_
expression * body_
Body of constraint.
Definition:
CouenneProblemElem.hpp:43
CouenneTypes.hpp
Generated by
1.8.5