[optimization] fix tests 06/21306/3
Adeline CARNIS [Tue, 11 Feb 2020 15:55:12 +0000 (16:55 +0100)]
test_run("optimization", ["optim_ga", "neldermead_newdestroy",
"optimbase_newdestroy", "optimsimplex_new", "bug_13092"])

Change-Id: I9a0e888edfcd4f429274e81fbacbe933ae4085df

scilab/modules/optimization/tests/nonreg_tests/bug_13092.dia.ref
scilab/modules/optimization/tests/nonreg_tests/bug_13092.tst
scilab/modules/optimization/tests/unit_tests/genetic/optim_ga.dia.ref
scilab/modules/optimization/tests/unit_tests/neldermead/neldermead_newdestroy.dia.ref
scilab/modules/optimization/tests/unit_tests/optimbase/optimbase_newdestroy.dia.ref
scilab/modules/optimization/tests/unit_tests/optimsimplex/optimsimplex_new.dia.ref

index 4f4d0a9..0ad5dd4 100644 (file)
@@ -19,8 +19,8 @@
 function d = myf(x)
     mu = 1e6
     eVal_min = 0.4
-    A = [4*(x(1)**4 + x(2)**4), 2*x(2)**4; 2*x(2)**4, 4*x(2)**4]
-    B = [4*(x(1)**2 + x(2)**2), -3*x(2)**2; -3*x(2)**2, 4*x(2)**2]
+    A = [-4*(x(1)**4 + x(2)**4), 2*x(2)**4; 2*x(2)**4, 4*x(2)**4]
+    B = [-4*(x(1)**2 + x(2)**2), -3*x(2)**2; -3*x(2)**2, 4*x(2)**2]
     eig = spec(A,B)
     eig = gsort(eig, "g", "i")
     eVal = eig(1)
index 536ce84..4763408 100644 (file)
@@ -20,8 +20,8 @@
 function d = myf(x)
     mu = 1e6
     eVal_min = 0.4
-    A = [4*(x(1)**4 + x(2)**4), 2*x(2)**4; 2*x(2)**4, 4*x(2)**4]
-    B = [4*(x(1)**2 + x(2)**2), -3*x(2)**2; -3*x(2)**2, 4*x(2)**2]
+    A = [-4*(x(1)**4 + x(2)**4), 2*x(2)**4; 2*x(2)**4, 4*x(2)**4]
+    B = [-4*(x(1)**2 + x(2)**2), -3*x(2)**2; -3*x(2)**2, 4*x(2)**2]
     eig = spec(A,B)
     eig = gsort(eig, "g", "i")
     eVal = eig(1)
