Couenne 0.5.8
Loading...
Searching...
No Matches
CouenneProblemElem.hpp
Go to the documentation of this file.
1/* $Id: CouenneProblemElem.hpp 910 2012-10-27 13:14:44Z pbelotti $
2 *
3 * Name: CouenneProblemElem.hpp
4 * Author: Pietro Belotti
5 * Purpose: define the classes used by class CouenneProblem
6 *
7 * (C) Carnegie-Mellon University, 2006-08.
8 * This file is licensed under the Eclipse Public License (EPL)
9 */
10
11#ifndef COUENNE_PROBLEM_ELEM_HPP
12#define COUENNE_PROBLEM_ELEM_HPP
13
14#include <iostream>
15
16#include "CouenneTypes.hpp"
17#include "CouenneExpression.hpp"
18#include "CouenneExprConst.hpp"
19
20namespace Couenne {
21
40
41 protected:
42
46
47 public:
48
51 expression *lb = NULL,
52 expression *ub = NULL):
53 body_ (body),
54 lb_ (lb),
55 ub_ (ub) {
56
57 if (!lb_)
58 if (!ub_) {
59 lb_ = new exprConst (0.);
60 ub_ = new exprConst (0.);
61 }
62 else lb_ = new exprConst (- COUENNE_INFINITY);
63 else if (!ub_) ub_ = new exprConst (COUENNE_INFINITY);
64 }
65
67 virtual ~CouenneConstraint () {
68 delete body_;
69 delete lb_;
70 delete ub_;
71 }
72
75 body_ (c.Body () -> clone (d)),
76 lb_ (c.Lb () -> clone (d)),
77 ub_ (c.Ub () -> clone (d)) {}
78
80 virtual inline CouenneConstraint *clone (Domain *d = NULL) const
81 {return new CouenneConstraint (*this, d);}
82
83 // Get constraint's elements
84 virtual inline expression *Lb () const {return lb_;}
85 virtual inline expression *Ub () const {return ub_;}
86 virtual inline expression *Body () const {return body_;}
87
89 virtual inline expression *Body (expression *newBody)
90 {body_ = newBody; return body_;}
91
94
96 virtual void print (std::ostream & = std::cout);
97};
98
99
100
110
111 protected:
112
115
116 public:
117
120 body_ (body) {}
121
124 {delete body_;}
125
128 body_ (o.body_ -> clone (d)) {}
129
131 inline CouenneObjective *clone (Domain *d = NULL) const
132 {return new CouenneObjective (*this, d);}
133
135 inline expression *Body () const
136 {return body_;}
137
140 {body_ = newBody; return body_;}
141
144 {return body_ -> standardize (p);}
145
147 void print (std::ostream &out = std::cout) {
148 out << "min ";
149 body_ -> print (out);
150 out << std::endl;
151 }
152};
153
154}
155
156#endif
#define COUENNE_INFINITY
Class to represent nonlinear constraints.
expression * body_
Body of constraint.
virtual expression * Ub() const
Expression of upper bound.
CouenneConstraint(expression *body=NULL, expression *lb=NULL, expression *ub=NULL)
Constructor.
CouenneConstraint(const CouenneConstraint &c, Domain *d=NULL)
Copy constructor.
virtual expression * Lb() const
Expression of lower bound.
expression * lb_
Lower bound (expression)
expression * ub_
Upper bound (expression)
virtual CouenneConstraint * clone(Domain *d=NULL) const
Cloning method.
virtual exprAux * standardize(CouenneProblem *)
decompose body of constraint through auxiliary variables
virtual expression * Body(expression *newBody)
Set body of constraint.
virtual ~CouenneConstraint()
Destructor.
virtual expression * Body() const
Expression of body of constraint.
virtual void print(std::ostream &=std::cout)
print constraint
void print(std::ostream &out=std::cout)
Print to iostream.
exprAux * standardize(CouenneProblem *p)
Get standard form of this objective function.
CouenneObjective * clone(Domain *d=NULL) const
cloning method
expression * Body(expression *newBody)
Set body.
expression * body_
expression to optimize
CouenneObjective(expression *body)
constructor
CouenneObjective(const CouenneObjective &o, Domain *d=NULL)
copy constructor
expression * Body() const
get body
Class for MINLP problems with symbolic information.
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...
Auxiliary variable.
constant-type operator
Expression base class.
general include file for different compilers