0025622: CAST analysis: Avoid invocation of virtual Methods of the declared Class...
[occt.git] / src / math / math_Powell.cdl
1 -- Created on: 1991-05-14
2 -- Created by: Laurent PAINNOT
3 -- Copyright (c) 1991-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
5 --
6 -- This file is part of Open CASCADE Technology software library.
7 --
8 -- This library is free software; you can redistribute it and/or modify it under
9 -- the terms of the GNU Lesser General Public License version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
13 --
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
16
17 class Powell from math
18         ---Purpose:
19         -- This class implements the Powell method to find the minimum of
20         -- function of multiple variables (the gradient does not have to be known).
21
22 uses Vector from math, Matrix from math, MultipleVarFunction from math,
23      Status from math, OStream from Standard
24
25 raises NotDone from StdFail,
26        DimensionError from Standard
27
28 is
29
30     Create(F: in out MultipleVarFunction; StartingPoint: Vector; 
31            StartingDirections: Matrix; Tolerance: Real;
32            NbIterations: Integer=200; ZEPS: Real=1.0e-12)
33         ---Purpose:
34         -- Computes Powell minimization on the function F given
35         -- StartingPoint, and an initial matrix StartingDirection
36         -- whose columns contain the initial set of directions. The
37         -- solution F = Fi is found when 2.0 * abs(Fi - Fi-1) =
38         -- <Tolerance * (abs(Fi) + abs(Fi-1) + ZEPS). The maximum
39         --    number of iterations allowed is given by NbIterations.
40     returns Powell;
41     
42     
43     Create(F: in out MultipleVarFunction;
44            Tolerance: Real;
45            NbIterations: Integer = 200;
46            ZEPS: Real = 1.0e-12)
47         ---Purpose: is used in a sub-class to initialize correctly all the fields
48         --          of this class.
49
50     returns Powell;
51
52     ---C++: alias "  Standard_EXPORT virtual ~math_Powell();"
53     
54     Perform(me: in out;F: in out MultipleVarFunction;
55             StartingPoint: Vector;
56             StartingDirections: Matrix)
57         ---Purpose: Use this method after a call to the initialization constructor
58         -- to compute the minimum of function F.
59         -- Warning
60         -- The initialization constructor must have been called before
61         -- the Perform method is called.
62
63     is static;
64
65
66     IsSolutionReached(me: in out; F: in out MultipleVarFunction)
67         ---Purpose:
68         --  solution F = Fi is found when :
69         --   2.0 * abs(Fi - Fi-1) <= Tolerance * (abs(Fi) + abs(Fi-1)) + ZEPS.
70         -- The maximum number of iterations allowed is given by NbIterations.
71     
72     returns Boolean
73     is virtual;
74     
75     
76     IsDone(me)
77         ---Purpose: Returns true if the computations are successful, otherwise returns false.
78         ---C++: inline
79     returns Boolean
80     is static;
81     
82     
83     Location(me)
84         ---Purpose: returns the location vector of the minimum.
85         -- Exception NotDone is raised if the minimum was not found.
86         ---C++: inline
87         ---C++: return const&
88     
89     returns Vector
90     raises NotDone
91     is static;
92     
93     
94     Location(me; Loc: out Vector)
95         ---Purpose: outputs the location vector of the minimum in Loc.
96         -- Exception NotDone is raised if the minimum was not found.
97         -- Exception DimensionError is raised if the range of Loc is not
98         -- equal to the range of the StartingPoint.
99         ---C++: inline
100     
101     raises NotDone,
102            DimensionError
103     is static;
104     
105     
106     
107     Minimum(me)
108         ---Purpose: Returns the value of the minimum.
109         -- Exception NotDone is raised if the minimum was not found.
110         ---C++: inline
111     
112     returns Real
113     raises NotDone
114     is static;
115     
116     
117
118     NbIterations(me)
119         ---Purpose: Returns the number of iterations really done during the
120         -- computation of the minimum.
121         -- Exception NotDone is raised if the minimum was not found.
122         ---C++: inline
123
124     returns Integer
125     raises NotDone
126     is static;
127
128
129     Dump(me; o: in out OStream)
130         ---Purpose: Prints information on the current state of the object.
131         --          Is used to redefine the operator <<.
132
133     is static;
134
135
136
137 fields
138
139 Done:             Boolean;
140 TheLocation:      Vector is protected;
141 TheMinimum:       Real is protected;
142 TheLocationError: Real is protected;
143 Iter:             Integer;
144 TheStatus:        Status;
145 TheDirections:    Matrix;
146 PreviousMinimum:  Real is protected;
147 XTol:             Real is protected;
148 EPSZ:             Real is protected;
149 State:            Integer;
150 Itermax:          Integer;
151
152 end Powell;
153