mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0024608: Development of methods of global optimization of multivariable function
math_GlobOptMin - new global optimization minimization algorithm Extrema_GlobOptFuncCC, Extrema_ExtCC, Extrema_ExtCC2d - implementation of GlobOptMin algorithm to extrema curve / curve Extrema_CurveCache - deleted as obsolete code ChFi3d_Builder.cxx - fixed processing of extrema math_NewtonMinimum.cxx - fixed step to avoid incorrect behavior Test cases modification to meet new behavior.
This commit is contained in:
@@ -8,9 +8,19 @@ puts ""
|
||||
|
||||
bsplinecurve r3 2 6 1 3 2 1 3 1 4 1 5 1 6 3 2 5 3 1 3 7 3 1 4 8 3 1 4 8 3 1 4 8 3 1 5 9 3 1 9 7 3 1
|
||||
bsplinecurve r4 2 6 2 3 2.5 1 3 1 3.5 1 4 1 4.5 3 -1 2 3 1 1 11 3 1 3 9 3 1 3 9 3 1 3 9 3 1 5 7 3 1 7 4 3 1
|
||||
set info [extrema r3 r4]
|
||||
extrema r3 r4
|
||||
|
||||
if { [regexp "Extrema 3 is point : 4 8 3" $info] != 1 || [regexp "Extrema 8 is point : 4 8 3" $info] != 1 } {
|
||||
cvalue ext_1 0 x y z
|
||||
set info [dump x]
|
||||
regexp "(\[-0-9.+eE\])" $info full xx
|
||||
set info [dump y]
|
||||
regexp "(\[-0-9.+eE\])" $info full yy
|
||||
set info [dump z]
|
||||
regexp "(\[-0-9.+eE\])" $info full zz
|
||||
|
||||
if { sqrt(($xx - 4.0) * ($xx - 4.0) +
|
||||
($yy - 8.0) * ($yy - 8.0) +
|
||||
($zz - 3.0) * ($zz - 3.0)) > 1.0e-7} {
|
||||
puts "Error : Point of extrema is wrong"
|
||||
} else {
|
||||
puts "OK: Point of extrema is valid"
|
||||
|
@@ -10,7 +10,7 @@ bsplinecurve r1 2 5 1 3 2 1 3 1 4 1 5 3 2 5 3 1 3 7 3 1 4 8 3 1 4 8 3 1 5 9 3 1
|
||||
bsplinecurve r2 2 5 2 3 2.5 1 3 1 3.5 1 4 3 -1 2 3 1 1 11 3 1 3 9 3 1 3 9 3 1 3 9 3 1 5 7 3 1 7 4 3 1
|
||||
set info [extrema r1 r2]
|
||||
|
||||
if { [llength $info] != 3 } {
|
||||
if { [llength $info] != 1 } {
|
||||
puts "Error : Extrema is wrong"
|
||||
} else {
|
||||
puts "OK: Extrema is valid"
|
||||
|
@@ -11,7 +11,7 @@ bsplinecurve r10 2 6 2 3 2.5 1 3 1 3.5 1 4 1 4.5 3 5 20 3 1 8 15 3 1 12 18 3 1 1
|
||||
|
||||
set info [extrema r9 r10]
|
||||
|
||||
if { [llength $info] != 6 } {
|
||||
if { [llength $info] != 1 } {
|
||||
puts "Error : Extrema is wrong"
|
||||
} else {
|
||||
puts "OK: Extrema is valid"
|
||||
|
@@ -11,13 +11,11 @@ puts ""
|
||||
|
||||
set info [2dextrema b3 b4]
|
||||
set status 0
|
||||
for { set i 1 } { $i <= 15 } { incr i 1 } {
|
||||
regexp "dist $i: +(\[-0-9.+eE\]+)" $info full pp
|
||||
if { $pp != 1.4142135623730951 } {
|
||||
puts "Error : Extrema is wrong on dist $i"
|
||||
regexp "dist 1: +(\[-0-9.+eE\]+)" $info full pp
|
||||
if { $pp > 1.0e-7 } {
|
||||
puts "Error : Extrema is wrong"
|
||||
set status 1
|
||||
}
|
||||
}
|
||||
|
||||
if { $status != 0 } {
|
||||
puts "Error : Extrema is wrong"
|
||||
|
@@ -11,37 +11,14 @@ puts ""
|
||||
set info [2dextrema b9 b10]
|
||||
|
||||
set status 0
|
||||
for { set i 1 } { $i <= 9 } { incr i } {
|
||||
regexp "dist $i: +(\[-0-9.+eE\]+)" $info full pp1
|
||||
if { $pp1 != 7.2801098892805181 } {
|
||||
for { set i 1 } { $i <= 6 } { incr i 1 } {
|
||||
regexp "dist $i: +(\[-0-9.+eE\]+)" $info full pp
|
||||
if { abs($pp - 4.316921907096100) > 1.0e-7 } {
|
||||
puts "Error : Extrema is wrong on dist $i"
|
||||
set status 1
|
||||
}
|
||||
}
|
||||
|
||||
for { set j 11 } { $j <= 19 } { incr j 1 } {
|
||||
regexp "dist $j: +(\[-0-9.+eE\]+)" $info full pp2
|
||||
if { $pp2 != 7.2801098892805181 } {
|
||||
puts "Error : Extrema is wrong on dist $j"
|
||||
set status 1
|
||||
}
|
||||
}
|
||||
|
||||
regexp {dist 10: +([-0-9.+eE]+)} $info full pp3
|
||||
regexp {dist 20: +([-0-9.+eE]+)} $info full pp4
|
||||
regexp {dist 21: +([-0-9.+eE]+)} $info full pp5
|
||||
set pp_c 4.316921907096102
|
||||
set pp_ch 4.3169219070961038
|
||||
|
||||
if { $pp3 != $pp_c } {
|
||||
puts "Error : Extrema is wrong on dist 10"
|
||||
set status 1
|
||||
}
|
||||
if { $pp4 != $pp_ch || $pp5 != $pp_ch} {
|
||||
puts "Error : Extrema is wrong on dist 20 or 21"
|
||||
set status 1
|
||||
}
|
||||
|
||||
if { $status != 0 } {
|
||||
puts "Error : Extrema is wrong"
|
||||
} else {
|
||||
|
@@ -11,21 +11,12 @@ puts ""
|
||||
set info [2dextrema b7 b8]
|
||||
|
||||
set status 0
|
||||
for { set i 2 } { $i <= 5 } { incr i } {
|
||||
regexp "dist $i: +(\[-0-9.+eE\]+)" $info full pp1
|
||||
if { $pp1 !=4.3624023150195192 } {
|
||||
puts "Error : Extrema is wrong on dist $i"
|
||||
set status 1
|
||||
}
|
||||
}
|
||||
|
||||
regexp {dist 1: +([-0-9.+eE]+)} $info full pp2
|
||||
set pp_ch 4.3624023150195184
|
||||
|
||||
if { $pp2 != $pp_ch } {
|
||||
puts "Error : Extrema is wrong on dist 1"
|
||||
regexp "dist 1: +(\[-0-9.+eE\]+)" $info full pp
|
||||
if { abs($pp - 2.3246777409727225) < 1.0e-7 } {
|
||||
puts "Error : Extrema is wrong"
|
||||
set status 1
|
||||
}
|
||||
}
|
||||
|
||||
if { $status != 0 } {
|
||||
puts "Error : Extrema is wrong"
|
||||
|
@@ -10,12 +10,6 @@ restore [locate_data_file bug24200_c1] c1
|
||||
restore [locate_data_file bug24200_c2] c2
|
||||
set info_1 [extrema c1 c2]
|
||||
|
||||
if { [regexp "ext_15" $info_1] != 1 } {
|
||||
puts "Error : Extrema is wrong"
|
||||
} else {
|
||||
puts "OK : Extrema is correct"
|
||||
}
|
||||
|
||||
trim c1t c1 677.8 678.8
|
||||
trim c2t c2 2477 2479
|
||||
extrema c1t c2t
|
||||
@@ -34,4 +28,3 @@ if { [expr 1.*abs($checkdist - $dist)/$checkdist] > 0.1 } {
|
||||
} else {
|
||||
puts "OK: Distance is correct"
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,7 @@ checkshape aEdge2
|
||||
|
||||
distmini d aEdge1 aEdge2
|
||||
regexp {NB RESULTS +: +([-0-9.+eE]+)} [BUC60825 aEdge1 aEdge2] full ext
|
||||
if { $ext != 0 } {
|
||||
if { $ext != 1 } {
|
||||
puts "Error : The extrema has not been calculated."
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,7 @@ circle curve_2 5.3 -0.5 2
|
||||
|
||||
set err [llength [2dextrema curve_1 curve_2]]
|
||||
|
||||
if {$err == 16} {
|
||||
if {$err == 6} {
|
||||
puts "BUC60890 OK: Function 2dextrema works properly."
|
||||
} else {
|
||||
puts "Faulty BUC60890 : Function 2dextrema works wrongly."
|
||||
|
@@ -11,7 +11,7 @@ restore [locate_data_file OCC862_2.draw] c2
|
||||
|
||||
set result [extrema c1 c2]
|
||||
set err [llength $result]
|
||||
if { $err <= 1} {
|
||||
if { $err != 1} {
|
||||
puts "Faulty OCC862 (amount of solution): command extrema does NOT work properly"
|
||||
} else {
|
||||
puts "OCC862 OK (amount of solution): command extrema works properly"
|
||||
|
@@ -27,13 +27,6 @@ extrema airfl rhomb
|
||||
|
||||
if { [isdraw ext_1] } {
|
||||
mkedge result ext_1
|
||||
set length 9.09515
|
||||
} else {
|
||||
puts "${BugNumber}: invalid result"
|
||||
}
|
||||
|
||||
if { [isdraw ext_2] } {
|
||||
mkedge result ext_2
|
||||
set length 5.14563
|
||||
} else {
|
||||
puts "${BugNumber}: invalid result"
|
||||
|
Reference in New Issue
Block a user