|
||||
File indexing completed on 2025-01-18 10:04:15
0001 // Created on: 1991-05-14 0002 // Created by: Laurent PAINNOT 0003 // Copyright (c) 1991-1999 Matra Datavision 0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0005 // 0006 // This file is part of Open CASCADE Technology software library. 0007 // 0008 // This library is free software; you can redistribute it and/or modify it under 0009 // the terms of the GNU Lesser General Public License version 2.1 as published 0010 // by the Free Software Foundation, with special exception defined in the file 0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0012 // distribution for complete text of the license and disclaimer of any warranty. 0013 // 0014 // Alternatively, this file may be used under the terms of Open CASCADE 0015 // commercial license or contractual agreement. 0016 0017 #ifndef _math_Powell_HeaderFile 0018 #define _math_Powell_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 0023 #include <math_Vector.hxx> 0024 #include <Standard_Integer.hxx> 0025 #include <math_Status.hxx> 0026 #include <math_Matrix.hxx> 0027 #include <Standard_OStream.hxx> 0028 class math_MultipleVarFunction; 0029 0030 0031 0032 //! This class implements the Powell method to find the minimum of 0033 //! function of multiple variables (the gradient does not have to be known). 0034 class math_Powell 0035 { 0036 public: 0037 0038 DEFINE_STANDARD_ALLOC 0039 0040 0041 //! Constructor. Initialize new entity. 0042 Standard_EXPORT math_Powell(const math_MultipleVarFunction& theFunction, const Standard_Real theTolerance, const Standard_Integer theNbIterations = 200, const Standard_Real theZEPS = 1.0e-12); 0043 0044 //! Destructor 0045 Standard_EXPORT virtual ~math_Powell(); 0046 0047 0048 //! Computes Powell minimization on the function F given 0049 //! theStartingPoint, and an initial matrix theStartingDirection 0050 //! whose columns contain the initial set of directions. 0051 //! The solution F = Fi is found when: 0052 //! 2.0 * abs(Fi - Fi-1) =< Tolerance * (abs(Fi) + abs(Fi-1) + ZEPS). 0053 Standard_EXPORT void Perform (math_MultipleVarFunction& theFunction, const math_Vector& theStartingPoint, const math_Matrix& theStartingDirections); 0054 0055 0056 //! Solution F = Fi is found when: 0057 //! 2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1)) + ZEPS. 0058 //! The maximum number of iterations allowed is given by NbIterations. 0059 virtual Standard_Boolean IsSolutionReached (math_MultipleVarFunction& theFunction); 0060 0061 //! Returns true if the computations are successful, otherwise returns false. 0062 Standard_Boolean IsDone() const; 0063 0064 //! returns the location vector of the minimum. 0065 //! Exception NotDone is raised if the minimum was not found. 0066 const math_Vector& Location() const; 0067 0068 //! outputs the location vector of the minimum in Loc. 0069 //! Exception NotDone is raised if the minimum was not found. 0070 //! Exception DimensionError is raised if the range of Loc is not 0071 //! equal to the range of the StartingPoint. 0072 void Location (math_Vector& Loc) const; 0073 0074 //! Returns the value of the minimum. 0075 //! Exception NotDone is raised if the minimum was not found. 0076 Standard_Real Minimum() const; 0077 0078 //! Returns the number of iterations really done during the 0079 //! computation of the minimum. 0080 //! Exception NotDone is raised if the minimum was not found. 0081 Standard_Integer NbIterations() const; 0082 0083 //! Prints information on the current state of the object. 0084 //! Is used to redefine the operator <<. 0085 Standard_EXPORT void Dump (Standard_OStream& o) const; 0086 0087 0088 0089 0090 protected: 0091 0092 0093 0094 math_Vector TheLocation; 0095 Standard_Real TheMinimum; 0096 Standard_Real TheLocationError; 0097 Standard_Real PreviousMinimum; 0098 Standard_Real XTol; 0099 Standard_Real EPSZ; 0100 0101 0102 private: 0103 0104 0105 0106 Standard_Boolean Done; 0107 Standard_Integer Iter; 0108 math_Status TheStatus; 0109 math_Matrix TheDirections; 0110 Standard_Integer State; 0111 Standard_Integer Itermax; 0112 0113 0114 }; 0115 0116 0117 #include <math_Powell.lxx> 0118 0119 0120 0121 0122 0123 #endif // _math_Powell_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |