source: branches/BSP/trunk/Clp/src/ClpQuadraticObjective.hpp @ 1069

Last change on this file since 1069 was 1055, checked in by forrest, 13 years ago

out };

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.6 KB
Line 
1// Copyright (C) 2003, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#ifndef ClpQuadraticObjective_H
4#define ClpQuadraticObjective_H
5
6#include "ClpObjective.hpp"
7#include "CoinPackedMatrix.hpp"
8
9//#############################################################################
10
11/** Quadratic Objective Class
12
13*/
14
15class ClpQuadraticObjective : public ClpObjective {
16 
17public:
18 
19  ///@name Stuff
20  //@{
21 
22  /** Returns gradient.  If Quadratic then solution may be NULL,
23      also returns an offset (to be added to current one)
24      If refresh is false then uses last solution
25      Uses model for scaling
26      includeLinear 0 - no, 1 as is, 2 as feasible
27  */
28  virtual double * gradient(const ClpSimplex * model,
29                            const double * solution, double & offset,bool refresh,
30                            int includeLinear=2);
31  /// Resize objective
32  /** Returns reduced gradient.Returns an offset (to be added to current one).
33  */
34  virtual double reducedGradient(ClpSimplex * model, double * region,
35                                 bool useFeasibleCosts);
36  /** Returns step length which gives minimum of objective for
37      solution + theta * change vector up to maximum theta.
38
39      arrays are numberColumns+numberRows
40      Also sets current objective, predicted and at maximumTheta
41  */
42  virtual double stepLength(ClpSimplex * model,
43                            const double * solution,
44                            const double * change,
45                            double maximumTheta,
46                            double & currentObj,
47                            double & predictedObj,
48                            double & thetaObj);
49  /// Return objective value (without any ClpModel offset) (model may be NULL)
50  virtual double objectiveValue(const ClpSimplex * model, const double * solution) const ;
51  virtual void resize(int newNumberColumns) ; 
52  /// Delete columns in  objective
53  virtual void deleteSome(int numberToDelete, const int * which) ; 
54  /// Scale objective
55  virtual void reallyScale(const double * columnScale) ;
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 
64  ///@name Constructors and destructors
65  //@{
66  /// Default Constructor
67  ClpQuadraticObjective(); 
68 
69  /// Constructor from objective
70  ClpQuadraticObjective(const double * linearObjective, int numberColumns,
71                        const CoinBigIndex * start,
72                        const int * column, const double * element,
73                        int numberExtendedColumns_=-1);
74 
75  /** Copy constructor .
76      If type is -1 then make sure half symmetric,
77      if +1 then make sure full
78  */
79  ClpQuadraticObjective(const ClpQuadraticObjective & rhs,int type=0);
80  /** Subset constructor.  Duplicates are allowed
81      and order is as given.
82  */
83  ClpQuadraticObjective (const ClpQuadraticObjective &rhs,int numberColumns, 
84                                      const int * whichColumns) ;
85 
86  /// Assignment operator
87  ClpQuadraticObjective & operator=(const ClpQuadraticObjective& rhs);
88 
89  /// Destructor
90  virtual ~ClpQuadraticObjective ();
91
92  /// Clone
93  virtual ClpObjective * clone() const;
94  /** Subset clone.  Duplicates are allowed
95      and order is as given.
96  */
97  virtual ClpObjective * subsetClone (int numberColumns, 
98                                      const int * whichColumns) const;
99 
100  /** Load up quadratic objective.  This is stored as a CoinPackedMatrix */
101  void loadQuadraticObjective(const int numberColumns, 
102                              const CoinBigIndex * start,
103                              const int * column, const double * element,
104                              int numberExtendedColumns=-1);
105  void loadQuadraticObjective (  const CoinPackedMatrix& matrix);
106  /// Get rid of quadratic objective
107  void deleteQuadraticObjective();
108  //@}
109  ///@name Gets and sets
110  //@{
111   /// Quadratic objective
112   inline CoinPackedMatrix * quadraticObjective() const     { return quadraticObjective_; }
113   /// Linear objective
114   inline double * linearObjective() const     { return objective_; }
115  /// Length of linear objective which could be bigger
116  inline int numberExtendedColumns() const
117  {return numberExtendedColumns_;}
118  /// Number of columns in quadratic objective
119  inline int numberColumns() const
120  {return numberColumns_;}
121  /// If a full or half matrix
122  inline bool fullMatrix() const
123  { return fullMatrix_;}
124  //@}
125
126  //---------------------------------------------------------------------------
127 
128private:
129  ///@name Private member data
130  /// Quadratic objective
131  CoinPackedMatrix * quadraticObjective_;
132  /// Objective
133  double * objective_;
134  /// Gradient
135  double * gradient_;
136  /// Useful to have number of columns about
137  int numberColumns_;
138  /// Also length of linear objective which could be bigger
139  int numberExtendedColumns_;
140  /// True if full symmetric matrix, false if half
141  bool fullMatrix_;
142  //@}
143};
144
145#endif
Note: See TracBrowser for help on using the repository browser.