b311480e |
1 | -- Created on: 1996-10-11 |
2 | -- Created by: Philippe MANGIN |
3 | -- Copyright (c) 1996-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
10 | -- |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | -- |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | private class Newton from FairCurve inherits NewtonMinimum from math |
24 | |
25 | ---Purpose: Algorithme of Optimization used to make "FairCurve" |
26 | |
27 | uses |
28 | Vector from math, |
29 | MultipleVarFunctionWithHessian from math |
30 | |
31 | is |
32 | Create(F: in out MultipleVarFunctionWithHessian; |
33 | StartingPoint: Vector; |
34 | SpatialTolerance : Real = 1.0e-7; |
35 | CriteriumTolerance: Real = 1.0e-2; |
36 | NbIterations: Integer=40; |
37 | Convexity: Real=1.0e-6; |
38 | WithSingularity : Boolean = Standard_True) |
39 | ---Purpose: -- Given the starting point StartingPoint, |
40 | -- The tolerance required on the solution is given by |
41 | -- Tolerance. |
42 | -- Iteration are stopped if |
43 | -- (!WithSingularity) and H(F(Xi)) is not definite |
44 | -- positive (if the smaller eigenvalue of H < Convexity) |
45 | -- or IsConverged() returns True for 2 successives Iterations. |
46 | -- Warning: Obsolete Constructor (because IsConverged can not be redefined |
47 | -- with this. ) |
48 | returns Newton; |
49 | |
50 | Create(F: in out MultipleVarFunctionWithHessian; |
51 | SpatialTolerance : Real = 1.0e-7; |
52 | Tolerance: Real=1.0e-7; |
53 | NbIterations: Integer=40; |
54 | Convexity: Real=1.0e-6; |
55 | WithSingularity : Boolean = Standard_True) |
56 | ---Purpose: |
57 | -- The tolerance required on the solution is given by |
58 | -- Tolerance. |
59 | -- Iteration are stopped if |
60 | -- (!WithSingularity) and H(F(Xi)) is not definite |
61 | -- positive (if the smaller eigenvalue of H < Convexity) |
62 | -- or IsConverged() returns True for 2 successives Iterations. |
63 | -- Warning: This constructor do not computation |
64 | returns Newton; |
65 | |
66 | IsConverged(me) |
67 | ---Purpose: This method is called at the end of each |
68 | -- iteration to check the convergence : |
69 | -- || Xi+1 - Xi || < SpatialTolerance/100 Or |
70 | -- || Xi+1 - Xi || < SpatialTolerance and |
71 | -- |F(Xi+1) - F(Xi)| < CriteriumTolerance * |F(xi)| |
72 | -- It can be redefined in a sub-class to implement a specific test. |
73 | |
74 | returns Boolean |
75 | is redefined; |
76 | |
77 | fields |
78 | mySpTol : Real; |
79 | end Newton; |
80 | |