Clp  1.17.8
ClpObjective.hpp
Go to the documentation of this file.
1 /* $Id$ */
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 class ClpSimplex;
11 class ClpModel;
12 
18 class ClpObjective {
19 
20 public:
22 
23 
30  virtual double *gradient(const ClpSimplex *model,
31  const double *solution,
32  double &offset, bool refresh,
33  int includeLinear = 2)
34  = 0;
37  virtual double reducedGradient(ClpSimplex *model, double *region,
38  bool useFeasibleCosts)
39  = 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)
53  = 0;
55  virtual double objectiveValue(const ClpSimplex *model, const double *solution) const = 0;
57  virtual void resize(int newNumberColumns) = 0;
59  virtual void deleteSome(int numberToDelete, const int *which) = 0;
61  virtual void reallyScale(const double *columnScale) = 0;
65  virtual int markNonlinear(char *which);
67  virtual void newXValues() {}
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  {
100  return type_;
101  }
103  inline void setType(int value)
104  {
105  type_ = value;
106  }
108  inline int activated() const
109  {
110  return activated_;
111  }
113  inline void setActivated(int value)
114  {
115  activated_ = value;
116  }
117 
119  inline double nonlinearOffset() const
120  {
121  return offset_;
122  }
124 
125  //---------------------------------------------------------------------------
126 
127 protected:
129 
130  double offset_;
133  int type_;
137 };
138 
139 #endif
140 
141 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
142 */
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:106
ClpObjective::setType
void setType(int value)
Sets type (above 63 is extra information)
Definition: ClpObjective.hpp:103
ClpObjective::resize
virtual void resize(int newNumberColumns)=0
Resize objective.
ClpObjective::stepLength
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...
ClpObjective::~ClpObjective
virtual ~ClpObjective()
Destructor.
ClpObjective::newXValues
virtual void newXValues()
Say we have new primal solution - so may need to recompute.
Definition: ClpObjective.hpp:67
ClpObjective::activated_
int activated_
Whether activated.
Definition: ClpObjective.hpp:135
ClpObjective
Objective Abstract Base Class.
Definition: ClpObjective.hpp:18
ClpObjective::offset_
double offset_
Value of non-linear part of objective.
Definition: ClpObjective.hpp:131
ClpModel
Definition: ClpModel.hpp:38
ClpObjective::setActivated
void setActivated(int value)
Set whether activated.
Definition: ClpObjective.hpp:113
ClpObjective::type_
int type_
Type of objective - linear is 1.
Definition: ClpObjective.hpp:133
ClpObjective::reducedGradient
virtual double reducedGradient(ClpSimplex *model, double *region, bool useFeasibleCosts)=0
Returns reduced gradient.Returns an offset (to be added to current one).
ClpObjective::nonlinearOffset
double nonlinearOffset() const
Objective offset.
Definition: ClpObjective.hpp:119
ClpObjective::clone
virtual ClpObjective * clone() const =0
Clone.
ClpObjective::activated
int activated() const
Whether activated.
Definition: ClpObjective.hpp:108
ClpObjective::deleteSome
virtual void deleteSome(int numberToDelete, const int *which)=0
Delete columns in objective.
ClpObjective::ClpObjective
ClpObjective()
Default Constructor.
ClpObjective::operator=
ClpObjective & operator=(const ClpObjective &rhs)
Assignment operator.
ClpObjective::type
int type() const
Returns type (above 63 is extra information)
Definition: ClpObjective.hpp:98
ClpObjective::subsetClone
virtual ClpObjective * subsetClone(int numberColumns, const int *whichColumns) const
Subset clone.
ClpObjective::reallyScale
virtual void reallyScale(const double *columnScale)=0
Scale objective.
ClpObjective::gradient
virtual double * gradient(const ClpSimplex *model, const double *solution, double &offset, bool refresh, int includeLinear=2)=0
Returns gradient.
ClpObjective::markNonlinear
virtual int markNonlinear(char *which)
Given a zeroed array sets nonlinear columns to 1.
ClpObjective::objectiveValue
virtual double objectiveValue(const ClpSimplex *model, const double *solution) const =0
Return objective value (without any ClpModel offset) (model may be NULL)