Warning, /include/opencascade/AppParCurves_BSpGradient_BFGS.gxx is written in an unsupported language. File is not indexed.
0001 // Created on: 1999-12-16
0002 // Created by: Atelier CAS2000
0003 // Copyright (c) 1999-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 // Redefinition de math_BFGS:
0018 // ==========================
0019
0020 AppParCurves_BSpGradient_BFGS::AppParCurves_BSpGradient_BFGS(math_MultipleVarFunctionWithGradient& F,
0021 const math_Vector& StartingPoint,
0022 const Standard_Real Tolerance3d,
0023 const Standard_Real Tolerance2d,
0024 const Standard_Real Eps,
0025 const Standard_Integer NbIterations):
0026 math_BFGS(F.NbVariables(), Eps, NbIterations, Eps),
0027 myTol3d(Tolerance3d),
0028 myTol2d(Tolerance2d)
0029 {
0030
0031 Perform(F, StartingPoint);
0032 }
0033
0034 Standard_Boolean AppParCurves_BSpGradient_BFGS::IsSolutionReached(math_MultipleVarFunctionWithGradient& F) const {
0035 Standard_Boolean Result, Result2;
0036 AppParCurves_BSpParFunction *F1 = (AppParCurves_BSpParFunction*) &F;
0037
0038 Result = (2.0 * fabs(TheMinimum - PreviousMinimum) <=
0039 1.e-10 * (fabs(TheMinimum) + fabs(PreviousMinimum))+1.e-12) ;
0040 Standard_Real MErr3d = F1->MaxError3d();
0041 Standard_Real MErr2d = F1->MaxError2d();
0042 Result2 = ((MErr3d <= myTol3d) && (MErr2d <= myTol2d));
0043
0044 return (Result || Result2);
0045 }
0046
0047
0048