1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025635: Wrong result of 2D-extrema between two ellipsis

Fixed Lipschitz constant evaluation in case co-parametrized objects.
Fixed 2dextrema output.
Testcase update to new behavior.

Test cases for issue CR25635

Correction of test cases for issue CR25635
This commit is contained in:
aml
2015-02-05 16:13:39 +03:00
committed by bugmaster
parent 3f733bb126
commit e8746a262f
5 changed files with 131 additions and 17 deletions

View File

@@ -23,6 +23,7 @@
#include <math_Powell.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Precision.hxx>
//=======================================================================
@@ -194,9 +195,6 @@ void math_GlobOptMin::Perform()
{
Standard_Integer i;
// Compute initial values for myF, myY, myC.
computeInitialValues();
// Compute parameters range
Standard_Real minLength = RealLast();
Standard_Real maxLength = RealFirst();
@@ -209,6 +207,18 @@ void math_GlobOptMin::Perform()
maxLength = currentLength;
}
if (minLength < Precision::PConfusion())
{
#ifdef OCCT_DEBUG
cout << "math_GlobOptMin::Perform(): Degenerated parameters space" << endl;
#endif
return;
}
// Compute initial values for myF, myY, myC.
computeInitialValues();
myE1 = minLength * myTol;
myE2 = maxLength * myTol;
if (myC > 1.0)
@@ -293,7 +303,7 @@ void math_GlobOptMin::computeInitialValues()
Standard_Integer i;
math_Vector aCurrPnt(1, myN);
math_Vector aBestPnt(1, myN);
math_Vector aParamStep(1, myN);
Standard_Real aCurrVal = RealLast();
Standard_Real aBestVal = RealLast();
@@ -324,21 +334,29 @@ void math_GlobOptMin::computeInitialValues()
mySolCount++;
// Lipschitz const approximation
Standard_Real aLipConst = 0.0, aPrevVal;
Standard_Real aLipConst = 0.0, aPrevValDiag, aPrevValProj;
Standard_Integer aPntNb = 13;
myFunc->Value(myA, aPrevVal);
myFunc->Value(myA, aPrevValDiag);
aPrevValProj = aPrevValDiag;
Standard_Real aStep = (myB - myA).Norm() / aPntNb;
aParamStep = (myB - myA) / aPntNb;
for(i = 1; i <= aPntNb; i++)
{
aCurrPnt = myA + (myB - myA) * i / (aPntNb - 1);
aCurrPnt = myA + aParamStep * i;
// Walk over diagonal.
myFunc->Value(aCurrPnt, aCurrVal);
aLipConst = Max (Abs(aCurrVal - aPrevValDiag), aLipConst);
aPrevValDiag = aCurrVal;
if(Abs(aCurrVal - aPrevVal) / aStep > aLipConst)
aLipConst = Abs(aCurrVal - aPrevVal) / aStep;
aPrevVal = aCurrVal;
// Walk over diag in projected space aPnt(1) = myA(1) = const.
aCurrPnt(1) = myA(1);
myFunc->Value(aCurrPnt, aCurrVal);
aLipConst = Max (Abs(aCurrVal - aPrevValProj), aLipConst);
aPrevValProj = aCurrVal;
}
aLipConst *= Sqrt(myN);
aLipConst *= Sqrt(myN) / aStep;
if (aLipConst < myC * 0.1)
{