ClpObjective.hpp
Go to the documentation of this file.
1 /* $Id: ClpObjective.hpp 1525 2010-02-26 17:27:59Z mjs $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 #ifndef ClpObjective_H
5 #define ClpObjective_H
6 
7 
8 //#############################################################################
9 class ClpSimplex;
10 class ClpModel;
11 
17 class ClpObjective {
18 
19 public:
20 
22 
23 
30  virtual double * gradient(const ClpSimplex * model,
31  const double * solution,
32  double & offset, bool refresh,
33  int includeLinear = 2) = 0;
36  virtual double reducedGradient(ClpSimplex * model, double * region,
37  bool useFeasibleCosts) = 0;
44  virtual double stepLength(ClpSimplex * model,
45  const double * solution,
46  const double * change,
47  double maximumTheta,
48  double & currentObj,
49  double & predictedObj,
50  double & thetaObj) = 0;
52  virtual double objectiveValue(const ClpSimplex * model, const double * solution) const = 0;
54  virtual void resize(int newNumberColumns) = 0;
56  virtual void deleteSome(int numberToDelete, const int * which) = 0;
58  virtual void reallyScale(const double * columnScale) = 0;
62  virtual int markNonlinear(char * which);
64  virtual void newXValues() {}
66 
67 
69 
70  ClpObjective();
72 
74  ClpObjective(const ClpObjective &);
75 
77  ClpObjective & operator=(const ClpObjective& rhs);
78 
80  virtual ~ClpObjective ();
81 
83  virtual ClpObjective * clone() const = 0;
88  virtual ClpObjective * subsetClone (int numberColumns,
89  const int * whichColumns) const;
90 
92 
94 
95  inline int type() {
97  return type_;
98  }
100  inline int activated() const {
101  return activated_;
102  }
104  inline void setActivated(int value) {
105  activated_ = value;
106  }
107 
109  inline double nonlinearOffset () const {
110  return offset_;
111  }
113 
114  //---------------------------------------------------------------------------
115 
116 protected:
118 
119  double offset_;
122  int type_;
126 };
127 
128 #endif
virtual ClpObjective * clone() const =0
Clone.
virtual void newXValues()
Say we have new primal solution - so may need to recompute.
virtual ~ClpObjective()
Destructor.
int type_
Type of objective - linear is 1.
virtual void deleteSome(int numberToDelete, const int *which)=0
Delete columns in objective.
double nonlinearOffset() const
Objective offset.
int activated_
Whether activated.
Objective Abstract Base Class.
virtual double stepLength(ClpSimplex *model, const double *solution, const double *change, double maximumTheta, double &currentObj, double &predictedObj, double &thetaObj)=0
Returns step length which gives minimum of objective for solution + theta * change vector up to maxim...
virtual void reallyScale(const double *columnScale)=0
Scale objective.
virtual double * gradient(const ClpSimplex *model, const double *solution, double &offset, bool refresh, int includeLinear=2)=0
Returns gradient.
virtual double objectiveValue(const ClpSimplex *model, const double *solution) const =0
Return objective value (without any ClpModel offset) (model may be NULL)
virtual void resize(int newNumberColumns)=0
Resize objective.
virtual ClpObjective * subsetClone(int numberColumns, const int *whichColumns) const
Subset clone.
virtual int markNonlinear(char *which)
Given a zeroed array sets nonlinear columns to 1.
double offset_
Value of non-linear part of objective.
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:49
void setActivated(int value)
Set whether activated.
virtual double reducedGradient(ClpSimplex *model, double *region, bool useFeasibleCosts)=0
Returns reduced gradient.Returns an offset (to be added to current one).
ClpObjective & operator=(const ClpObjective &rhs)
Assignment operator.
int activated() const
Whether activated.
ClpObjective()
Default Constructor.
int type()
Returns type (above 63 is extra information)