Cbc  2.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ClpObjective.hpp
Go to the documentation of this file.
1 /* $Id: ClpObjective.hpp 1825 2011-11-20 16:02:57Z forrest $ */
2 // Copyright (C) 2002, 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 ClpObjective_H
7 #define ClpObjective_H
8 
9 
10 //#############################################################################
11 class ClpSimplex;
12 class ClpModel;
13 
19 class ClpObjective {
20 
21 public:
22 
24 
25 
32  virtual double * gradient(const ClpSimplex * model,
33  const double * solution,
34  double & offset, bool refresh,
35  int includeLinear = 2) = 0;
38  virtual double reducedGradient(ClpSimplex * model, double * region,
39  bool useFeasibleCosts) = 0;
46  virtual double stepLength(ClpSimplex * model,
47  const double * solution,
48  const double * change,
49  double maximumTheta,
50  double & currentObj,
51  double & predictedObj,
52  double & thetaObj) = 0;
54  virtual double objectiveValue(const ClpSimplex * model, const double * solution) const = 0;
56  virtual void resize(int newNumberColumns) = 0;
58  virtual void deleteSome(int numberToDelete, const int * which) = 0;
60  virtual void reallyScale(const double * columnScale) = 0;
64  virtual int markNonlinear(char * which);
66  virtual void newXValues() {}
68 
69 
71 
72  ClpObjective();
74 
76  ClpObjective(const ClpObjective &);
77 
79  ClpObjective & operator=(const ClpObjective& rhs);
80 
82  virtual ~ClpObjective ();
83 
85  virtual ClpObjective * clone() const = 0;
90  virtual ClpObjective * subsetClone (int numberColumns,
91  const int * whichColumns) const;
92 
94 
96 
97  inline int type() const {
99  return type_;
100  }
102  inline void setType(int value) {
103  type_ = value;
104  }
106  inline int activated() const {
107  return activated_;
108  }
110  inline void setActivated(int value) {
111  activated_ = value;
112  }
113 
115  inline double nonlinearOffset () const {
116  return offset_;
117  }
119 
120  //---------------------------------------------------------------------------
121 
122 protected:
124 
125  double offset_;
128  int type_;
132 };
133 
134 #endif
ClpObjective & operator=(const ClpObjective &rhs)
Assignment operator.
virtual void resize(int newNumberColumns)=0
Resize objective.
virtual ClpObjective * subsetClone(int numberColumns, const int *whichColumns) const
Subset clone.
ClpObjective()
Default Constructor.
virtual void newXValues()
Say we have new primal solution - so may need to recompute.
void setActivated(int value)
Set whether activated.
double offset_
Value of non-linear part of objective.
Objective Abstract Base Class.
virtual ~ClpObjective()
Destructor.
virtual double reducedGradient(ClpSimplex *model, double *region, bool useFeasibleCosts)=0
Returns reduced gradient.Returns an offset (to be added to current one).
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...
int activated_
Whether activated.
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70
void setType(int value)
Sets type (above 63 is extra information)
int type() const
Returns type (above 63 is extra information)
virtual void deleteSome(int numberToDelete, const int *which)=0
Delete columns in objective.
virtual ClpObjective * clone() const =0
Clone.
virtual double objectiveValue(const ClpSimplex *model, const double *solution) const =0
Return objective value (without any ClpModel offset) (model may be NULL)
virtual void reallyScale(const double *columnScale)=0
Scale objective.
double nonlinearOffset() const
Objective offset.
int activated() const
Whether activated.
virtual double * gradient(const ClpSimplex *model, const double *solution, double &offset, bool refresh, int includeLinear=2)=0
Returns gradient.
virtual int markNonlinear(char *which)
Given a zeroed array sets nonlinear columns to 1.
int type_
Type of objective - linear is 1.