]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Sketcher: Add BFGS to a sequence of solvers when all other are failed.
authorazv <azv@opencascade.com>
Tue, 25 Sep 2018 11:23:42 +0000 (14:23 +0300)
committerazv <azv@opencascade.com>
Tue, 25 Sep 2018 11:42:08 +0000 (14:42 +0300)
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h

index f4cfa9942ebe9444d805b709e48cc6c4d930593e..10e453599057adbcbb54e41aeb738a4a850e9684 100644 (file)
@@ -168,8 +168,13 @@ PlaneGCSSolver_Solver::SolveStatus PlaneGCSSolver_Solver::solve()
 
   if (aResult == GCS::Failed) {
     // DogLeg solver failed without conflicting constraints, try to use Levenberg-Marquardt solver
+    diagnose(GCS::LevenbergMarquardt);
     aResult = (GCS::SolveStatus)myEquationSystem->solve(myParameters, true,
                                                         GCS::LevenbergMarquardt);
+    if (aResult == GCS::Failed) {
+      diagnose(GCS::BFGS);
+      aResult = (GCS::SolveStatus)myEquationSystem->solve(myParameters, true, GCS::BFGS);
+    }
   }
   Events_LongOp::end(this);
 
@@ -232,10 +237,10 @@ int PlaneGCSSolver_Solver::dof()
   return myDOF;
 }
 
-void PlaneGCSSolver_Solver::diagnose()
+void PlaneGCSSolver_Solver::diagnose(const GCS::Algorithm& theAlgo)
 {
   myEquationSystem->declareUnknowns(myParameters);
-  myDOF = myEquationSystem->diagnose();
+  myDOF = myEquationSystem->diagnose(theAlgo);
   myDiagnoseBeforeSolve = false;
 }
 
index c1fe8be563ede356a6753f725b27f141c8731c6f..6e1c7740a40b9999e80185c8ce994e6986a0fbb2 100644 (file)
@@ -78,7 +78,7 @@ public:
   bool isConflicting(const ConstraintID& theConstraint) const;
 
   /// \brief Check conflicting/redundant constraints and DoF
-  void diagnose();
+  void diagnose(const GCS::Algorithm& theAlgo = GCS::DogLeg);
 
   /// \brief Degrees of freedom
   int dof();