summaryrefslogtreecommitdiff
path: root/tests/general_tests/lsqlin
diff options
context:
space:
mode:
Diffstat (limited to 'tests/general_tests/lsqlin')
-rw-r--r--tests/general_tests/lsqlin/lsqlin_A1.sce25
-rw-r--r--tests/general_tests/lsqlin/lsqlin_Aeq1.sce25
-rw-r--r--tests/general_tests/lsqlin/lsqlin_C1.sce26
-rw-r--r--tests/general_tests/lsqlin/lsqlin_b1.sce23
-rw-r--r--tests/general_tests/lsqlin/lsqlin_beq1.sce23
-rw-r--r--tests/general_tests/lsqlin/lsqlin_infeasible1.sce43
-rw-r--r--tests/general_tests/lsqlin/lsqlin_input1.sce25
-rw-r--r--tests/general_tests/lsqlin/lsqlin_input2.sce25
-rw-r--r--tests/general_tests/lsqlin/lsqlin_logical1.sce52
-rw-r--r--tests/general_tests/lsqlin/lsqlin_param1.sce26
-rw-r--r--tests/general_tests/lsqlin/lsqlin_param2.sce26
-rw-r--r--tests/general_tests/lsqlin/lsqlin_param3.sce26
-rw-r--r--tests/general_tests/lsqlin/lsqlin_x01.sce54
13 files changed, 399 insertions, 0 deletions
diff --git a/tests/general_tests/lsqlin/lsqlin_A1.sce b/tests/general_tests/lsqlin/lsqlin_A1.sce
new file mode 100644
index 0000000..ba9b5be
--- /dev/null
+++ b/tests/general_tests/lsqlin/lsqlin_A1.sce
@@ -0,0 +1,25 @@
+// 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];
+
+//Error
+//lsqlin: The number of columns in A must be the same as the number of elements of d
+//at line 213 of function lsqlin called by :
+//[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b)
+
+[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
new file mode 100644
index 0000000..458cbb0
--- /dev/null
+++ b/tests/general_tests/lsqlin/lsqlin_Aeq1.sce
@@ -0,0 +1,25 @@
+// 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];
+
+//Error
+//lsqlin: The number of columns in Aeq must be the same as the number of elements of d
+//at line 219 of function lsqlin called by :
+//[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,[],[],Aeq,beq)
+
+[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
new file mode 100644
index 0000000..55fe976
--- /dev/null
+++ b/tests/general_tests/lsqlin/lsqlin_C1.sce
@@ -0,0 +1,26 @@
+// 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];
+
+//Error
+//lsqlin: The number of rows in C must be equal the number of elements of d
+//at line 207 of function lsqlin called by :
+//[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b)
+
+[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b)
+
diff --git a/tests/general_tests/lsqlin/lsqlin_b1.sce b/tests/general_tests/lsqlin/lsqlin_b1.sce
new file mode 100644
index 0000000..49b6dec
--- /dev/null
+++ b/tests/general_tests/lsqlin/lsqlin_b1.sce
@@ -0,0 +1,23 @@
+// 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];
+
+//Error
+//lsqlin: Value of b can not be negative infinity
+//at line 286 of function lsqlin called by :
+//[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b)
+
+[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b)
+
diff --git a/tests/general_tests/lsqlin/lsqlin_beq1.sce b/tests/general_tests/lsqlin/lsqlin_beq1.sce
new file mode 100644
index 0000000..b71486e
--- /dev/null
+++ b/tests/general_tests/lsqlin/lsqlin_beq1.sce
@@ -0,0 +1,23 @@
+// 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];
+
+//Error
+//lsqlin: Value of beq can not be negative infinity
+//at line 293 of function lsqlin called by :
+//[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,[],[],Aeq,beq)
+
+[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,[],[],Aeq,beq)
+
diff --git a/tests/general_tests/lsqlin/lsqlin_infeasible1.sce b/tests/general_tests/lsqlin/lsqlin_infeasible1.sce
new file mode 100644
index 0000000..a66dd0f
--- /dev/null
+++ b/tests/general_tests/lsqlin/lsqlin_infeasible1.sce
@@ -0,0 +1,43 @@
+// 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 ];
+beq = [-6 -6 11];
+
+//Converged to a point of local infeasibility.
+// lambda =
+//
+// lower: [0x0 constant]
+// upper: [0x0 constant]
+// eqlin: [0x0 constant]
+// ineqlin: [0x0 constant]
+// output =
+//
+// Iterations: 0
+// exitflag =
+//
+// 5
+// residual =
+//
+// 0.0578
+// 0.3528
+// 0.8131
+// 0.0098
+// 0.1388
+// resnorm =
+//
+// 0.8083018
+// 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
new file mode 100644
index 0000000..7521f61
--- /dev/null
+++ b/tests/general_tests/lsqlin/lsqlin_input1.sce
@@ -0,0 +1,25 @@
+// 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];
+
+//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 :
+//[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d)
+
+[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d)
+
diff --git a/tests/general_tests/lsqlin/lsqlin_input2.sce b/tests/general_tests/lsqlin/lsqlin_input2.sce
new file mode 100644
index 0000000..9826583
--- /dev/null
+++ b/tests/general_tests/lsqlin/lsqlin_input2.sce
@@ -0,0 +1,25 @@
+// 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];
+
+//Error
+//lsqlin: Unexpected number of input arguments : 14 provided while should be in the set of [4 6 8 9 10]
+//at line 99 of function lsqlin called by :
+//[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,[],[],[],[],[],[],[],[],[],[])
+
+[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,[],[],[],[],[],[],[],[],[],[])
+
diff --git a/tests/general_tests/lsqlin/lsqlin_logical1.sce b/tests/general_tests/lsqlin/lsqlin_logical1.sce
new file mode 100644
index 0000000..bc0dc06
--- /dev/null
+++ b/tests/general_tests/lsqlin/lsqlin_logical1.sce
@@ -0,0 +1,52 @@
+// 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];
+
+// Output
+//Optimal Solution Found.
+// lambda =
+//
+// lower: [0,0,0,0]
+// upper: [0,0,0,0]
+// eqlin: [0x0 constant]
+// ineqlin: [8.697D-11,0.0925859,0.1118582]
+// output =
+//
+// Iterations: 7
+// exitflag =
+//
+// 0
+// residual =
+//
+// 0.0126031
+// 0.0208054
+// 0.1295085
+// 0.0057397
+// - 0.0137246
+// resnorm =
+//
+// 0.0175855
+// xopt =
+//
+// 0.1298639
+// - 0.5756958
+// 0.4251033
+// 0.2438436
+
+[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b)
+
+
diff --git a/tests/general_tests/lsqlin/lsqlin_param1.sce b/tests/general_tests/lsqlin/lsqlin_param1.sce
new file mode 100644
index 0000000..a9d24bc
--- /dev/null
+++ b/tests/general_tests/lsqlin/lsqlin_param1.sce
@@ -0,0 +1,26 @@
+// 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];
+param = 0;
+
+//Error
+//lsqlin: param should be a list
+//at line 147 of function lsqlin called by :
+//[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,[],[],[],[],[],0)
+
+[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,[],[],[],[],[],param)
+
diff --git a/tests/general_tests/lsqlin/lsqlin_param2.sce b/tests/general_tests/lsqlin/lsqlin_param2.sce
new file mode 100644
index 0000000..bb7cffa
--- /dev/null
+++ b/tests/general_tests/lsqlin/lsqlin_param2.sce
@@ -0,0 +1,26 @@
+// 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];
+param = list("MaxIter");
+
+//Error
+//lsqlin: Size of parameters should be even
+//at line 153 of function lsqlin called by :
+//[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,[],[],[],[],[],param)
+
+[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,[],[],[],[],[],param)
+
diff --git a/tests/general_tests/lsqlin/lsqlin_param3.sce b/tests/general_tests/lsqlin/lsqlin_param3.sce
new file mode 100644
index 0000000..60e960d
--- /dev/null
+++ b/tests/general_tests/lsqlin/lsqlin_param3.sce
@@ -0,0 +1,26 @@
+// 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];
+param = list("Iter",300);
+
+//Error
+//lsqlin: Unrecognized parameter name 'Iter'.
+//at line 180 of function lsqlin called by :
+//[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,[],[],[],[],[],param)
+
+[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,[],[],[],[],[],param)
+
diff --git a/tests/general_tests/lsqlin/lsqlin_x01.sce b/tests/general_tests/lsqlin/lsqlin_x01.sce
new file mode 100644
index 0000000..3b0f6f9
--- /dev/null
+++ b/tests/general_tests/lsqlin/lsqlin_x01.sce
@@ -0,0 +1,54 @@
+// 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];
+x0 = [0 0 0];
+
+//WARNING: lsqlin: Ignoring initial guess of variables as it is not equal to the number of variables
+
+//Optimal Solution Found.
+// lambda =
+//
+// lower: [0,0,0,0]
+// upper: [0,0,0,0]
+// eqlin: [0x0 constant]
+// ineqlin: [8.697D-11,0.0925859,0.1118582]
+// output =
+//
+// Iterations: 7
+// exitflag =
+//
+// 0
+// residual =
+//
+// 0.0126031
+// 0.0208054
+// 0.1295085
+// 0.0057397
+// - 0.0137246
+// resnorm =
+//
+// 0.0175855
+// xopt =
+//
+// 0.1298639
+// - 0.5756958
+// 0.4251033
+// 0.2438436
+
+[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,[],[],[],[],x0)
+
+