source: trunk/Clp/src/ClpObjective.hpp @ 754

Last change on this file since 754 was 754, checked in by andreasw, 14 years ago

first version

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1// Copyright (C) 2002, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#ifndef ClpObjective_H
4#define ClpObjective_H
5
6
7//#############################################################################
8class ClpSimplex;
9class ClpModel;
10
11/** Objective Abstract Base Class
12
13Abstract Base Class for describing an objective function
14
15*/
16class ClpObjective  {
17 
18public:
19 
20  ///@name Stuff
21  //@{
22 
23  /** Returns gradient.  If Linear then solution may be NULL,
24      also returns an offset (to be added to current one)
25      If refresh is false then uses last solution
26      Uses model for scaling
27      includeLinear 0 - no, 1 as is, 2 as feasible
28  */
29  virtual double * gradient(const ClpSimplex * model,
30                            const double * solution,
31                            double & offset,bool refresh,
32                            int includeLinear=2)=0;
33  /** Returns reduced gradient.Returns an offset (to be added to current one).
34  */
35  virtual double reducedGradient(ClpSimplex * model, double * region,
36                                 bool useFeasibleCosts)=0;
37  /** Returns step length which gives minimum of objective for
38      solution + theta * change vector up to maximum theta.
39
40      arrays are numberColumns+numberRows
41      Also sets current objective, predicted  and at maximumTheta
42  */
43  virtual double stepLength(ClpSimplex * model,
44                            const double * solution,
45                            const double * change,
46                            double maximumTheta,
47                            double & currentObj,
48                            double & predictedObj,
49                            double & thetaObj)=0;
50  /// Resize objective
51  virtual void resize(int newNumberColumns) = 0; 
52  /// Delete columns in  objective
53  virtual void deleteSome(int numberToDelete, const int * which) = 0; 
54  /// Scale objective
55  virtual void reallyScale(const double * columnScale) =0;
56  /** Given a zeroed array sets nonlinear columns to 1.
57      Returns number of nonlinear columns
58   */
59  virtual int markNonlinear(char * which);
60  //@}
61 
62 
63  ///@name Constructors and destructors
64  //@{
65  /// Default Constructor
66  ClpObjective(); 
67 
68  /// Copy constructor
69  ClpObjective(const ClpObjective &);
70 
71  /// Assignment operator
72  ClpObjective & operator=(const ClpObjective& rhs);
73 
74  /// Destructor
75  virtual ~ClpObjective ();
76
77  /// Clone
78  virtual ClpObjective * clone() const = 0;
79  /** Subset clone.  Duplicates are allowed
80      and order is as given.
81      Derived classes need not provide this as it may not always make
82      sense */
83  virtual ClpObjective * subsetClone (int numberColumns, 
84                                      const int * whichColumns) const;
85 
86  //@}
87
88  ///@name Other
89  //@{
90  /// Returns type (above 63 is extra information)
91  inline int type()
92  { return type_;};
93  /// Whether activated
94  inline int activated() const
95  {return activated_;};
96  /// Set whether activated
97  inline void setActivated(int value)
98  {activated_=value;};
99 
100  /// Objective offset
101  inline double nonlinearOffset () const
102  { return offset_;};
103  //@}
104
105  //---------------------------------------------------------------------------
106 
107protected:
108  ///@name Protected member data
109  //@{
110  /// Value of non-linear part of objective
111  double offset_;
112  /// Type of objective - linear is 1
113  int type_;
114  /// Whether activated
115  int activated_;
116  //@}
117};
118
119#endif
Note: See TracBrowser for help on using the repository browser.