index 974c1ba..bdac82e 100644 (file)
@@ -102,7 +102,7 @@ ga_params = add_param(ga_params, "dimension", 2);
 ga_params = add_param(ga_params, "init_func", myinitga);
 [pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = ..
 optim_ga(f, PopSize, NbGen, Proba_mut, Proba_cross, Log, ga_params);
- Initializing the Population with grand
+  "Initializing the Population with grand"
 optim_ga: iteration 1 / 10 
     min / max value found = 0.010016 / 0.928237
 optim_ga: iteration 2 / 10 
index 0656bee..98840e0 100644 (file)
@@ -23,120 +23,63 @@ nm = neldermead_destroy(nm);
 nm = neldermead_new ();
 str = string(nm)
  str  = 
-!Nelder-Mead Object:                                                   !
-!                                                                      !
-!======================                                                !
-!                                                                      !
-!                                                                      !
-!                                                                      !
-!Simplex0 Method : axes                                                !
-!                                                                      !
-!Simplex0 Length : 1                                                   !
-!                                                                      !
-!Simplex0, Pfeffer, Delta Usual : 0.05                                 !
-!                                                                      !
-!Simplex0, Pfeffer, Delta Zero : 0.0075                                !
-!                                                                      !
-!Simplex0, Given, Coords :                                             !
-!                                                                      !
-![]                                                                    !
-!                                                                      !
-!                                                                      !
-!                                                                      !
-!Termination parameters                                                !
-!                                                                      !
-!Termination on simplex size : T                                       !
-!                                                                      !
-!Termination on simplex size, Absolute Tolerance : 0                   !
-!                                                                      !
-!Termination on simplex size, Relative Tolerance : 2.220D-16           !
-!                                                                      !
-!Termination on simplex size, Initial Simplex Size : 0                 !
-!                                                                      !
-!Termination on simplex size + Delta of function value : F             !
-!                                                                      !
-!Termination on simplex size + Delta of function value, Absolute Tolera!
-!nce on Delta F : 2.220D-16                                            !
-!                                                                      !
-!Termination on Kelley's Stagnation : F                                !
-!                                                                      !
-!Termination on Kelley's Stagnation, Normalization : T                 !
-!                                                                      !
-!Termination on Kelley's Stagnation, Alpha0 : 0.0001                   !
-!                                                                      !
-!Termination on Kelley's Stagnation, Alpha : 0.0001                    !
-!                                                                      !
-!Termination by Box : F                                                !
-!                                                                      !
-!Termination by Box, Absolute Tolerance on Function: 0.00001           !
-!                                                                      !
-!Termination by Box, Maximum Number of Consecutive Match : 5           !
-!                                                                      !
-!Termination by Box, Current Number of Consecutive Match : 0           !
-!                                                                      !
-!Termination on Variance : F                                           !
-!                                                                      !
-!Termination on Variance, Absolute Tolerance : 0                       !
-!                                                                      !
-!Termination on Variance, Relative Tolerance : 2.220D-16               !
-!                                                                      !
-!Termination on Variance, Variance of Initial Simplex : 0              !
-!                                                                      !
-!                                                                      !
-!                                                                      !
-!Algorithms parameters                                                 !
-!                                                                      !
-!Method : variable                                                     !
-!                                                                      !
-!Reflection Factor (rho) : 1                                           !
-!                                                                      !
-!Expansion Factor (chi) : 2                                            !
-!                                                                      !
-!Contraction Factor (gamma) : 0.5                                      !
-!                                                                      !
-!Shrinkage Factor (sigma) : 0.5                                        !
-!                                                                      !
-!Kelley Stagnation : F                                                 !
-!                                                                      !
-!Restart Epsilon : 2.220D-16                                           !
-!                                                                      !
-!Restart Step : 1                                                      !
-!                                                                      !
-!Restart Maximum : 3                                                   !
-!                                                                      !
-!Restart Simplex Method : oriented                                     !
-!                                                                      !
-!Restart Flag : F                                                      !
-!                                                                      !
-!Restart Number : 0                                                    !
-!                                                                      !
-!Restart Detection Method : oneill                                     !
-!                                                                      !
-!Startup Flag : F                                                      !
-!                                                                      !
-!Automatic Checking of Cost Function : T                               !
-!                                                                      !
-!Box, Number of Points  : 2n                                           !
-!                                                                      !
-!Box, Current Number of Points  : 0                                    !
-!                                                                      !
-!Box, Scaling, Factor  : 0.5                                           !
-!                                                                      !
-!Box, Scaling, Method  : tox0                                          !
-!                                                                      !
-!Box, Scaling, Minimum : 0.00001                                       !
-!                                                                      !
-!Box, Bounds Parameter: 0.000001                                       !
-!                                                                      !
-!Box, Reflection Coefficient : 1.3                                     !
-!                                                                      !
-!                                                                      !
-!                                                                      !
-!optbase: <TOPTIM Object>                                              !
-!                                                                      !
-!simplex0: <TSIMPLEX Object>                                           !
-!                                                                      !
-!simplexopt: <constant Object>                                         !
+  "Nelder-Mead Object:"                                                
+  "======================"                                             
+  ""                                                                   
+  "Simplex0 Method : axes"                                             
+  "Simplex0 Length : 1"                                                
+  "Simplex0, Pfeffer, Delta Usual : 0.05"                              
+  "Simplex0, Pfeffer, Delta Zero : 0.0075"                             
+  "Simplex0, Given, Coords :"                                          
+  "[]"                                                                 
+  ""                                                                   
+  "Termination parameters"                                             
+  "Termination on simplex size : T"                                    
+  "Termination on simplex size, Absolute Tolerance : 0"                
+  "Termination on simplex size, Relative Tolerance : 2.220D-16"        
+  "Termination on simplex size, Initial Simplex Size : 0"              
+  "Termination on simplex size + Delta of function value : F"          
+  "Termination on simplex size + Delta of function value, Absolute Tolerance on Delta F : 2.220D-16"
+  "Termination on Kelley's Stagnation : F"                             
+  "Termination on Kelley's Stagnation, Normalization : T"              
+  "Termination on Kelley's Stagnation, Alpha0 : 0.0001"                
+  "Termination on Kelley's Stagnation, Alpha : 0.0001"                 
+  "Termination by Box : F"                                             
+  "Termination by Box, Absolute Tolerance on Function: 0.00001"        
+  "Termination by Box, Maximum Number of Consecutive Match : 5"        
+  "Termination by Box, Current Number of Consecutive Match : 0"        
+  "Termination on Variance : F"                                        
+  "Termination on Variance, Absolute Tolerance : 0"                    
+  "Termination on Variance, Relative Tolerance : 2.220D-16"            
+  "Termination on Variance, Variance of Initial Simplex : 0"           
+  ""                                                                   
+  "Algorithms parameters"                                              
+  "Method : variable"                                                  
+  "Reflection Factor (rho) : 1"                                        
+  "Expansion Factor (chi) : 2"                                         
+  "Contraction Factor (gamma) : 0.5"                                   
+  "Shrinkage Factor (sigma) : 0.5"                                     
+  "Kelley Stagnation : F"                                              
+  "Restart Epsilon : 2.220D-16"                                        
+  "Restart Step : 1"                                                   
+  "Restart Maximum : 3"                                                
+  "Restart Simplex Method : oriented"                                  
+  "Restart Flag : F"                                                   
+  "Restart Number : 0"                                                 
+  "Restart Detection Method : oneill"                                  
+  "Startup Flag : F"                                                   
+  "Automatic Checking of Cost Function : T"                            
+  "Box, Number of Points  : 2n"                                        
+  "Box, Current Number of Points  : 0"                                 
+  "Box, Scaling, Factor  : 0.5"                                        
+  "Box, Scaling, Method  : tox0"                                       
+  "Box, Scaling, Minimum : 0.00001"                                    
+  "Box, Bounds Parameter: 0.000001"                                    
+  "Box, Reflection Coefficient : 1.3"                                  
+  ""                                                                   
+  "optbase: <TOPTIM Object>"                                           
+  "simplex0: <TSIMPLEX Object>"                                        
+  "simplexopt: <constant Object>"                                      
 assert_checkequal ( typeof(str) , "string" )
  ans  =
   T
@@ -237,120 +180,63 @@ nm = neldermead_configure(nm,"-nbineqconst",3);
 nm = neldermead_configure(nm,"-simplex0length",20.0);
 str = string(nm)
  str  = 
-!Nelder-Mead Object:                                                   !
-!                                                                      !
-!======================                                                !
-!                                                                      !
-!                                                                      !
-!                                                                      !
-!Simplex0 Method : axes                                                !
-!                                                                      !
-!Simplex0 Length : 20                                                  !
-!                                                                      !
-!Simplex0, Pfeffer, Delta Usual : 0.05                                 !
-!                                                                      !
-!Simplex0, Pfeffer, Delta Zero : 0.0075                                !
-!                                                                      !
-!Simplex0, Given, Coords :                                             !
-!                                                                      !
-![]                                                                    !
-!                                                                      !
-!                                                                      !
-!                                                                      !
-!Termination parameters                                                !
-!                                                                      !
-!Termination on simplex size : T                                       !
-!                                                                      !
-!Termination on simplex size, Absolute Tolerance : 0                   !
-!                                                                      !
-!Termination on simplex size, Relative Tolerance : 0.0001              !
-!                                                                      !
-!Termination on simplex size, Initial Simplex Size : 0                 !
-!                                                                      !
-!Termination on simplex size + Delta of function value : F             !
-!                                                                      !
-!Termination on simplex size + Delta of function value, Absolute Tolera!
-!nce on Delta F : 2.220D-16                                            !
-!                                                                      !
-!Termination on Kelley's Stagnation : F                                !
-!                                                                      !
-!Termination on Kelley's Stagnation, Normalization : T                 !
-!                                                                      !
-!Termination on Kelley's Stagnation, Alpha0 : 0.0001                   !
-!                                                                      !
-!Termination on Kelley's Stagnation, Alpha : 0.0001                    !
-!                                                                      !
-!Termination by Box : F                                                !
-!                                                                      !
-!Termination by Box, Absolute Tolerance on Function: 0.00001           !
-!                                                                      !
-!Termination by Box, Maximum Number of Consecutive Match : 5           !
-!                                                                      !
-!Termination by Box, Current Number of Consecutive Match : 0           !
-!                                                                      !
-!Termination on Variance : F                                           !
-!                                                                      !
-!Termination on Variance, Absolute Tolerance : 0                       !
-!                                                                      !
-!Termination on Variance, Relative Tolerance : 2.220D-16               !
-!                                                                      !
-!Termination on Variance, Variance of Initial Simplex : 0              !
-!                                                                      !
-!                                                                      !
-!                                                                      !
-!Algorithms parameters                                                 !
-!                                                                      !
-!Method : box                                                          !
-!                                                                      !
-!Reflection Factor (rho) : 1                                           !
-!                                                                      !
-!Expansion Factor (chi) : 2                                            !
-!                                                                      !
-!Contraction Factor (gamma) : 0.5                                      !
-!                                                                      !
-!Shrinkage Factor (sigma) : 0.5                                        !
-!                                                                      !
-!Kelley Stagnation : F                                                 !
-!                                                                      !
-!Restart Epsilon : 2.220D-16                                           !
-!                                                                      !
-!Restart Step : 1                                                      !
-!                                                                      !
-!Restart Maximum : 3                                                   !
-!                                                                      !
-!Restart Simplex Method : oriented                                     !
-!                                                                      !
-!Restart Flag : F                                                      !
-!                                                                      !
-!Restart Number : 0                                                    !
-!                                                                      !
-!Restart Detection Method : oneill                                     !
-!                                                                      !
-!Startup Flag : F                                                      !
-!                                                                      !
-!Automatic Checking of Cost Function : T                               !
-!                                                                      !
-!Box, Number of Points  : 2n                                           !
-!                                                                      !
-!Box, Current Number of Points  : 0                                    !
-!                                                                      !
-!Box, Scaling, Factor  : 0.5                                           !
-!                                                                      !
-!Box, Scaling, Method  : tox0                                          !
-!                                                                      !
-!Box, Scaling, Minimum : 0.00001                                       !
-!                                                                      !
-!Box, Bounds Parameter: 0.000001                                       !
-!                                                                      !
-!Box, Reflection Coefficient : 1.3                                     !
-!                                                                      !
-!                                                                      !
-!                                                                      !
-!optbase: <TOPTIM Object>                                              !
-!                                                                      !
-!simplex0: <TSIMPLEX Object>                                           !
-!                                                                      !
-!simplexopt: <constant Object>                                         !
+  "Nelder-Mead Object:"                                                
+  "======================"                                             
+  ""                                                                   
+  "Simplex0 Method : axes"                                             
+  "Simplex0 Length : 20"                                               
+  "Simplex0, Pfeffer, Delta Usual : 0.05"                              
+  "Simplex0, Pfeffer, Delta Zero : 0.0075"                             
+  "Simplex0, Given, Coords :"                                          
+  "[]"                                                                 
+  ""                                                                   
+  "Termination parameters"                                             
+  "Termination on simplex size : T"                                    
+  "Termination on simplex size, Absolute Tolerance : 0"                
+  "Termination on simplex size, Relative Tolerance : 0.0001"           
+  "Termination on simplex size, Initial Simplex Size : 0"              
+  "Termination on simplex size + Delta of function value : F"          
+  "Termination on simplex size + Delta of function value, Absolute Tolerance on Delta F : 2.220D-16"
+  "Termination on Kelley's Stagnation : F"                             
+  "Termination on Kelley's Stagnation, Normalization : T"              
+  "Termination on Kelley's Stagnation, Alpha0 : 0.0001"                
+  "Termination on Kelley's Stagnation, Alpha : 0.0001"                 
+  "Termination by Box : F"                                             
+  "Termination by Box, Absolute Tolerance on Function: 0.00001"        
+  "Termination by Box, Maximum Number of Consecutive Match : 5"        
+  "Termination by Box, Current Number of Consecutive Match : 0"        
+  "Termination on Variance : F"                                        
+  "Termination on Variance, Absolute Tolerance : 0"                    
+  "Termination on Variance, Relative Tolerance : 2.220D-16"            
+  "Termination on Variance, Variance of Initial Simplex : 0"           
+  ""                                                                   
+  "Algorithms parameters"                                              
+  "Method : box"                                                       
+  "Reflection Factor (rho) : 1"                                        
+  "Expansion Factor (chi) : 2"                                         
+  "Contraction Factor (gamma) : 0.5"                                   
+  "Shrinkage Factor (sigma) : 0.5"                                     
+  "Kelley Stagnation : F"                                              
+  "Restart Epsilon : 2.220D-16"                                        
+  "Restart Step : 1"                                                   
+  "Restart Maximum : 3"                                                
+  "Restart Simplex Method : oriented"                                  
+  "Restart Flag : F"                                                   
+  "Restart Number : 0"                                                 
+  "Restart Detection Method : oneill"                                  
+  "Startup Flag : F"                                                   
+  "Automatic Checking of Cost Function : T"                            
+  "Box, Number of Points  : 2n"                                        
+  "Box, Current Number of Points  : 0"                                 
+  "Box, Scaling, Factor  : 0.5"                                        
+  "Box, Scaling, Method  : tox0"                                       
+  "Box, Scaling, Minimum : 0.00001"                                    
+  "Box, Bounds Parameter: 0.000001"                                    
+  "Box, Reflection Coefficient : 1.3"                                  
+  ""                                                                   
+  "optbase: <TOPTIM Object>"                                           
+  "simplex0: <TSIMPLEX Object>"                                        
+  "simplexopt: <constant Object>"                                      
 assert_checkequal ( typeof(str) , "string" )
  ans  =
   T
index 0cdd69f..8cd6dc7 100644 (file)
@@ -278,57 +278,32 @@ opt = optimbase_destroy(opt);
 opt = optimbase_new ();
 string(opt)
  ans  =
-!Optim Base Object:                                            !
-!                                                              !
-!==================                                            !
-!                                                              !
-!Number of variables : 0                                       !
-!                                                              !
-!Initial Guess : []                                            !
-!                                                              !
-!Initial Function Value :                                      !
-!                                                              !
-!Number of Inequality Constraints :0                           !
-!                                                              !
-!Bounds Mininimum : []                                         !
-!                                                              !
-!Bounds Maxinimum :[]                                          !
-!                                                              !
-!Optimum Parameters : [0]                                      !
-!                                                              !
-!Optimum Function Value :0                                     !
-!                                                              !
-!Number of iterations : 0                                      !
-!                                                              !
-!Maximum number of iterations : 100                            !
-!                                                              !
-!Number function evaluations : 0                               !
-!                                                              !
-!Maximum number of function evaluations : 100                  !
-!                                                              !
-!Termination Method on function value : F                      !
-!                                                              !
-!Termination Absolute Tolerance on function value : 0          !
-!                                                              !
-!Termination Relative Tolerance on function value : 2.220D-16  !
-!                                                              !
-!Termination Method on x : T                                   !
-!                                                              !
-!Termination Absolute Tolerance on x : 0                       !
-!                                                              !
-!Termination Relative Tolerance on x : 1.490D-08               !
-!                                                              !
-!Optimization Status :                                         !
-!                                                              !
-!Verbose logging : 0                                           !
-!                                                              !
-!Verbose Termination : 0                                       !
-!                                                              !
-!Verbose Log File :                                            !
-!                                                              !
-!Verbose Log File Startup Up: F                                !
-!                                                              !
-!Store History : F                                             !
+  "Optim Base Object:"                                          
+  "=================="                                          
+  "Number of variables : 0"                                     
+  "Initial Guess : []"                                          
+  "Initial Function Value :"                                    
+  "Number of Inequality Constraints :0"                         
+  "Bounds Mininimum : []"                                       
+  "Bounds Maxinimum :[]"                                        
+  "Optimum Parameters : [0]"                                    
+  "Optimum Function Value :0"                                   
+  "Number of iterations : 0"                                    
+  "Maximum number of iterations : 100"                          
+  "Number function evaluations : 0"                             
+  "Maximum number of function evaluations : 100"                
+  "Termination Method on function value : F"                    
+  "Termination Absolute Tolerance on function value : 0"        
+  "Termination Relative Tolerance on function value : 2.220D-16"
+  "Termination Method on x : T"                                 
+  "Termination Absolute Tolerance on x : 0"                     
+  "Termination Relative Tolerance on x : 1.490D-08"             
+  "Optimization Status : "                                      
+  "Verbose logging : 0"                                         
+  "Verbose Termination : 0"                                     
+  "Verbose Log File : "                                         
+  "Verbose Log File Startup Up: F"                              
+  "Store History : F"                                           
 opt
  opt  = 
 Optim Base Object:
index c2e5c97..64ad8b7 100644 (file)
@@ -121,17 +121,12 @@ coords = [
 s1 = optimsimplex_new ( coords , rosenbrock );
 string(s1)
  ans  =
-!Optim Simplex Object:  !
-!                       !
-!=====================  !
-!                       !
-!nbve: 5                !
-!                       !
-!n: 2                   !
-!                       !
-!x: 5-by-2 matrix       !
-!                       !
-!fv: 5-by-1 matrix      !
+  "Optim Simplex Object:"
+  "====================="
+  "nbve: 5"              
+  "n: 2"                 
+  "x: 5-by-2 matrix"     
+  "fv: 5-by-1 matrix"    
 s1
  s1  = 
 Optim Simplex Object: