Interior-point-optimisation  1.0-1
Interior-pointoptimisationlibrary
Objective.hpp
Go to the documentation of this file.
1 /*
2  * $Id: Objective.hpp 239 2014-11-30 14:11:47Z 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_OBJECTIVE_HPP
21 #define IPO_OBJECTIVE_HPP
22 
24 
25 namespace ipo {
26 
38  public:
46  detail::SharedFunctionPtr function, std::string const& name );
56  std::string const& name );
66  std::string const& name );
74  char const* const name = 0 );
84  char const* const name = 0 );
92  char const* const name = 0 );
97  Objective( Objective const& objective );
102  Objective( Objective&& objective );
107  Objective& operator=( Objective const& objective );
112  Objective& operator=( Objective&& objective );
117  std::string getName() const;
122  void setName( std::string const& name );
127  void setName( char* const name );
132  Array& getVariables();
139  void addVariable( Variable& variable );
145  void removeVariable( Variable& variable );
152  void addArray( Array& array );
159  void removeArray( Array& array );
167  virtual void summary( std::ostream& ostream = std::cout,
168  std::string const& prefix = "" ) const override;
169  protected:
173  struct Data {
178  Data( detail::ModelBase& model );
182  std::string name;
195  };
201  double value() const noexcept;
205  std::shared_ptr<Data> data;
206  };
207 
208 }
209 
210 #endif
void addArray(Array &array)
Add an Array.
Definition: Objective.cc:146
Shared pointer to ipo::Function object.
Array variables
The variables used by function.
Definition: Objective.hpp:186
double constexpr infinity
Infinity: use for unbounded variables.
Definition: Var.hpp:30
STL namespace.
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
Array & getVariables()
Get variables used by Objective function.
Definition: Objective.cc:75
void setName(std::string const &name)
Set name of Objective.
Definition: Objective.cc:65
std::string name
A name for this objective.
Definition: Objective.hpp:182
std::shared_ptr< Data > data
The objective data.
Definition: Objective.hpp:205
Abstract base class for Objective and Constraint.
Abstract base class for model.
Definition: Var.hpp:39
Class for an objective function.
Definition: Objective.hpp:37
double value() const noexcept
Value of the objective function at the current value of the variables.
Definition: Objective.cc:209
void removeArray(Array &array)
Remove an Array.
Definition: Objective.cc:171
Data(detail::ModelBase &model)
Constructor.
Definition: Objective.cc:110
std::string getName() const
Get name of variable.
Definition: Objective.cc:60
This class computes a function at a vector.
Definition: Function.hpp:38
This class represents a variable.
Definition: Variable.hpp:36
void addVariable(Variable &variable)
Add a Variable.
Definition: Objective.cc:113
void removeVariable(Variable &variable)
Remove (first, and usually only occurrence of) a Variable.
Definition: Objective.cc:129
double lowerBound
The lower bound of the variable.
Definition: Objective.hpp:190
This class represents an array of Variable objects.
Definition: Array.hpp:45
Objective & operator=(Objective const &objective)
Assignment operator.
Definition: Objective.cc:94
double upperBound
The upper bound of the variable.
Definition: Objective.hpp:194
double constexpr minusInfinity
Negative infinity: use for unbounded variables.
Definition: Var.hpp:34
Objective(detail::ModelBase &model, detail::SharedFunctionPtr function, std::string const &name)
Use this constructor to construct from a SharedFunctionPtr object.
Definition: Objective.cc:28
data name
Definition: Variable.cc:37
Abstract base class for Variable and Array;.
Definition: Var.hpp:49
Struct to contain Constraint data.
Definition: Objective.hpp:173
virtual void summary(std::ostream &ostream=std::cout, std::string const &prefix="") const override
Create a summary of this function.
Definition: Objective.cc:198
This namespace holds all the interior-point optimisation classes.
Definition: Array.hpp:28