diff options
Diffstat (limited to 'tests/general_tests')
31 files changed, 586 insertions, 317 deletions
diff --git a/tests/general_tests/lsqlin/lsqlin_A1.sce b/tests/general_tests/lsqlin/lsqlin_A1.sce index ba9b5be..1c2128b 100644 --- a/tests/general_tests/lsqlin/lsqlin_A1.sce +++ b/tests/general_tests/lsqlin/lsqlin_A1.sce @@ -1,23 +1,17 @@ // Check for elements in A -C = [0.9501 0.7620 0.6153 0.4057 - 0.2311 0.4564 0.7919 0.9354 - 0.6068 0.0185 0.9218 0.9169 - 0.4859 0.8214 0.7382 0.4102 - 0.8912 0.4447 0.1762 0.8936]; -d = [0.0578 - 0.3528 - 0.8131 - 0.0098 - 0.1388]; -A = [0.2027 0.2721 0.7467 0.4659 0 - 0.1987 0.1988 0.4450 0.4186 0 - 0.6037 0.0152 0.9318 0.8462 0]; -b = [0.5251 - 0.2026 - 0.6721]; +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +A = [10 -2 0; + -2 10 0]; +b = [4 + -4]; //Error -//lsqlin: The number of columns in A must be the same as the number of elements of d +//lsqlin: The number of columns in A must be the same as the number of columns in C //at line 213 of function lsqlin called by : //[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b) diff --git a/tests/general_tests/lsqlin/lsqlin_Aeq1.sce b/tests/general_tests/lsqlin/lsqlin_Aeq1.sce index 458cbb0..f574e9d 100644 --- a/tests/general_tests/lsqlin/lsqlin_Aeq1.sce +++ b/tests/general_tests/lsqlin/lsqlin_Aeq1.sce @@ -1,23 +1,18 @@ // Check for elements in Aeq -C = [0.9501 0.7620 0.6153 0.4057 - 0.2311 0.4564 0.7919 0.9354 - 0.6068 0.0185 0.9218 0.9169 - 0.4859 0.8214 0.7382 0.4102 - 0.8912 0.4447 0.1762 0.8936]; -d = [0.0578 - 0.3528 - 0.8131 - 0.0098 - 0.1388]; -Aeq = [0.2027 0.2721 0.7467 0.4659 0 - 0.1987 0.1988 0.4450 0.4186 0 - 0.6037 0.0152 0.9318 0.8462 0]; -beq = [0.5251 - 0.2026 - 0.6721]; + C = [2 0; + -1 1; + 0 2] + d = [1 + 0 + -1]; + Aeq = [10 -2 0; + -2 10 0]; + beq = [4 + -4]; + //Error -//lsqlin: The number of columns in Aeq must be the same as the number of elements of d +//lsqlin: The number of columns in Aeq must be the same as the number of columns in C //at line 219 of function lsqlin called by : //[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,[],[],Aeq,beq) diff --git a/tests/general_tests/lsqlin/lsqlin_C1.sce b/tests/general_tests/lsqlin/lsqlin_C1.sce index 55fe976..6da1d49 100644 --- a/tests/general_tests/lsqlin/lsqlin_C1.sce +++ b/tests/general_tests/lsqlin/lsqlin_C1.sce @@ -1,21 +1,13 @@ // Check for elements in C and d -C = [0.9501 0.7620 0.6153 0.4057 - 0.2311 0.4564 0.7919 0.9354 - 0.6068 0.0185 0.9218 0.9169 - 0.4859 0.8214 0.7382 0.4102 - 0.8912 0.4447 0.1762 0.8936]; -d = [0.0578 - 0.3528 - 0.8131 - 0.0098 - 0.1388 - 0.2536]; -A = [0.2027 0.2721 0.7467 0.4659 - 0.1987 0.1988 0.4450 0.4186 - 0.6037 0.0152 0.9318 0.8462]; -b = [0.5251 - 0.2026 - 0.6721]; +C = [2 0; + -1 1; + 0 2] +d = [1 + 0]; +A = [10 -2; + -2 10]; +b = [4 + -4]; //Error //lsqlin: The number of rows in C must be equal the number of elements of d diff --git a/tests/general_tests/lsqlin/lsqlin_b1.sce b/tests/general_tests/lsqlin/lsqlin_b1.sce index 49b6dec..fb01b79 100644 --- a/tests/general_tests/lsqlin/lsqlin_b1.sce +++ b/tests/general_tests/lsqlin/lsqlin_b1.sce @@ -1,18 +1,13 @@ // Check for elements in b -C = [0.9501 0.7620 0.6153 0.4057 - 0.2311 0.4564 0.7919 0.9354 - 0.6068 0.0185 0.9218 0.9169 - 0.4859 0.8214 0.7382 0.4102 - 0.8912 0.4447 0.1762 0.8936]; -d = [0.0578 - 0.3528 - 0.8131 - 0.0098 - 0.1388]; -A = [0.2027 0.2721 0.7467 0.4659 - 0.1987 0.1988 0.4450 0.4186 - 0.6037 0.0152 0.9318 0.8462]; -b = [-%inf -%inf -%inf]; +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +A = [10 -2; + -2 10]; +b = [-%inf -%inf]; //Error //lsqlin: Value of b can not be negative infinity diff --git a/tests/general_tests/lsqlin/lsqlin_beq1.sce b/tests/general_tests/lsqlin/lsqlin_beq1.sce index b71486e..38056c0 100644 --- a/tests/general_tests/lsqlin/lsqlin_beq1.sce +++ b/tests/general_tests/lsqlin/lsqlin_beq1.sce @@ -1,18 +1,13 @@ // Check for elements in beq -C = [0.9501 0.7620 0.6153 0.4057 - 0.2311 0.4564 0.7919 0.9354 - 0.6068 0.0185 0.9218 0.9169 - 0.4859 0.8214 0.7382 0.4102 - 0.8912 0.4447 0.1762 0.8936]; -d = [0.0578 - 0.3528 - 0.8131 - 0.0098 - 0.1388]; -Aeq = [0.2027 0.2721 0.7467 0.4659 - 0.1987 0.1988 0.4450 0.4186 - 0.6037 0.0152 0.9318 0.8462]; -beq = [-%inf -%inf -%inf]; +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +Aeq = [10 -2; + -2 10]; +beq = [-%inf -%inf]; //Error //lsqlin: Value of beq can not be negative infinity diff --git a/tests/general_tests/lsqlin/lsqlin_infeasible1.sce b/tests/general_tests/lsqlin/lsqlin_infeasible1.sce index a66dd0f..9509309 100644 --- a/tests/general_tests/lsqlin/lsqlin_infeasible1.sce +++ b/tests/general_tests/lsqlin/lsqlin_infeasible1.sce @@ -1,15 +1,11 @@ // Check for the infeasible problem -C = [0.9501 0.7620 0.6153 0.4057 - 0.2311 0.4564 0.7919 0.9354 - 0.6068 0.0185 0.9218 0.9169 - 0.4859 0.8214 0.7382 0.4102 - 0.8912 0.4447 0.1762 0.8936]; -d = [0.0578 - 0.3528 - 0.8131 - 0.0098 - 0.1388]; -Aeq = [-1 0 0 0; 0 -1 0 0; 1 1 0 0 ]; +C = [2 0 0; + -1 1 0; + 0 2 0] +d = [1 + 0 + -1]; +Aeq = [-1 0 0; 0 -1 0; 1 1 0 ]; beq = [-6 -6 11]; //Converged to a point of local infeasibility. @@ -27,17 +23,14 @@ beq = [-6 -6 11]; // 5 // residual = // -// 0.0578 -// 0.3528 -// 0.8131 -// 0.0098 -// 0.1388 +// 1. +// 0. +// - 1. // resnorm = // -// 0.8083018 +// 2. // xopt = // // [] - [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,[],[],Aeq,beq) diff --git a/tests/general_tests/lsqlin/lsqlin_input1.sce b/tests/general_tests/lsqlin/lsqlin_input1.sce index 7521f61..5b97670 100644 --- a/tests/general_tests/lsqlin/lsqlin_input1.sce +++ b/tests/general_tests/lsqlin/lsqlin_input1.sce @@ -1,21 +1,14 @@ // Check for the input arguments -C = [0.9501 0.7620 0.6153 0.4057 - 0.2311 0.4564 0.7919 0.9354 - 0.6068 0.0185 0.9218 0.9169 - 0.4859 0.8214 0.7382 0.4102 - 0.8912 0.4447 0.1762 0.8936]; -d = [0.0578 - 0.3528 - 0.8131 - 0.0098 - 0.1388]; -A = [0.2027 0.2721 0.7467 0.4659 - 0.1987 0.1988 0.4450 0.4186 - 0.6037 0.0152 0.9318 0.8462]; -b = [0.5251 - 0.2026 - 0.6721]; - +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +A = [10 -2; + -2 10]; +b = [4 + -4]; //Error //lsqlin: Unexpected number of input arguments : 2 provided while should be in the set of [4 6 8 9 10] //at line 99 of function lsqlin called by : diff --git a/tests/general_tests/lsqlin/lsqlin_input2.sce b/tests/general_tests/lsqlin/lsqlin_input2.sce index 9826583..dbfe187 100644 --- a/tests/general_tests/lsqlin/lsqlin_input2.sce +++ b/tests/general_tests/lsqlin/lsqlin_input2.sce @@ -1,20 +1,14 @@ // Check for the input arguments -C = [0.9501 0.7620 0.6153 0.4057 - 0.2311 0.4564 0.7919 0.9354 - 0.6068 0.0185 0.9218 0.9169 - 0.4859 0.8214 0.7382 0.4102 - 0.8912 0.4447 0.1762 0.8936]; -d = [0.0578 - 0.3528 - 0.8131 - 0.0098 - 0.1388]; -A = [0.2027 0.2721 0.7467 0.4659 - 0.1987 0.1988 0.4450 0.4186 - 0.6037 0.0152 0.9318 0.8462]; -b = [0.5251 - 0.2026 - 0.6721]; +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +A = [10 -2; + -2 10]; +b = [4 + -4]; //Error //lsqlin: Unexpected number of input arguments : 14 provided while should be in the set of [4 6 8 9 10] diff --git a/tests/general_tests/lsqlin/lsqlin_logical1.sce b/tests/general_tests/lsqlin/lsqlin_logical1.sce index bc0dc06..959cc7c 100644 --- a/tests/general_tests/lsqlin/lsqlin_logical1.sce +++ b/tests/general_tests/lsqlin/lsqlin_logical1.sce @@ -1,51 +1,41 @@ -// Check for elements in A -C = [0.9501 0.7620 0.6153 0.4057 - 0.2311 0.4564 0.7919 0.9354 - 0.6068 0.0185 0.9218 0.9169 - 0.4859 0.8214 0.7382 0.4102 - 0.8912 0.4447 0.1762 0.8936]; -d = [0.0578 - 0.3528 - 0.8131 - 0.0098 - 0.1388]; -A = [0.2027 0.2721 0.7467 0.4659 - 0.1987 0.1988 0.4450 0.4186 - 0.6037 0.0152 0.9318 0.8462]; -b = [0.5251 - 0.2026 - 0.6721]; +// An example with inequality constraints +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +A = [10 -2; + -2 10]; +b = [4 + -4]; -// Output +//Output //Optimal Solution Found. // lambda = // -// lower: [0,0,0,0] -// upper: [0,0,0,0] +// lower: [0,0] +// upper: [0,0] // eqlin: [0x0 constant] -// ineqlin: [8.697D-11,0.0925859,0.1118582] +// ineqlin: [0.0000422,0.0000089] // output = // -// Iterations: 7 +// Iterations: 13 // exitflag = // // 0 // residual = // -// 0.0126031 -// 0.0208054 -// 0.1295085 -// 0.0057397 -// - 0.0137246 +// 0.3335021 +// 0.6666002 +// - 0.3332976 // resnorm = // -// 0.0175855 +// 0.6666667 // xopt = // -// 0.1298639 -// - 0.5756958 -// 0.4251033 -// 0.2438436 +// 0.3332490 +// - 0.3333512 [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b) diff --git a/tests/general_tests/lsqlin/lsqlin_maxiter.sce b/tests/general_tests/lsqlin/lsqlin_maxiter.sce new file mode 100644 index 0000000..036cf39 --- /dev/null +++ b/tests/general_tests/lsqlin/lsqlin_maxiter.sce @@ -0,0 +1,42 @@ +// Check for maxiter +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +A = [10 -2; + -2 10]; +b = [4 + -4]; +options = list("MaxIter",1); +// Output +//Maximum Number of Iterations Exceeded. Output may not be optimal. +// lambda = +// +// lower: [0x0 constant] +// upper: [0x0 constant] +// eqlin: [0x0 constant] +// ineqlin: [0x0 constant] +// output = +// +// Iterations: 1 +// exitflag = +// +// 1 +// residual = +// +// 1.0243179 +// 0.3941271 +// - 0.1874278 +// resnorm = +// +// 1.2396926 +// xopt = +// +// - 0.0121590 +// - 0.4062861 + +[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,[],[],[],[],[],options) + + diff --git a/tests/general_tests/lsqlin/lsqlin_param1.sce b/tests/general_tests/lsqlin/lsqlin_param1.sce index a9d24bc..65aff86 100644 --- a/tests/general_tests/lsqlin/lsqlin_param1.sce +++ b/tests/general_tests/lsqlin/lsqlin_param1.sce @@ -1,20 +1,14 @@ // Check for the param to be a list -C = [0.9501 0.7620 0.6153 0.4057 - 0.2311 0.4564 0.7919 0.9354 - 0.6068 0.0185 0.9218 0.9169 - 0.4859 0.8214 0.7382 0.4102 - 0.8912 0.4447 0.1762 0.8936]; -d = [0.0578 - 0.3528 - 0.8131 - 0.0098 - 0.1388]; -A = [0.2027 0.2721 0.7467 0.4659 - 0.1987 0.1988 0.4450 0.4186 - 0.6037 0.0152 0.9318 0.8462]; -b = [0.5251 - 0.2026 - 0.6721]; +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +A = [10 -2; + -2 10]; +b = [4 + -4]; param = 0; //Error diff --git a/tests/general_tests/lsqlin/lsqlin_param2.sce b/tests/general_tests/lsqlin/lsqlin_param2.sce index bb7cffa..f780759 100644 --- a/tests/general_tests/lsqlin/lsqlin_param2.sce +++ b/tests/general_tests/lsqlin/lsqlin_param2.sce @@ -1,20 +1,14 @@ // Check for the param to be even in number -C = [0.9501 0.7620 0.6153 0.4057 - 0.2311 0.4564 0.7919 0.9354 - 0.6068 0.0185 0.9218 0.9169 - 0.4859 0.8214 0.7382 0.4102 - 0.8912 0.4447 0.1762 0.8936]; -d = [0.0578 - 0.3528 - 0.8131 - 0.0098 - 0.1388]; -A = [0.2027 0.2721 0.7467 0.4659 - 0.1987 0.1988 0.4450 0.4186 - 0.6037 0.0152 0.9318 0.8462]; -b = [0.5251 - 0.2026 - 0.6721]; +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +A = [10 -2; + -2 10]; +b = [4 + -4]; param = list("MaxIter"); //Error diff --git a/tests/general_tests/lsqlin/lsqlin_param3.sce b/tests/general_tests/lsqlin/lsqlin_param3.sce index 60e960d..283c6e2 100644 --- a/tests/general_tests/lsqlin/lsqlin_param3.sce +++ b/tests/general_tests/lsqlin/lsqlin_param3.sce @@ -1,20 +1,14 @@ // Check for the param to be even in number -C = [0.9501 0.7620 0.6153 0.4057 - 0.2311 0.4564 0.7919 0.9354 - 0.6068 0.0185 0.9218 0.9169 - 0.4859 0.8214 0.7382 0.4102 - 0.8912 0.4447 0.1762 0.8936]; -d = [0.0578 - 0.3528 - 0.8131 - 0.0098 - 0.1388]; -A = [0.2027 0.2721 0.7467 0.4659 - 0.1987 0.1988 0.4450 0.4186 - 0.6037 0.0152 0.9318 0.8462]; -b = [0.5251 - 0.2026 - 0.6721]; +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +A = [10 -2; + -2 10]; +b = [4 + -4]; param = list("Iter",300); //Error diff --git a/tests/general_tests/lsqlin/lsqlin_x01.sce b/tests/general_tests/lsqlin/lsqlin_x01.sce index 3b0f6f9..d014443 100644 --- a/tests/general_tests/lsqlin/lsqlin_x01.sce +++ b/tests/general_tests/lsqlin/lsqlin_x01.sce @@ -1,20 +1,14 @@ -// Check for elements in A -C = [0.9501 0.7620 0.6153 0.4057 - 0.2311 0.4564 0.7919 0.9354 - 0.6068 0.0185 0.9218 0.9169 - 0.4859 0.8214 0.7382 0.4102 - 0.8912 0.4447 0.1762 0.8936]; -d = [0.0578 - 0.3528 - 0.8131 - 0.0098 - 0.1388]; -A = [0.2027 0.2721 0.7467 0.4659 - 0.1987 0.1988 0.4450 0.4186 - 0.6037 0.0152 0.9318 0.8462]; -b = [0.5251 - 0.2026 - 0.6721]; +// Test for intial guess +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +A = [10 -2; + -2 10]; +b = [4 + -4]; x0 = [0 0 0]; //WARNING: lsqlin: Ignoring initial guess of variables as it is not equal to the number of variables @@ -22,32 +16,28 @@ x0 = [0 0 0]; //Optimal Solution Found. // lambda = // -// lower: [0,0,0,0] -// upper: [0,0,0,0] +// lower: [0,0] +// upper: [0,0] // eqlin: [0x0 constant] -// ineqlin: [8.697D-11,0.0925859,0.1118582] +// ineqlin: [0.0000422,0.0000089] // output = // -// Iterations: 7 +// Iterations: 13 // exitflag = // // 0 // residual = // -// 0.0126031 -// 0.0208054 -// 0.1295085 -// 0.0057397 -// - 0.0137246 +// 0.3335021 +// 0.6666002 +// - 0.3332976 // resnorm = // -// 0.0175855 +// 0.6666667 // xopt = // -// 0.1298639 -// - 0.5756958 -// 0.4251033 -// 0.2438436 +// 0.3332490 +// - 0.3333512 [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,[],[],[],[],x0) diff --git a/tests/general_tests/lsqlin/lsqlin_zeros.sce b/tests/general_tests/lsqlin/lsqlin_zeros.sce new file mode 100644 index 0000000..2695ff1 --- /dev/null +++ b/tests/general_tests/lsqlin/lsqlin_zeros.sce @@ -0,0 +1,32 @@ +// Check for all zeros +C = [0]; +d = [0]; +A = [0]; +b = [0]; +// Output +//Optimal Solution Found. +// lambda = +// +// lower: 0 +// upper: 0 +// eqlin: [0x0 constant] +// ineqlin: 0.999901 +// output = +// +// Iterations: 2 +// exitflag = +// +// 0 +// residual = +// +// 0. +// resnorm = +// +// 0. +// xopt = +// +// 0. + +[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b) + + 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) + diff --git a/tests/general_tests/qpipopt/qpipopt_logical_2.sce b/tests/general_tests/qpipopt/qpipopt_logical_2.sce index a61e416..7a75ebe 100644 --- a/tests/general_tests/qpipopt/qpipopt_logical_2.sce +++ b/tests/general_tests/qpipopt/qpipopt_logical_2.sce @@ -1,4 +1,3 @@ - // A simple example without constraints A= []; conLB=[]; diff --git a/tests/general_tests/qpipopt/qpipopt_maxiter.sce b/tests/general_tests/qpipopt/qpipopt_maxiter.sce new file mode 100644 index 0000000..5851630 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_maxiter.sce @@ -0,0 +1,46 @@ +//Find x in R^6 such that: +// A simple example with constraints +A= [1,-1,1,0,3,1; +-1,0,-3,-4,5,6; +2,5,3,0,1,0 +0,1,0,1,2,-1; +-1,0,2,1,1,0]; +conLB=[1;2;3;-%inf;-%inf]; +conUB = [1;2;3;-1;2.5]; +lb=[-1000;-10000; 0; -1000; -1000; -1000]; +ub=[10000; 100; 1.5; 100; 100; 1000]; +//and minimize 0.5*x'*H*x + f'*x with +f=[1; 2; 3; 4; 5; 6]; H=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 1); + +//Output +//Maximum Number of Iterations Exceeded. Output may not be optimal. +// lambda = +// +// lower: [0x0 constant] +// upper: [0x0 constant] +// constraint: [0x0 constant] +// output = +// +// Iterations: 1 +// exitflag = +// +// 1 +// fopt = +// +// - 9.9784864 +// xopt = +// +// 0.9103357 +// - 0.1104630 +// 0.0476471 +// - 2.0070896 +// 0.2116560 +// - 1.1624291 + +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0,param) + + diff --git a/tests/general_tests/qpipopt/qpipopt_zeros.sce b/tests/general_tests/qpipopt/qpipopt_zeros.sce new file mode 100644 index 0000000..9604c4d --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_zeros.sce @@ -0,0 +1,42 @@ + +// A simple example without constraints and all values to zero +A= []; +conLB=[]; +conUB = []; +lb=[]; +ub=[]; +f=[0]'; +H =[0]; +nbVar = 1; +nbCon = 0; + + +//Output +// +//Optimal Solution Found. + +// lower: 0 +// upper: 0 +// constraint: [0x0 constant] +// +// lambda +// +// Iterations: 0 +// +// output +// +// 0 +// +// exitflag +// +// 0. +// +// fopt +// +// 0. +// +// xopt + +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB) + + diff --git a/tests/general_tests/qpipoptmat/qpipoptmat_logical2.sce b/tests/general_tests/qpipoptmat/qpipoptmat_logical2.sce index 9f11d1d..e316253 100644 --- a/tests/general_tests/qpipoptmat/qpipoptmat_logical2.sce +++ b/tests/general_tests/qpipoptmat/qpipoptmat_logical2.sce @@ -11,7 +11,7 @@ b = [-1; 2.5]; lb=[-1000; -10000; 0; -1000; -1000; -1000]; ub=[10000; 100; 1.5; 100; 100; 1000]; param = list("MaxIter", 300, "CpuTime",100); -//and minimize 0.5*x'*Q*x + p'*x with +//and minimize 0.5*x'*H*x + f'*x with f=[1; 2; 3; 4; 5; 6]; H=eye(6,6); [xopt,fopt,exitflag,output,lambda]=qpipoptmat(H,f,A,b,Aeq,beq,lb,ub,[],param); diff --git a/tests/general_tests/qpipoptmat/qpipoptmat_maxiter.sce b/tests/general_tests/qpipoptmat/qpipoptmat_maxiter.sce new file mode 100644 index 0000000..5e4b0e5 --- /dev/null +++ b/tests/general_tests/qpipoptmat/qpipoptmat_maxiter.sce @@ -0,0 +1,44 @@ +//Find x in R^6 such that: +// A simple example with constraints + +Aeq= [1,-1,1,0,3,1; +-1,0,-3,-4,5,6; +2,5,3,0,1,0]; +beq=[1; 2; 3]; +A= [0,1,0,1,2,-1; +-1,0,2,1,1,0]; +b = [-1; 2.5]; +lb=[-1000; -10000; 0; -1000; -1000; -1000]; +ub=[10000; 100; 1.5; 100; 100; 1000]; +param = list("MaxIter", 1); +//and minimize 0.5*x'*H*x + f'*x with +f=[1; 2; 3; 4; 5; 6]; H=eye(6,6); + +//Output +// +//Maximum Number of Iterations Exceeded. Output may not be optimal. +// lambda = +// +// lower: [0x0 constant] +// upper: [0x0 constant] +// eqlin: [0x0 constant] +// ineqlin: [0x0 constant] +// output = +// +// Iterations: 1 +// exitflag = +// +// 1 +// fopt = +// +// - 9.9784864 +// xopt = +// +// 0.9103357 +// - 0.1104630 +// 0.0476471 +// - 2.0070896 +// 0.2116560 +// - 1.1624291 +[xopt,fopt,exitflag,output,lambda]=qpipoptmat(H,f,A,b,Aeq,beq,lb,ub,[],param) + diff --git a/tests/general_tests/qpipoptmat/qpipoptmat_zeros.sce b/tests/general_tests/qpipoptmat/qpipoptmat_zeros.sce new file mode 100644 index 0000000..ee9cfc9 --- /dev/null +++ b/tests/general_tests/qpipoptmat/qpipoptmat_zeros.sce @@ -0,0 +1,35 @@ +// A simple example without constraints + +f=[0]'; +H =[0]; + +//Output +// +//Optimal Solution Found. +// +// lower: 0 +// upper: 0 +// eqlin: [0x0 constant] +// ineqlin: [0x0 constant] +// +// lambda +// +// Iterations: 0 +// +// output +// +// 0 +// +// exitflag +// +// 0. +// +// fopt +// +// 0. +// +// xopt + + +[xopt,fopt,exitflag,output,lambda]=qpipoptmat(H,f); + diff --git a/tests/general_tests/symphony/symphony_logical2.sce b/tests/general_tests/symphony/symphony_logical2.sce index 5d0989f..9f34cc0 100644 --- a/tests/general_tests/symphony/symphony_logical2.sce +++ b/tests/general_tests/symphony/symphony_logical2.sce @@ -12,9 +12,9 @@ ub = repmat(%inf,3,1); // Constraint Matrix A = [3,2,5; - 2,1,1; - 1,1,3; - 5,2,4] + 2,1,1; + 1,1,3; + 5,2,4] // Lower Bound of constrains conlb = repmat(-%inf,4,1) diff --git a/tests/general_tests/symphony/symphony_zeros.sce b/tests/general_tests/symphony/symphony_zeros.sce new file mode 100644 index 0000000..a6615f6 --- /dev/null +++ b/tests/general_tests/symphony/symphony_zeros.sce @@ -0,0 +1,46 @@ +// Check for size of Objective Coefficient +// A basic case : + +// Objective function +c = [0 0 0]'; + +// Lower Bound of variable +lb = []; + +// Upper Bound of variables +ub = []; + +// Constraint Matrix +A = [] + +// Lower Bound of constrains +conlb = [] + +// Upper Bound of constrains +conub = [] + +// Row Matrix for telling symphony that the is integer or not +isInt = [repmat(%f,1,3)]; + +// Output +//Problem loaded into environment. +//Note: There is no limit on time. +//An optimal solution has been found. +// output = +// +// Iterations: 1 +// status = +// +// 227. +// f = +// +// 0. +// x = +// +// 0. +// 0. +// 0. + +// Calling Symphony +[x,f,status,output] = symphony(3,0,c,isInt,lb,ub,A,conlb,conub,-1) + |