Cbc  2.10.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ClpConstraint.hpp
Go to the documentation of this file.
1 /* $Id: ClpConstraint.hpp 2385 2019-01-06 19:43:06Z unxusr $ */
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 */
double offset() const
Constraint offset.
virtual ClpConstraint * clone() const =0
Clone.
int rowNumber_
Row number (-1 is objective)
ClpConstraint & operator=(const ClpConstraint &rhs)
Assignment operator.
Constraint Abstract Base Class.
int type()
Returns type, 0 linear, 1 nonlinear.
virtual int markNonzero(char *which) const =0
Given a zeroed array sets possible nonzero coefficients to 1.
virtual void deleteSome(int numberToDelete, const int *which)=0
Delete columns in constraint.
virtual void newXValues()
Say we have new primal solution - so may need to recompute.
virtual int markNonlinear(char *which) const =0
Given a zeroed array sets nonlinear columns to 1.
double functionValue() const
Stored constraint function value.
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.
double functionValue_
Value of non-linear part of constraint.
ClpConstraint()
Default Constructor.
virtual ~ClpConstraint()
Destructor.
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:106
double offset_
Value of offset for constraint.
int type_
Type of constraint - linear is 1.
int rowNumber() const
Row number (-1 is objective)
virtual void resize(int newNumberColumns)=0
Resize constraint.
virtual int numberCoefficients() const =0
Number of possible coefficients in gradient.
virtual void reallyScale(const double *columnScale)=0
Scale constraint.
double * lastGradient_
Gradient at last evaluation.