Interior-point-optimisation  1.0-1
Interior-pointoptimisationlibrary
Var.hpp
Go to the documentation of this file.
1 /*
2  * $Id: Var.hpp 186 2014-10-22 09:25:06Z 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_DETAIL_VAR_HPP
21 #define IPO_DETAIL_VAR_HPP
22 
23 #include<limits>
24 #include"../IPOException.hpp"
25 
26 namespace ipo {
35  namespace detail {
39  class ModelBase {
40  public:
44  virtual void notify() = 0;
45  };
49  class Var {
50  public:
56  Var( ModelBase& model );
60  virtual ~Var() = 0;
65  Var( Var& var ) : model( var.model ){}
72  Var& operator=( Var& var );
77  Var( Var&& var ) : model( var.model ){}
84  Var& operator=( Var&& var );
88  ModelBase const* const getModel() const { return &model; }
95  virtual void summary( std::ostream& ostream = std::cout,
96  std::string const& prefix = "" ) const = 0;
97  protected:
102  };
103  }
104 }
105 
106 #endif
Var(ModelBase &model)
Constructor needs a model so that variable can only be attached to one model.
Definition: Var.cc:28
virtual ~Var()=0
Virtual destructor to make class abstract.
Definition: Var.cc:30
double constexpr infinity
Infinity: use for unbounded variables.
Definition: Var.hpp:30
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
Abstract base class for model.
Definition: Var.hpp:39
Var(Var &var)
Copy constructor.
Definition: Var.hpp:65
Var(Var &&var)
Move constructor.
Definition: Var.hpp:77
Var & operator=(Var &var)
Copy assignment operator.
Definition: Var.cc:40
virtual void notify()=0
Notify function that model must implement.
double constexpr minusInfinity
Negative infinity: use for unbounded variables.
Definition: Var.hpp:34
ModelBase const *const getModel() const
Get pointer to model.
Definition: Var.hpp:88
Abstract base class for Variable and Array;.
Definition: Var.hpp:49
virtual void summary(std::ostream &ostream=std::cout, std::string const &prefix="") const =0
Create a summary of this object.
This namespace holds all the interior-point optimisation classes.
Definition: Array.hpp:28