Clp trunk
|
00001 /* $Id$ */ 00002 // Copyright (C) 2007, 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 ClpConstraint_H 00007 #define ClpConstraint_H 00008 00009 00010 //############################################################################# 00011 class ClpSimplex; 00012 class ClpModel; 00013 00019 class ClpConstraint { 00020 00021 public: 00022 00024 00025 00032 virtual int gradient(const ClpSimplex * model, 00033 const double * solution, 00034 double * gradient, 00035 double & functionValue , 00036 double & offset, 00037 bool useScaling = false, 00038 bool refresh = true) const = 0; 00040 virtual double functionValue (const ClpSimplex * model, 00041 const double * solution, 00042 bool useScaling = false, 00043 bool refresh = true) const ; 00045 virtual void resize(int newNumberColumns) = 0; 00047 virtual void deleteSome(int numberToDelete, const int * which) = 0; 00049 virtual void reallyScale(const double * columnScale) = 0; 00053 virtual int markNonlinear(char * which) const = 0; 00057 virtual int markNonzero(char * which) const = 0; 00059 00060 00062 00063 00064 ClpConstraint(); 00065 00067 ClpConstraint(const ClpConstraint &); 00068 00070 ClpConstraint & operator=(const ClpConstraint& rhs); 00071 00073 virtual ~ClpConstraint (); 00074 00076 virtual ClpConstraint * clone() const = 0; 00077 00079 00081 00082 00083 inline int type() { 00084 return type_; 00085 } 00087 inline int rowNumber() const { 00088 return rowNumber_; 00089 } 00090 00092 virtual int numberCoefficients() const = 0; 00093 00095 inline double functionValue () const { 00096 return functionValue_; 00097 } 00098 00100 inline double offset () const { 00101 return offset_; 00102 } 00104 virtual void newXValues() {} 00106 00107 //--------------------------------------------------------------------------- 00108 00109 protected: 00111 00112 00113 mutable double * lastGradient_; 00115 mutable double functionValue_; 00117 mutable double offset_; 00119 int type_; 00121 int rowNumber_; 00123 }; 00124 00125 #endif