0022627: Change OCCT memory management defaults
[occt.git] / src / AppParCurves / AppParCurves_Gradient_BFGS.gxx
CommitLineData
7fd59977 1// File: AppParCurves_Gradient_BFGS.gxx
2// Created: Thu Dec 16 13:09:24 1999
3// Author: Atelier CAS2000
4// <cas@cageox.paris1.matra-dtv.fr>
5//-Copyright: Matra Datavision 1999
6
7
8// Redefinition de math_BFGS:
9// ==========================
10
11
12AppParCurves_Gradient_BFGS::AppParCurves_Gradient_BFGS(math_MultipleVarFunctionWithGradient& F,
13 const math_Vector& StartingPoint,
14 const Standard_Real Tolerance3d,
15 const Standard_Real Tolerance2d,
16 const Standard_Real Eps,
17 const Standard_Integer NbIterations ):
18 math_BFGS(F, Eps, NbIterations, Eps),
19 myTol3d(Tolerance3d),
20 myTol2d(Tolerance2d)
21{
22 Perform(F, StartingPoint);
23}
24
25Standard_Boolean AppParCurves_Gradient_BFGS::IsSolutionReached(math_MultipleVarFunctionWithGradient& F) const
26{
27 AppParCurves_ParFunction *F1 = (AppParCurves_ParFunction*) &F;
28 Standard_Boolean Result, Result2;
29
30 Result = (2.0 * fabs(TheMinimum - PreviousMinimum) <=
31 1.e-10 * (fabs(TheMinimum) + fabs(PreviousMinimum))+1.e-12);
32 Standard_Real MErr3d = F1->MaxError3d();
33 Standard_Real MErr2d = F1->MaxError2d();
34
35 Result2 = ((MErr3d <= myTol3d) && (MErr2d <= myTol2d));
36 return (Result || Result2);
37 }
38
39