ClpConstraint.hpp
Go to the documentation of this file.
1 /* $Id: ClpConstraint.hpp 1525 2010-02-26 17:27:59Z mjs $ */
2 // Copyright (C) 2007, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 #ifndef ClpConstraint_H
5 #define ClpConstraint_H
6 
7 
8 //#############################################################################
9 class ClpSimplex;
10 class ClpModel;
11 
18 
19 public:
20 
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 
58 
60 
61  ClpConstraint();
63 
66 
69 
71  virtual ~ClpConstraint ();
72 
74  virtual ClpConstraint * clone() const = 0;
75 
77 
79 
80  inline int type() {
82  return type_;
83  }
85  inline int rowNumber() const {
86  return rowNumber_;
87  }
88 
90  virtual int numberCoefficients() const = 0;
91 
93  inline double functionValue () const {
94  return functionValue_;
95  }
96 
98  inline double offset () const {
99  return offset_;
100  }
102  virtual void newXValues() {}
104 
105  //---------------------------------------------------------------------------
106 
107 protected:
109 
110  mutable double * lastGradient_;
113  mutable double functionValue_;
115  mutable double offset_;
117  int type_;
121 };
122 
123 #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:49
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.