diff options
author | Harpreet | 2015-12-31 16:03:57 +0530 |
---|---|---|
committer | Harpreet | 2015-12-31 16:03:57 +0530 |
commit | d5356061fbd3a9b3052dee25bd9c82c375c42e22 (patch) | |
tree | 72a37d5161eb0f4b895513c46c68e031d1200520 /tests/general_tests/lsqnonneg | |
parent | eb9ca1191c94059cd7adcf69805906c809fe9712 (diff) | |
download | FOSSEE-Optimization-toolbox-d5356061fbd3a9b3052dee25bd9c82c375c42e22.tar.gz FOSSEE-Optimization-toolbox-d5356061fbd3a9b3052dee25bd9c82c375c42e22.tar.bz2 FOSSEE-Optimization-toolbox-d5356061fbd3a9b3052dee25bd9c82c375c42e22.zip |
Macros example updated
Diffstat (limited to 'tests/general_tests/lsqnonneg')
-rw-r--r-- | tests/general_tests/lsqnonneg/lsqnonneg_C.sce | 20 | ||||
-rw-r--r-- | tests/general_tests/lsqnonneg/lsqnonneg_input1.sce | 20 | ||||
-rw-r--r-- | tests/general_tests/lsqnonneg/lsqnonneg_input2.sce | 20 | ||||
-rw-r--r-- | tests/general_tests/lsqnonneg/lsqnonneg_logical.sce | 42 | ||||
-rw-r--r-- | tests/general_tests/lsqnonneg/lsqnonneg_maxiter.sce | 42 | ||||
-rw-r--r-- | tests/general_tests/lsqnonneg/lsqnonneg_param1.sce | 20 | ||||
-rw-r--r-- | tests/general_tests/lsqnonneg/lsqnonneg_param2.sce | 20 | ||||
-rw-r--r-- | tests/general_tests/lsqnonneg/lsqnonneg_zeros.sce | 28 |
8 files changed, 141 insertions, 71 deletions
diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_C.sce b/tests/general_tests/lsqnonneg/lsqnonneg_C.sce index f792559..90f5b43 100644 --- a/tests/general_tests/lsqnonneg/lsqnonneg_C.sce +++ b/tests/general_tests/lsqnonneg/lsqnonneg_C.sce @@ -1,15 +1,13 @@ // Check for the size of C and d -C = [ - 0.0372 0.2869 - 0.6861 0.7071 - 0.6233 0.6245 - 0.6344 0.6170]; -d = [ - 0.8587 - 0.1781 - 0.0747 - 0.8405 - 0.2356]; +C = [1 1 1; + 1 1 0; + 0 1 1; + 1 0 0; + 0 0 1] +d = [89; + 67; + 53; + 35] // Error //lsqlin: The number of rows in C must be equal the number of elements of d diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_input1.sce b/tests/general_tests/lsqnonneg/lsqnonneg_input1.sce index eb0aafc..db1e461 100644 --- a/tests/general_tests/lsqnonneg/lsqnonneg_input1.sce +++ b/tests/general_tests/lsqnonneg/lsqnonneg_input1.sce @@ -1,14 +1,14 @@ // Check for the input arguments -C = [ - 0.0372 0.2869 - 0.6861 0.7071 - 0.6233 0.6245 - 0.6344 0.6170]; -d = [ - 0.8587 - 0.1781 - 0.0747 - 0.8405]; +C = [1 1 1; + 1 1 0; + 0 1 1; + 1 0 0; + 0 0 1] +d = [89; + 67; + 53; + 35; + 20] // Error //lsqlin: Unexpected number of input arguments : 1 provided while should be in the set of [2 3] diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_input2.sce b/tests/general_tests/lsqnonneg/lsqnonneg_input2.sce index 2d2e557..9da3f66 100644 --- a/tests/general_tests/lsqnonneg/lsqnonneg_input2.sce +++ b/tests/general_tests/lsqnonneg/lsqnonneg_input2.sce @@ -1,14 +1,14 @@ // Check for the input arguments -C = [ - 0.0372 0.2869 - 0.6861 0.7071 - 0.6233 0.6245 - 0.6344 0.6170]; -d = [ - 0.8587 - 0.1781 - 0.0747 - 0.8405]; +C = [1 1 1; + 1 1 0; + 0 1 1; + 1 0 0; + 0 0 1] +d = [89; + 67; + 53; + 35; + 20] param = list(); x0 = [0 0]; diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_logical.sce b/tests/general_tests/lsqnonneg/lsqnonneg_logical.sce index 15106f0..5f59f8c 100644 --- a/tests/general_tests/lsqnonneg/lsqnonneg_logical.sce +++ b/tests/general_tests/lsqnonneg/lsqnonneg_logical.sce @@ -1,40 +1,42 @@ // An example with C and d as input -C = [ - 0.0372 0.2869 - 0.6861 0.7071 - 0.6233 0.6245 - 0.6344 0.6170]; -d = [ - 0.8587 - 0.1781 - 0.0747 - 0.8405]; +C = [1 1 1; + 1 1 0; + 0 1 1; + 1 0 0; + 0 0 1] +d = [89; + 67; + 53; + 35; + 20] //Output //Optimal Solution Found. // lambda = // -// lower: [0.1506118,1.441D-11] -// upper: [0,0] +// lower: [5.131D-09,5.546D-09,8.739D-09] +// upper: [0,0,0] // output = // -// Iterations: 5 +// Iterations: 7 // exitflag = // // 0 // residual = // -// 0.6598971 -// - 0.3118739 -// - 0.3580375 -// 0.4129595 +// 0.75 +// - 0.625 +// - 0.125 +// - 0.125 +// - 0.625 // resnorm = // -// 0.8314560 +// 1.375 // xopt = // -// 0. -// 0.6929344 +// 35.125 +// 32.5 +// 20.625 [xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d) diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_maxiter.sce b/tests/general_tests/lsqnonneg/lsqnonneg_maxiter.sce new file mode 100644 index 0000000..fa61c73 --- /dev/null +++ b/tests/general_tests/lsqnonneg/lsqnonneg_maxiter.sce @@ -0,0 +1,42 @@ +// Check for maxiter +C = [1 1 1; + 1 1 0; + 0 1 1; + 1 0 0; + 0 0 1] +d = [89; + 67; + 53; + 35; + 20] +options = list("MaxIter",1) +//Output +//Maximum Number of Iterations Exceeded. Output may not be optimal. +// lambda = +// +// lower: [0x0 constant] +// upper: [0x0 constant] +// output = +// +// Iterations: 1 +// exitflag = +// +// 1 +// residual = +// +// 83.449663 +// 63.182327 +// 49.319768 +// 33.129895 +// 18.267336 +// resnorm = +// +// 14819.578 +// xopt = +// +// 1.8701046 +// 1.9475681 +// 1.7326638 + +[xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d,options) + diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_param1.sce b/tests/general_tests/lsqnonneg/lsqnonneg_param1.sce index d91f4b1..9809964 100644 --- a/tests/general_tests/lsqnonneg/lsqnonneg_param1.sce +++ b/tests/general_tests/lsqnonneg/lsqnonneg_param1.sce @@ -1,14 +1,14 @@ // Check for the parameters to be a list -C = [ - 0.0372 0.2869 - 0.6861 0.7071 - 0.6233 0.6245 - 0.6344 0.6170]; -d = [ - 0.8587 - 0.1781 - 0.0747 - 0.8405]; +C = [1 1 1; + 1 1 0; + 0 1 1; + 1 0 0; + 0 0 1] +d = [89; + 67; + 53; + 35; + 20] param = 0; diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_param2.sce b/tests/general_tests/lsqnonneg/lsqnonneg_param2.sce index 557a836..9cbaa72 100644 --- a/tests/general_tests/lsqnonneg/lsqnonneg_param2.sce +++ b/tests/general_tests/lsqnonneg/lsqnonneg_param2.sce @@ -1,14 +1,14 @@ // Check for the size of parameters -C = [ - 0.0372 0.2869 - 0.6861 0.7071 - 0.6233 0.6245 - 0.6344 0.6170]; -d = [ - 0.8587 - 0.1781 - 0.0747 - 0.8405]; +C = [1 1 1; + 1 1 0; + 0 1 1; + 1 0 0; + 0 0 1] +d = [89; + 67; + 53; + 35; + 20] param = list("MaxIter"); diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_zeros.sce b/tests/general_tests/lsqnonneg/lsqnonneg_zeros.sce new file mode 100644 index 0000000..e454f42 --- /dev/null +++ b/tests/general_tests/lsqnonneg/lsqnonneg_zeros.sce @@ -0,0 +1,28 @@ +// Check for all zeros as input +C = [0]; +d = [0]; + +//Output +//Optimal Solution Found. +// lambda = +// +// lower: 6.400D-11 +// upper: 0 +// output = +// +// Iterations: 3 +// exitflag = +// +// 0 +// residual = +// +// 0. +// resnorm = +// +// 0. +// xopt = +// +// 0.9124275 + +[xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d) + |