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

Last change on this file since 1665 was 1665, checked in by lou, 9 years ago

Add EPL license notice in src.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.0 KB
Line 
1/* $Id: ClpObjective.hpp 1665 2011-01-04 17:55:54Z lou $ */
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//#############################################################################
11class ClpSimplex;
12class ClpModel;
13
14/** Objective Abstract Base Class
15
16Abstract Base Class for describing an objective function
17
18*/
19class ClpObjective  {
20
21public:
22
23     ///@name Stuff
24     //@{
25
26     /** Returns gradient.  If Linear then solution may be NULL,
27         also returns an offset (to be added to current one)
28         If refresh is false then uses last solution
29         Uses model for scaling
30         includeLinear 0 - no, 1 as is, 2 as feasible
31     */
32     virtual double * gradient(const ClpSimplex * model,
33                               const double * solution,
34                               double & offset, bool refresh,
35                               int includeLinear = 2) = 0;
36     /** Returns reduced gradient.Returns an offset (to be added to current one).
37     */
38     virtual double reducedGradient(ClpSimplex * model, double * region,
39                                    bool useFeasibleCosts) = 0;
40     /** Returns step length which gives minimum of objective for
41         solution + theta * change vector up to maximum theta.
42
43         arrays are numberColumns+numberRows
44         Also sets current objective, predicted  and at maximumTheta
45     */
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;
53     /// Return objective value (without any ClpModel offset) (model may be NULL)
54     virtual double objectiveValue(const ClpSimplex * model, const double * solution) const = 0;
55     /// Resize objective
56     virtual void resize(int newNumberColumns) = 0;
57     /// Delete columns in  objective
58     virtual void deleteSome(int numberToDelete, const int * which) = 0;
59     /// Scale objective
60     virtual void reallyScale(const double * columnScale) = 0;
61     /** Given a zeroed array sets nonlinear columns to 1.
62         Returns number of nonlinear columns
63      */
64     virtual int markNonlinear(char * which);
65     /// Say we have new primal solution - so may need to recompute
66     virtual void newXValues() {}
67     //@}
68
69
70     ///@name Constructors and destructors
71     //@{
72     /// Default Constructor
73     ClpObjective();
74
75     /// Copy constructor
76     ClpObjective(const ClpObjective &);
77
78     /// Assignment operator
79     ClpObjective & operator=(const ClpObjective& rhs);
80
81     /// Destructor
82     virtual ~ClpObjective ();
83
84     /// Clone
85     virtual ClpObjective * clone() const = 0;
86     /** Subset clone.  Duplicates are allowed
87         and order is as given.
88         Derived classes need not provide this as it may not always make
89         sense */
90     virtual ClpObjective * subsetClone (int numberColumns,
91                                         const int * whichColumns) const;
92
93     //@}
94
95     ///@name Other
96     //@{
97     /// Returns type (above 63 is extra information)
98     inline int type() {
99          return type_;
100     }
101     /// Whether activated
102     inline int activated() const {
103          return activated_;
104     }
105     /// Set whether activated
106     inline void setActivated(int value) {
107          activated_ = value;
108     }
109
110     /// Objective offset
111     inline double nonlinearOffset () const {
112          return offset_;
113     }
114     //@}
115
116     //---------------------------------------------------------------------------
117
118protected:
119     ///@name Protected member data
120     //@{
121     /// Value of non-linear part of objective
122     double offset_;
123     /// Type of objective - linear is 1
124     int type_;
125     /// Whether activated
126     int activated_;
127     //@}
128};
129
130#endif
Note: See TracBrowser for help on using the repository browser.