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

Last change on this file since 2030 was 1825, checked in by forrest, 8 years ago

stuff to allow more event handling

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.1 KB
RevLine 
[1370]1/* $Id: ClpObjective.hpp 1825 2011-11-20 16:02:57Z forrest $ */
[124]2// Copyright (C) 2002, International Business Machines
3// Corporation and others.  All Rights Reserved.
[1665]4// This code is licensed under the terms of the Eclipse Public License (EPL).
5
[124]6#ifndef ClpObjective_H
7#define ClpObjective_H
8
9
10//#############################################################################
[440]11class ClpSimplex;
12class ClpModel;
[124]13
14/** Objective Abstract Base Class
15
16Abstract Base Class for describing an objective function
17
18*/
19class ClpObjective  {
[1502]20
[124]21public:
[393]22
[1525]23     ///@name Stuff
24     //@{
[124]25
[1525]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.
[124]42
[1525]43         arrays are numberColumns+numberRows
44         Also sets current objective, predicted  and at maximumTheta
[1502]45     */
[1525]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     //@}
[124]68
[1502]69
[1525]70     ///@name Constructors and destructors
71     //@{
72     /// Default Constructor
73     ClpObjective();
[1502]74
[1525]75     /// Copy constructor
76     ClpObjective(const ClpObjective &);
[1502]77
[1525]78     /// Assignment operator
79     ClpObjective & operator=(const ClpObjective& rhs);
[1502]80
[1525]81     /// Destructor
82     virtual ~ClpObjective ();
[1502]83
[1525]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;
[1502]92
[1525]93     //@}
[1502]94
[1525]95     ///@name Other
96     //@{
97     /// Returns type (above 63 is extra information)
[1825]98     inline int type() const {
[1525]99          return type_;
100     }
[1825]101     /// Sets type (above 63 is extra information)
102     inline void setType(int value) {
103          type_ = value;
104     }
[1525]105     /// Whether activated
106     inline int activated() const {
107          return activated_;
108     }
109     /// Set whether activated
110     inline void setActivated(int value) {
111          activated_ = value;
112     }
[1502]113
[1525]114     /// Objective offset
115     inline double nonlinearOffset () const {
116          return offset_;
117     }
118     //@}
[1502]119
[1525]120     //---------------------------------------------------------------------------
[1502]121
[124]122protected:
[1525]123     ///@name Protected member data
124     //@{
125     /// Value of non-linear part of objective
126     double offset_;
127     /// Type of objective - linear is 1
128     int type_;
129     /// Whether activated
130     int activated_;
131     //@}
[124]132};
133
134#endif
Note: See TracBrowser for help on using the repository browser.