diff options
author | Harpreet | 2015-12-22 16:45:38 +0530 |
---|---|---|
committer | Harpreet | 2015-12-22 16:45:38 +0530 |
commit | 0eee95dfb1edec6ce52ec3065a3adb1bf169c9f9 (patch) | |
tree | 1a38ee971248f8c1efe226dced15b66764c412d1 /tests/general_tests/qpipopt | |
parent | b4fe1077092f3dc1c1d965e938b00e0a0d0694d0 (diff) | |
download | FOSSEE-Optimization-toolbox-0eee95dfb1edec6ce52ec3065a3adb1bf169c9f9.tar.gz FOSSEE-Optimization-toolbox-0eee95dfb1edec6ce52ec3065a3adb1bf169c9f9.tar.bz2 FOSSEE-Optimization-toolbox-0eee95dfb1edec6ce52ec3065a3adb1bf169c9f9.zip |
general tests added
Diffstat (limited to 'tests/general_tests/qpipopt')
24 files changed, 620 insertions, 0 deletions
diff --git a/tests/general_tests/qpipopt/qpipopt_LB1.sce b/tests/general_tests/qpipopt/qpipopt_LB1.sce new file mode 100644 index 0000000..b2b92ce --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_LB1.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Check if the user gives lower bound unequal to the number of variables +conMatrix= [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]; +ub=[10000; 100; 1.5; 100; 100; 1000]; +//and minimize 0.5*x'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: The Lower Bound is not equal to the number of variables +//at line 191 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_LB2.sce b/tests/general_tests/qpipopt/qpipopt_LB2.sce new file mode 100644 index 0000000..e6df705 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_LB2.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Check if the user gives lower bound as a row vector +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: The Lower Bound should be a column vector +//at line 188 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_Q1.sce b/tests/general_tests/qpipopt/qpipopt_Q1.sce new file mode 100644 index 0000000..06cceea --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_Q1.sce @@ -0,0 +1,24 @@ +//Find x in R^6 such that: +// Check for the size of Q matrix +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(5,5); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//error +// +//qpipopt: The Size of Q is not equal to the number of variables +//at line 158 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_Q2.sce b/tests/general_tests/qpipopt/qpipopt_Q2.sce new file mode 100644 index 0000000..ea23ee4 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_Q2.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Check for the Q to be a symmetric matrix +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,5); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: Q is not a symmetric matrix +//at line 152 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_UB1.sce b/tests/general_tests/qpipopt/qpipopt_UB1.sce new file mode 100644 index 0000000..155c695 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_UB1.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: + // Check if the user gives unequal size of Upper Bound as of the number of variables +conMatrix= [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]; +//and minimize 0.5*x'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: The Upper Bound is not equal to the number of variables +//at line 201 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_UB2.sce b/tests/general_tests/qpipopt/qpipopt_UB2.sce new file mode 100644 index 0000000..a4f5270 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_UB2.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Check if the user gives Upper Bound matrix as a row vector +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: The Upper Bound should be a column vector +//at line 224 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_conLB1.sce b/tests/general_tests/qpipopt/qpipopt_conLB1.sce new file mode 100644 index 0000000..09105e7 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_conLB1.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Checking if a user gives less or number of constraints Lower Bound +conMatrix= [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]; +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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: The Lower Bound of constraints is not equal to the number of constraints +//at line 211 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_conLB2.sce b/tests/general_tests/qpipopt/qpipopt_conLB2.sce new file mode 100644 index 0000000..d0236c0 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_conLB2.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Checking if a user gives a column vector +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: The Lower Bound should be a column vector +//at line 208 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_conMatrix1.sce b/tests/general_tests/qpipopt/qpipopt_conMatrix1.sce new file mode 100644 index 0000000..96ee3eb --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_conMatrix1.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Check if a user gives unequal number of constraints as given by him + +conMatrix= [1,-1,1,0,3,1; +-1,0,-3,-4,5,6; +2,5,3,0,1,0 +0,1,0,1,2,-1;]; +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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: The number of constraints is not equal to the number of constraint given i.e. 5 +//at line 181 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_conMatrix2.sce b/tests/general_tests/qpipopt/qpipopt_conMatrix2.sce new file mode 100644 index 0000000..f5e3106 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_conMatrix2.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +//Check for the size of constraints +conMatrix= [-1,1,0,3,1; +-1,0,-3,-4,5; +2,5,3,0,1 +0,1,0,1,2; +-1,0,2,1,1]; +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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: The size of constraints is not equal to the number of variables +//at line 175 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_conUB1.sce b/tests/general_tests/qpipopt/qpipopt_conUB1.sce new file mode 100644 index 0000000..2c4bfa6 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_conUB1.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Check for the Upper Bound of constraints is which should be equal to the number of constraints +conMatrix= [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]; +lb=[-1000;-10000; 0; -1000; -1000; -1000]; +ub=[10000; 100; 1.5; 100; 100; 1000]; +//and minimize 0.5*x'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: The Upper Bound of constraints is not equal to the number of constraints +//at line 221 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_conUB2.sce b/tests/general_tests/qpipopt/qpipopt_conUB2.sce new file mode 100644 index 0000000..33b3f2d --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_conUB2.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Check for the Upper Bound of the constraints which should be a column vector +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: The Upper Bound should be a column vector +//at line 218 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_input.sce b/tests/general_tests/qpipopt/qpipopt_input.sce new file mode 100644 index 0000000..08bd468 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_input.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Check for the number of inputs +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB) + +//Error +//qpipopt: Unexpected number of input arguments : 8 provided while should be 9, 10 or 11 +//at line 91 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB) diff --git a/tests/general_tests/qpipopt/qpipopt_input2.sce b/tests/general_tests/qpipopt/qpipopt_input2.sce new file mode 100644 index 0000000..decc8a8 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_input2.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Check if the number of input is more +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,5); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param,[]) + +//Error +//qpipopt: Unexpected number of input arguments : 12 provided while should be 9, 10 or 11 +//at line 91 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB) diff --git a/tests/general_tests/qpipopt/qpipopt_logical_1.sce b/tests/general_tests/qpipopt/qpipopt_logical_1.sce new file mode 100644 index 0000000..03853a7 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_logical_1.sce @@ -0,0 +1,51 @@ +//Find x in R^6 such that: +// A simple example with constraints +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +disp("xopt",xopt,"fopt",fopt,"exitflag",exitflag,"output",output,"lambda",lambda) + +//Output +// +//Optimal Solution Found. +// +// lower: [1x6 constant] +// upper: [1x6 constant] +// constraint: [1x5 constant] +// +// lambda +// +// Iterations: 13 +// +// output +// +// 0 +// +// exitflag +// +// - 14.843248 +// +// fopt +// +// 1.7975426 +// - 0.3381487 +// 0.1633880 +// - 4.9884023 +// 0.6054943 +// - 3.1155623 +// +// xopt diff --git a/tests/general_tests/qpipopt/qpipopt_logical_2.sce b/tests/general_tests/qpipopt/qpipopt_logical_2.sce new file mode 100644 index 0000000..933508b --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_logical_2.sce @@ -0,0 +1,42 @@ + +// A simple example without constraints +conMatrix= []; +conLB=[]; +conUB = []; +lb=[]; +ub=[]; +p=[2 -35 -47]'; +Q =[5 -2 -1; -2 4 3; -1 3 5]; +nbVar = 3; +nbCon = 0; +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB) +disp("xopt",xopt,"fopt",fopt,"exitflag",exitflag,"output",output,"lambda",lambda) + + +//Output +// +//Optimal Solution Found. +// +// lower: [0,0,0] +// upper: [0,0,0] +// constraint: [0x0 constant] +// +// lambda +// +// Iterations: 1 +// +// output +// +// 0 +// +// exitflag +// +// - 249. +// +// fopt +// +// 3. +// 5. +// 7. +// +// xopt diff --git a/tests/general_tests/qpipopt/qpipopt_options1.sce b/tests/general_tests/qpipopt/qpipopt_options1.sce new file mode 100644 index 0000000..6cebc51 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_options1.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +//Check if the user gives uneven number of parameters +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: Size of parameters should be even +//at line 120 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_options2.sce b/tests/general_tests/qpipopt/qpipopt_options2.sce new file mode 100644 index 0000000..ba5208b --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_options2.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Check if the user gives different parameter other than predefined +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "Time", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: Unrecognized parameter name 'Time'. +//at line 137 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_options3.sce b/tests/general_tests/qpipopt/qpipopt_options3.sce new file mode 100644 index 0000000..b267d77 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_options3.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Check if the user for a list for the param +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = ["MaxIter", "CpuTime"]; +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: param should be a list +//at line 120 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_p1.sce b/tests/general_tests/qpipopt/qpipopt_p1.sce new file mode 100644 index 0000000..2e9ed37 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_p1.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Check if the user gives unequal size of 'p' as of the number of variables +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: The Size of p is not equal to the number of variables +//at line 168 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_p2.sce b/tests/general_tests/qpipopt/qpipopt_p2.sce new file mode 100644 index 0000000..2e9ed37 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_p2.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Check if the user gives unequal size of 'p' as of the number of variables +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: The Size of p is not equal to the number of variables +//at line 168 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_x0.sce b/tests/general_tests/qpipopt/qpipopt_x0.sce new file mode 100644 index 0000000..ef69b3d --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_x0.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Check if the user gives initial guess matrix as a row vector +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,1,nbVar); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: The initial guess should be a column vector +//at line 228 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) diff --git a/tests/general_tests/qpipopt/qpipopt_x01.sce b/tests/general_tests/qpipopt/qpipopt_x01.sce new file mode 100644 index 0000000..6a57269 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_x01.sce @@ -0,0 +1,43 @@ +//Find x in R^6 such that: +// Check if the user gives unequal size of initial guess as of the number of variables +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,5,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +// WARNING: qpipopt: Ignoring initial guess of variables as it is not equal to the number of variables +// lambda = +// +// lower: [1x6 constant] +// upper: [1x6 constant] +// constraint: [1x5 constant] +// output = +// +// Iterations: 13 +// exitflag = +// +// 0 +// fopt = +// +// - 14.843248 +// xopt = +// +// 1.7975426 +// - 0.3381487 +// 0.1633880 +// - 4.9884023 +// 0.6054943 +// - 3.1155623 diff --git a/tests/general_tests/qpipopt/qpipopt_x02.sce b/tests/general_tests/qpipopt/qpipopt_x02.sce new file mode 100644 index 0000000..52b0b89 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_x02.sce @@ -0,0 +1,23 @@ +//Find x in R^6 such that: +// Check if the user gives unequal size of initial guess as of the number of variables +conMatrix= [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'*Q*x + p'*x with +p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,5,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) + +//Error +//qpipopt: The initial guess of variables is not equal to the number of variables +//at line 231 of function qpipopt called by : +//[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) |