Clp trunk
|
00001 /* $Id$ */ 00002 // Copyright (C) 2003, International Business Machines 00003 // Corporation and others. All Rights Reserved. 00004 // This code is licensed under the terms of the Eclipse Public License (EPL). 00005 00006 #ifndef ClpQuadraticObjective_H 00007 #define ClpQuadraticObjective_H 00008 00009 #include "ClpObjective.hpp" 00010 #include "CoinPackedMatrix.hpp" 00011 00012 //############################################################################# 00013 00018 class ClpQuadraticObjective : public ClpObjective { 00019 00020 public: 00021 00023 00024 00031 virtual double * gradient(const ClpSimplex * model, 00032 const double * solution, double & offset, bool refresh, 00033 int includeLinear = 2); 00035 00037 virtual double reducedGradient(ClpSimplex * model, double * region, 00038 bool useFeasibleCosts); 00045 virtual double stepLength(ClpSimplex * model, 00046 const double * solution, 00047 const double * change, 00048 double maximumTheta, 00049 double & currentObj, 00050 double & predictedObj, 00051 double & thetaObj); 00053 virtual double objectiveValue(const ClpSimplex * model, const double * solution) const ; 00054 virtual void resize(int newNumberColumns) ; 00056 virtual void deleteSome(int numberToDelete, const int * which) ; 00058 virtual void reallyScale(const double * columnScale) ; 00062 virtual int markNonlinear(char * which); 00063 00065 00066 00068 00069 00070 ClpQuadraticObjective(); 00071 00073 ClpQuadraticObjective(const double * linearObjective, int numberColumns, 00074 const CoinBigIndex * start, 00075 const int * column, const double * element, 00076 int numberExtendedColumns_ = -1); 00077 00082 ClpQuadraticObjective(const ClpQuadraticObjective & rhs, int type = 0); 00086 ClpQuadraticObjective (const ClpQuadraticObjective &rhs, int numberColumns, 00087 const int * whichColumns) ; 00088 00090 ClpQuadraticObjective & operator=(const ClpQuadraticObjective& rhs); 00091 00093 virtual ~ClpQuadraticObjective (); 00094 00096 virtual ClpObjective * clone() const; 00100 virtual ClpObjective * subsetClone (int numberColumns, 00101 const int * whichColumns) const; 00102 00104 void loadQuadraticObjective(const int numberColumns, 00105 const CoinBigIndex * start, 00106 const int * column, const double * element, 00107 int numberExtendedColumns = -1); 00108 void loadQuadraticObjective ( const CoinPackedMatrix& matrix); 00110 void deleteQuadraticObjective(); 00112 00113 00114 00115 inline CoinPackedMatrix * quadraticObjective() const { 00116 return quadraticObjective_; 00117 } 00119 inline double * linearObjective() const { 00120 return objective_; 00121 } 00123 inline int numberExtendedColumns() const { 00124 return numberExtendedColumns_; 00125 } 00127 inline int numberColumns() const { 00128 return numberColumns_; 00129 } 00131 inline bool fullMatrix() const { 00132 return fullMatrix_; 00133 } 00135 00136 //--------------------------------------------------------------------------- 00137 00138 private: 00141 CoinPackedMatrix * quadraticObjective_; 00143 double * objective_; 00145 double * gradient_; 00147 int numberColumns_; 00149 int numberExtendedColumns_; 00151 bool fullMatrix_; 00153 }; 00154 00155 #endif