Interior-point-optimisation  1.0-1
Interior-pointoptimisationlibrary
Constraint.hpp
Go to the documentation of this file.
1 /*
2  * $Id: Constraint.hpp 197 2014-10-26 19:01:18Z jdl3 $
3  * Copyright (C) 2013, 2014 John D Lamb
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or (at
8  * your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifndef IPO_CONSTRAINT_HPP
21 #define IPO_CONSTRAINT_HPP
22 
23 #include"Objective.hpp"
24 
25 namespace ipo {
26 
40  class Constraint : public Objective {
41  public:
49  detail::SharedFunctionPtr function, std::string const& name );
59  std::string const& name );
67  std::string const& name );
75  char const* const name = 0 );
85  char const* const name = 0 );
93  char const* const name = 0 );
97  double getUpperBound() const;
101  double getLowerBound() const;
108  virtual void setUpperBound( double const upperBound );
115  virtual void setLowerBound( double const lowerBound );
120  Constraint( Constraint const& constraint );
126  Constraint& operator=( Constraint const& constraint );
131  Constraint( Constraint&& constraint ) : Objective { constraint }{}
137  Constraint& operator=( Constraint&& constraint ){
138  model = constraint.model;
139  function = constraint.function;
140  data = std::move( constraint.data );
141  return *this;
142  }
150  virtual void summary( std::ostream& ostream = std::cout,
151  std::string const& prefix = "" ) const override;
152  private:
153  // friend declaration
154  friend bool ipo::operator==( Constraint const&, Constraint const& );
155  };
156 
163  bool operator==( Constraint const& lhs, Constraint const& rhs );
164 }
165 
166 #endif
Shared pointer to ipo::Function object.
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
virtual void summary(std::ostream &ostream=std::cout, std::string const &prefix="") const override
Create a summary of this function.
Definition: Constraint.cc:94
std::shared_ptr< Data > data
The objective data.
Definition: Objective.hpp:205
Constraint(Constraint &&constraint)
Move constructor.
Definition: Constraint.hpp:131
Class for a constraint function.
Definition: Constraint.hpp:40
Abstract base class for model.
Definition: Var.hpp:39
Class for an objective function.
Definition: Objective.hpp:37
Constraint & operator=(Constraint &&constraint)
Move assignment operator.
Definition: Constraint.hpp:137
double getLowerBound() const
Get lower bound of Constraint.
Definition: Constraint.cc:58
virtual void setUpperBound(double const upperBound)
Set upper bound of Constraint.
Definition: Constraint.cc:63
This class computes a function at a vector.
Definition: Function.hpp:38
Constraint(detail::ModelBase &model, detail::SharedFunctionPtr function, std::string const &name)
Use this constructor to construct from a ipo_function::SharedFunctionPtr object.
Definition: Constraint.cc:28
data lowerBound
Definition: Variable.cc:39
double getUpperBound() const
Get upper bound of Constraint.
Definition: Constraint.cc:53
data name
Definition: Variable.cc:37
data upperBound
Definition: Variable.cc:38
bool operator==(Array const &lhs, Array const &rhs)
Compare two Array objects.
Definition: Array.hpp:688
SharedFunctionPtr function
The objective or constraint function.
virtual void setLowerBound(double const lowerBound)
Set lower bound of Constraint.
Definition: Constraint.cc:70
Constraint & operator=(Constraint const &constraint)
Assignment operator.
Definition: Constraint.cc:86
This namespace holds all the interior-point optimisation classes.
Definition: Array.hpp:28