ClpConstraint.hpp
Go to the documentation of this file.
1 /* $Id: ClpConstraint.hpp 1665 2011-01-04 17:55:54Z lou $ */
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 //#############################################################################
11 class ClpSimplex;
12 class ClpModel;
13 
20 
21 public:
22 
24 
25 
32  virtual int gradient(const ClpSimplex * model,
33  const double * solution,
34  double * gradient,
35  double & functionValue ,
36  double & offset,
37  bool useScaling = false,
38  bool refresh = true) const = 0;
40  virtual double functionValue (const ClpSimplex * model,
41  const double * solution,
42  bool useScaling = false,
43  bool refresh = true) const ;
45  virtual void resize(int newNumberColumns) = 0;
47  virtual void deleteSome(int numberToDelete, const int * which) = 0;
49  virtual void reallyScale(const double * columnScale) = 0;
53  virtual int markNonlinear(char * which) const = 0;
57  virtual int markNonzero(char * which) const = 0;
59 
60 
62 
63  ClpConstraint();
65 
68 
71 
73  virtual ~ClpConstraint ();
74 
76  virtual ClpConstraint * clone() const = 0;
77 
79 
81 
82  inline int type() {
84  return type_;
85  }
87  inline int rowNumber() const {
88  return rowNumber_;
89  }
90 
92  virtual int numberCoefficients() const = 0;
93 
95  inline double functionValue () const {
96  return functionValue_;
97  }
98 
100  inline double offset () const {
101  return offset_;
102  }
104  virtual void newXValues() {}
106 
107  //---------------------------------------------------------------------------
108 
109 protected:
111 
112  mutable double * lastGradient_;
115  mutable double functionValue_;
117  mutable double offset_;
119  int type_;
123 };
124 
125 #endif
double * lastGradient_
Gradient at last evaluation.
double offset_
Value of offset for constraint.
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()
Default Constructor.
int type_
Type of constraint - linear is 1.
Constraint Abstract Base Class.
virtual void reallyScale(const double *columnScale)=0
Scale constraint.
virtual void resize(int newNumberColumns)=0
Resize constraint.
virtual ~ClpConstraint()
Destructor.
int rowNumber_
Row number (-1 is objective)
virtual int numberCoefficients() const =0
Number of possible coefficients in gradient.
virtual void deleteSome(int numberToDelete, const int *which)=0
Delete columns in constraint.
virtual int markNonlinear(char *which) const =0
Given a zeroed array sets nonlinear columns to 1.
virtual int markNonzero(char *which) const =0
Given a zeroed array sets possible nonzero coefficients to 1.
ClpConstraint & operator=(const ClpConstraint &rhs)
Assignment operator.
int rowNumber() const
Row number (-1 is objective)
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70
double offset() const
Constraint offset.
int type()
Returns type, 0 linear, 1 nonlinear.
double functionValue() const
Stored constraint function value.
virtual ClpConstraint * clone() const =0
Clone.
double functionValue_
Value of non-linear part of constraint.
virtual void newXValues()
Say we have new primal solution - so may need to recompute.