ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/NLModel.hpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/NLModel.hpp (file contents):
Revision 1010 by tim, Tue Feb 3 20:43:08 2004 UTC vs.
Revision 1015 by tim, Tue Feb 3 22:54:52 2004 UTC

# Line 24 | Line 24 | class NLModel{
24      virtual ~NLModel() {  if (constraints != NULL) delete constraints;}
25  
26      virtual void setX(const vector<double>& x)= 0;
27 +    virtual vector<double> getX() = 0;
28  
29 +    virtual void setF(double f) = 0;
30 +    virtual double getF() = 0;
31 +
32      virtual int  getDim() {return ndim;}
33  
34      bool hasConstraints() {  return constraints == NULL ? false : true;}
# Line 68 | Line 72 | class NLModel0 : public NLModel{
72      NLModel0(int dim,  ConstraintList* cons = NULL);
73      ~NLModel0() {}
74  
75 <    virtual void setX(const vector<double>& x);
75 >    virtual void setX(const vector<double>& x) {currentX = x;}
76 >    vector<double>  getX() {return currentX;}
77  
78 +    void setF(double f) {currentF = f;}
79 +    double getF() {return currentF;}
80 +
81      //Using finite difference methods to approximate the gradient
82      //It is inappropriate to apply these methods in large scale problem
83      
# Line 80 | Line 88 | class NLModel0 : public NLModel{
88      //Using finite difference methods to approximate the hessian
89      //It is inappropriate to apply this method in large scale problem
90      //virtual SymMatrix FiniteHessian(vector<double>& x, double fx, vector<double>& h);
91 <
91 >    SymMatrix FiniteHessian(vector<double>& x, double fx, vector<double>& h);
92    protected:
93  
94      FDType fdType;
# Line 98 | Line 106 | class ConcreteNLMode0 : public NLModel0{
106      ConcreteNLMode0(int dim, ConstraintList* cons = NULL);
107  
108      virtual double calcF();
109 <    virtual double calcF(const vector<double>& x);
109 >    virtual double calcF(vector<double>& x);
110      virtual vector<double> calcGrad();
111      virtual vector<double> calcGrad(vector<double>& x);
112      virtual SymMatrix calcHessian() ;
# Line 118 | Line 126 | class NLModel1 : public NLModel0{
126      //Using finite difference methods to approximate the hessian
127      //It is inappropriate to apply this method in large scale problem    
128      virtual SymMatrix FiniteHessian(vector<double>& x, vector<double>& h);
129 <    
129 >
130 >    void setGrad(vector<double>& grad) {currentGrad = grad;}
131 >    vector<double> getGrad() {return currentGrad;}
132    protected:
133  
134      vector<double> currentGrad;
# Line 133 | Line 143 | class ConcreteNLMode1 : NLModel1{
143      ConcreteNLMode1(int dim, ConstraintList* cons = NULL);
144      
145      virtual double calcF();
146 <    virtual double calcF(const vector<double>& x);
146 >    virtual double calcF(vector<double>& x);
147      virtual vector<double> calcGrad();
148 <    virtual vector<double> calcGrad(const vector<double>& x);
148 >    virtual vector<double> calcGrad( vector<double>& x);
149      virtual SymMatrix calcHessian() ;
150      virtual SymMatrix calcHessian(vector<double>& x) ;
151  
# Line 162 | Line 172 | class ConcreteNLModel2 : public NLModel2{
172      ConcreteNLModel2(int dim, ConstraintList* cons = NULL);
173      
174      virtual double calcF();
175 <    virtual double calcF(const vector<double>& x);
175 >    virtual double calcF(vector<double>& x);
176      virtual vector<double> calcGrad();
177      virtual vector<double> calcGrad(vector<double>& x);
178      virtual SymMatrix calcHessian() ;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines