Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/opencascade/AppParCurves_Gradient_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 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 
0021 AppParCurves_Gradient_BFGS::AppParCurves_Gradient_BFGS(math_MultipleVarFunctionWithGradient& F,
0022                                                        const math_Vector& StartingPoint,
0023                                                        const Standard_Real Tolerance3d,
0024                                                        const Standard_Real Tolerance2d,
0025                                                        const Standard_Real Eps,
0026                                                        const Standard_Integer NbIterations ):
0027        math_BFGS(F.NbVariables(), Eps, NbIterations, Eps),
0028        myTol3d(Tolerance3d),
0029        myTol2d(Tolerance2d) 
0030 {
0031   Perform(F, StartingPoint);
0032 }
0033 
0034 Standard_Boolean AppParCurves_Gradient_BFGS::IsSolutionReached(math_MultipleVarFunctionWithGradient& F) const 
0035 {
0036     AppParCurves_ParFunction *F1 = (AppParCurves_ParFunction*) &F;
0037     Standard_Boolean Result, Result2;
0038 
0039     Result = (2.0 * fabs(TheMinimum - PreviousMinimum) <= 
0040         1.e-10 * (fabs(TheMinimum) + fabs(PreviousMinimum))+1.e-12);
0041     Standard_Real MErr3d = F1->MaxError3d();
0042     Standard_Real MErr2d = F1->MaxError2d();
0043     
0044     Result2 = ((MErr3d <= myTol3d) && (MErr2d <= myTol2d));
0045     return (Result || Result2);
0046   }
0047 
0048