Clp  1.17.8
ClpConstraint.hpp
Go to the documentation of this file.
1 /* $Id$ */
2 // Copyright (C) 2007, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef ClpConstraint_H
7 #define ClpConstraint_H
8 
9 //#############################################################################
10 class ClpSimplex;
11 class ClpModel;
12 
19 
20 public:
22 
23 
30  virtual int gradient(const ClpSimplex *model,
31  const double *solution,
32  double *gradient,
33  double &functionValue,
34  double &offset,
35  bool useScaling = false,
36  bool refresh = true) const = 0;
38  virtual double functionValue(const ClpSimplex *model,
39  const double *solution,
40  bool useScaling = false,
41  bool refresh = true) const;
43  virtual void resize(int newNumberColumns) = 0;
45  virtual void deleteSome(int numberToDelete, const int *which) = 0;
47  virtual void reallyScale(const double *columnScale) = 0;
51  virtual int markNonlinear(char *which) const = 0;
55  virtual int markNonzero(char *which) const = 0;
57 
59 
60  ClpConstraint();
62 
65 
68 
70  virtual ~ClpConstraint();
71 
73  virtual ClpConstraint *clone() const = 0;
74 
76 
78 
79  inline int type()
81  {
82  return type_;
83  }
85  inline int rowNumber() const
86  {
87  return rowNumber_;
88  }
89 
91  virtual int numberCoefficients() const = 0;
92 
94  inline double functionValue() const
95  {
96  return functionValue_;
97  }
98 
100  inline double offset() const
101  {
102  return offset_;
103  }
105  virtual void newXValues() {}
107 
108  //---------------------------------------------------------------------------
109 
110 protected:
112 
113  mutable double *lastGradient_;
116  mutable double functionValue_;
118  mutable double offset_;
120  int type_;
124 };
125 
126 #endif
127 
128 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
129 */
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:106
ClpConstraint::operator=
ClpConstraint & operator=(const ClpConstraint &rhs)
Assignment operator.
ClpConstraint::rowNumber_
int rowNumber_
Row number (-1 is objective)
Definition: ClpConstraint.hpp:122
ClpConstraint::reallyScale
virtual void reallyScale(const double *columnScale)=0
Scale constraint.
ClpConstraint::functionValue
double functionValue() const
Stored constraint function value.
Definition: ClpConstraint.hpp:94
ClpConstraint::type
int type()
Returns type, 0 linear, 1 nonlinear.
Definition: ClpConstraint.hpp:80
ClpConstraint::numberCoefficients
virtual int numberCoefficients() const =0
Number of possible coefficients in gradient.
ClpModel
Definition: ClpModel.hpp:38
ClpConstraint::newXValues
virtual void newXValues()
Say we have new primal solution - so may need to recompute.
Definition: ClpConstraint.hpp:105
ClpConstraint::rowNumber
int rowNumber() const
Row number (-1 is objective)
Definition: ClpConstraint.hpp:85
ClpConstraint
Constraint Abstract Base Class.
Definition: ClpConstraint.hpp:18
ClpConstraint::markNonlinear
virtual int markNonlinear(char *which) const =0
Given a zeroed array sets nonlinear columns to 1.
ClpConstraint::offset
double offset() const
Constraint offset.
Definition: ClpConstraint.hpp:100
ClpConstraint::type_
int type_
Type of constraint - linear is 1.
Definition: ClpConstraint.hpp:120
ClpConstraint::gradient
virtual int gradient(const ClpSimplex *model, const double *solution, double *gradient, double &functionValue, double &offset, bool useScaling=false, bool refresh=true) const =0
Fills gradient.
ClpConstraint::~ClpConstraint
virtual ~ClpConstraint()
Destructor.
ClpConstraint::deleteSome
virtual void deleteSome(int numberToDelete, const int *which)=0
Delete columns in constraint.
ClpConstraint::ClpConstraint
ClpConstraint()
Default Constructor.
ClpConstraint::markNonzero
virtual int markNonzero(char *which) const =0
Given a zeroed array sets possible nonzero coefficients to 1.
ClpConstraint::functionValue_
double functionValue_
Value of non-linear part of constraint.
Definition: ClpConstraint.hpp:116
ClpConstraint::clone
virtual ClpConstraint * clone() const =0
Clone.
ClpConstraint::lastGradient_
double * lastGradient_
Gradient at last evaluation.
Definition: ClpConstraint.hpp:114
ClpConstraint::resize
virtual void resize(int newNumberColumns)=0
Resize constraint.
ClpConstraint::offset_
double offset_
Value of offset for constraint.
Definition: ClpConstraint.hpp:118