4bbaf12b |
1 | // Created on: 2014-01-20 |
2 | // Created by: Alexaner Malyshev |
3 | // Copyright (c) 2014-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _math_GlobOptMin_HeaderFile |
17 | #define _math_GlobOptMin_HeaderFile |
18 | |
19 | #include <math_MultipleVarFunction.hxx> |
20 | #include <NCollection_Sequence.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | //! This class represents Evtushenko's algorithm of global optimization based on nonuniform mesh.<br> |
24 | //! Article: Yu. Evtushenko. Numerical methods for finding global extreme (case of a non-uniform mesh). <br> |
25 | //! U.S.S.R. Comput. Maths. Math. Phys., Vol. 11, N 6, pp. 38-54. |
26 | |
27 | class math_GlobOptMin |
28 | { |
29 | public: |
30 | |
31 | Standard_EXPORT math_GlobOptMin(math_MultipleVarFunction* theFunc, |
32 | const math_Vector& theA, |
33 | const math_Vector& theB, |
34 | Standard_Real theC = 9); |
35 | |
36 | Standard_EXPORT void SetGlobalParams(math_MultipleVarFunction* theFunc, |
37 | const math_Vector& theA, |
38 | const math_Vector& theB, |
39 | Standard_Real theC = 9); |
40 | |
41 | Standard_EXPORT void SetLocalParams(const math_Vector& theLocalA, |
42 | const math_Vector& theLocalB); |
43 | |
44 | Standard_EXPORT ~math_GlobOptMin(); |
45 | |
46 | Standard_EXPORT void Perform(); |
47 | |
48 | //! Get best functional value. |
49 | Standard_EXPORT Standard_Real GetF(); |
50 | |
51 | //! Return count of global extremas. NbExtrema <= MAX_SOLUTIONS. |
52 | Standard_EXPORT Standard_Integer NbExtrema(); |
53 | |
54 | //! Return solution i, 1 <= i <= NbExtrema. |
55 | Standard_EXPORT void Points(const Standard_Integer theIndex, math_Vector& theSol); |
56 | |
57 | private: |
58 | |
59 | math_GlobOptMin & operator = (const math_GlobOptMin & theOther); |
60 | |
61 | Standard_Boolean computeLocalExtremum(const math_Vector& thePnt, Standard_Real& theVal, math_Vector& theOutPnt); |
62 | |
63 | void computeGlobalExtremum(Standard_Integer theIndex); |
64 | |
65 | //! Check that myA <= pnt <= myB |
66 | Standard_Boolean isInside(const math_Vector& thePnt); |
67 | |
68 | Standard_Boolean isStored(const math_Vector &thePnt); |
69 | |
70 | Standard_Boolean isDone(); |
71 | |
72 | // Input. |
73 | math_MultipleVarFunction* myFunc; |
74 | Standard_Integer myN; |
75 | math_Vector myA; // Left border on current C2 interval. |
76 | math_Vector myB; // Right border on current C2 interval. |
77 | math_Vector myGlobA; // Global left border. |
78 | math_Vector myGlobB; // Global right border. |
79 | |
80 | // Output. |
81 | Standard_Boolean myDone; |
82 | NCollection_Sequence<Standard_Real> myY;// Current solutions. |
83 | Standard_Integer mySolCount; // Count of solutions. |
84 | |
85 | // Algorithm data. |
86 | Standard_Real myZ; |
87 | Standard_Real myC; //Lipschitz constant |
88 | Standard_Real myE1; // Border coeff. |
89 | Standard_Real myE2; // Minimum step size. |
90 | Standard_Real myE3; // Local extrema starting parameter. |
91 | |
92 | math_Vector myX; // Current modified solution |
93 | math_Vector myTmp; // Current modified solution |
94 | math_Vector myV; // Steps array. |
95 | |
96 | Standard_Real myF; // Current value of Global optimum. |
97 | }; |
98 | |
99 | const Handle(Standard_Type)& TYPE(math_GlobOptMin); |
100 | |
101 | #endif |