Interior-point-optimisation  1.0-1
Interior-pointoptimisationlibrary
LinearConstraint.hpp
Go to the documentation of this file.
1 /*
2  * $Id: LinearConstraint.hpp 133 2013-06-26 19:01:09Z jdl3 $
3  * Copyright (C) 2013 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_LINEARCONSTRAINT_HPP
21 #define IPO_LINEARCONSTRAINT_HPP
22 
23 #include"Constraint.hpp"
24 #include"Model.hpp"
25 #include"../ipo_function/concrete/LinearCombination.hpp"
26 
27 namespace ipo {
48  class LinearConstraint : public Constraint {
49  public:
56  LinearConstraint ( detail::ModelBase& model, std::string const& name );
63  LinearConstraint( detail::ModelBase& model, char const* const name );
70  void setCoefficient( Variable const& variable, double const value );
77  double getCoefficient( Variable const& variable ) const;
83  void setCoefficients( gsl::vector const& vector );
89  gsl::vector const& getCoefficients() const;
95  virtual::ipo_function::Function* getFunction();
101  void setValue( double const value );
108  virtual void setUpperBound( double const upperBound );
115  virtual void setLowerBound( double const lowerBound );
120  bool isEqualityConstraint() const;
121  };
122 }
123 
124 #endif
void setValue(double const value)
Set value of Constraint.
virtual void setUpperBound(double const upperBound)
Set upper bound of Constraint.
double getCoefficient(Variable const &variable) const
Get the coefficient of variable.
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
bool isEqualityConstraint() const
Find if this is an equality constraint (upperBound = lowerBound).
void setCoefficients(gsl::vector const &vector)
Set all the coefficients of this LinearConstraint.
Class to represent a linear combination as an Objective or Constraint.
virtual void setLowerBound(double const lowerBound)
Set lower bound of Constraint.
Class for a constraint function.
Definition: Constraint.hpp:40
LinearConstraint(detail::ModelBase &model, std::string const &name)
The constructor creates a new object with no variables.
Abstract base class for model.
Definition: Var.hpp:39
double value() const noexcept
Value of the objective function at the current value of the variables.
Definition: Objective.cc:209
This class represents a variable.
Definition: Variable.hpp:36
void setCoefficient(Variable const &variable, double const value)
Set the coefficient of variable.
data lowerBound
Definition: Variable.cc:39
data name
Definition: Variable.cc:37
data upperBound
Definition: Variable.cc:38
virtual ::ipo_function::Function * getFunction()
Get function.
gsl::vector const & getCoefficients() const
Get all the coefficients of this LinearConstraint.
This namespace holds all the interior-point optimisation classes.
Definition: Array.hpp:28