Changeset 2385 for trunk/Clp/src/ClpConstraint.hpp
 Timestamp:
 Jan 6, 2019 2:43:06 PM (4 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Clp/src/ClpConstraint.hpp
r1665 r2385 6 6 #ifndef ClpConstraint_H 7 7 #define ClpConstraint_H 8 9 8 10 9 //############################################################################# … … 17 16 18 17 */ 19 class ClpConstraint 18 class ClpConstraint { 20 19 21 20 public: 21 ///@name Stuff 22 //@{ 22 23 23 ///@name Stuff 24 //@{ 25 26 /** Fills gradient. If Linear then solution may be NULL, 24 /** Fills gradient. If Linear then solution may be NULL, 27 25 also returns true value of function and offset so we can use x not deltaX in constraint 28 26 If refresh is false then uses last solution … … 30 28 Returns nonzero if gradient undefined at current solution 31 29 */ 32 virtual int gradient(const ClpSimplex *model,33 const double *solution,34 double *gradient,35 double & functionValue,36 double &offset,37 38 39 40 virtual double functionValue (const ClpSimplex *model,41 const double *solution,42 43 bool refresh = true) const;44 45 46 47 virtual void deleteSome(int numberToDelete, const int *which) = 0;48 49 virtual void reallyScale(const double *columnScale) = 0;50 30 virtual int gradient(const ClpSimplex *model, 31 const double *solution, 32 double *gradient, 33 double &functionValue, 34 double &offset, 35 bool useScaling = false, 36 bool refresh = true) const = 0; 37 /// Constraint function value 38 virtual double functionValue(const ClpSimplex *model, 39 const double *solution, 40 bool useScaling = false, 41 bool refresh = true) const; 42 /// Resize constraint 43 virtual void resize(int newNumberColumns) = 0; 44 /// Delete columns in constraint 45 virtual void deleteSome(int numberToDelete, const int *which) = 0; 46 /// Scale constraint 47 virtual void reallyScale(const double *columnScale) = 0; 48 /** Given a zeroed array sets nonlinear columns to 1. 51 49 Returns number of nonlinear columns 52 50 */ 53 virtual int markNonlinear(char *which) const = 0;54 51 virtual int markNonlinear(char *which) const = 0; 52 /** Given a zeroed array sets possible nonzero coefficients to 1. 55 53 Returns number of nonzeros 56 54 */ 57 virtual int markNonzero(char *which) const = 0;58 55 virtual int markNonzero(char *which) const = 0; 56 //@} 59 57 58 ///@name Constructors and destructors 59 //@{ 60 /// Default Constructor 61 ClpConstraint(); 60 62 61 ///@name Constructors and destructors 62 //@{ 63 /// Default Constructor 64 ClpConstraint(); 63 /// Copy constructor 64 ClpConstraint(const ClpConstraint &); 65 65 66 /// Copy constructor67 ClpConstraint(const ClpConstraint &);66 /// Assignment operator 67 ClpConstraint &operator=(const ClpConstraint &rhs); 68 68 69 /// Assignment operator70 ClpConstraint & operator=(const ClpConstraint& rhs);69 /// Destructor 70 virtual ~ClpConstraint(); 71 71 72 /// Destructor73 virtual ~ClpConstraint ();72 /// Clone 73 virtual ClpConstraint *clone() const = 0; 74 74 75 /// Clone 76 virtual ClpConstraint * clone() const = 0; 75 //@} 77 76 78 //@} 77 ///@name Other 78 //@{ 79 /// Returns type, 0 linear, 1 nonlinear 80 inline int type() 81 { 82 return type_; 83 } 84 /// Row number (1 is objective) 85 inline int rowNumber() const 86 { 87 return rowNumber_; 88 } 79 89 80 ///@name Other 81 //@{ 82 /// Returns type, 0 linear, 1 nonlinear 83 inline int type() { 84 return type_; 85 } 86 /// Row number (1 is objective) 87 inline int rowNumber() const { 88 return rowNumber_; 89 } 90 /// Number of possible coefficients in gradient 91 virtual int numberCoefficients() const = 0; 90 92 91 /// Number of possible coefficients in gradient 92 virtual int numberCoefficients() const = 0; 93 /// Stored constraint function value 94 inline double functionValue() const 95 { 96 return functionValue_; 97 } 93 98 94 /// Stored constraint function value 95 inline double functionValue () const { 96 return functionValue_; 97 } 99 /// Constraint offset 100 inline double offset() const 101 { 102 return offset_; 103 } 104 /// Say we have new primal solution  so may need to recompute 105 virtual void newXValues() {} 106 //@} 98 107 99 /// Constraint offset 100 inline double offset () const { 101 return offset_; 102 } 103 /// Say we have new primal solution  so may need to recompute 104 virtual void newXValues() {} 105 //@} 106 107 // 108 // 108 109 109 110 protected: 110 111 112 113 mutable double *lastGradient_;114 115 116 117 118 119 120 121 122 111 ///@name Protected member data 112 //@{ 113 /// Gradient at last evaluation 114 mutable double *lastGradient_; 115 /// Value of nonlinear part of constraint 116 mutable double functionValue_; 117 /// Value of offset for constraint 118 mutable double offset_; 119 /// Type of constraint  linear is 1 120 int type_; 121 /// Row number (1 is objective) 122 int rowNumber_; 123 //@} 123 124 }; 124 125 125 126 #endif 127 128 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2 129 */
Note: See TracChangeset
for help on using the changeset viewer.