diff options
author | Harpreet | 2016-01-07 17:14:07 +0530 |
---|---|---|
committer | Harpreet | 2016-01-07 17:14:07 +0530 |
commit | dd3d72ae2cdb43311b4e501966f09694bbd3e505 (patch) | |
tree | 22a62596c6cae995f4693d75d52d96cd787c40b8 /tests/general_tests/qpipopt | |
parent | dad86bd42cdc2a0e56df9e0591879e5d26fd56fa (diff) | |
download | FOSSEE-Optimization-toolbox-dd3d72ae2cdb43311b4e501966f09694bbd3e505.tar.gz FOSSEE-Optimization-toolbox-dd3d72ae2cdb43311b4e501966f09694bbd3e505.tar.bz2 FOSSEE-Optimization-toolbox-dd3d72ae2cdb43311b4e501966f09694bbd3e505.zip |
lower bound, upper bound test added
Diffstat (limited to 'tests/general_tests/qpipopt')
-rw-r--r-- | tests/general_tests/qpipopt/qpipopt_logical_1.sce | 2 | ||||
-rw-r--r-- | tests/general_tests/qpipopt/qpipopt_logical_2.sce | 55 | ||||
-rw-r--r-- | tests/general_tests/qpipopt/qpipopt_logical_3.sce | 52 | ||||
-rw-r--r-- | tests/general_tests/qpipopt/qpipopt_logical_4.sce | 39 | ||||
-rw-r--r-- | tests/general_tests/qpipopt/qpipopt_logical_5.sce | 38 |
5 files changed, 162 insertions, 24 deletions
diff --git a/tests/general_tests/qpipopt/qpipopt_logical_1.sce b/tests/general_tests/qpipopt/qpipopt_logical_1.sce index 54ba0a0..91da1bb 100644 --- a/tests/general_tests/qpipopt/qpipopt_logical_1.sce +++ b/tests/general_tests/qpipopt/qpipopt_logical_1.sce @@ -1,5 +1,5 @@ //Find x in R^6 such that: -// A simple example with constraints +// An example with constraints, variable bounds, intial guess and param A= [1,-1,1,0,3,1; -1,0,-3,-4,5,6; 2,5,3,0,1,0 diff --git a/tests/general_tests/qpipopt/qpipopt_logical_2.sce b/tests/general_tests/qpipopt/qpipopt_logical_2.sce index d00b07b..027c9c5 100644 --- a/tests/general_tests/qpipopt/qpipopt_logical_2.sce +++ b/tests/general_tests/qpipopt/qpipopt_logical_2.sce @@ -1,44 +1,53 @@ -// A simple example without constraints -A= []; -conLB=[]; -conUB = []; -lb=[]; -ub=[]; -f=[2 -35 -47]'; -H =[5 -2 -1; -2 4 3; -1 3 5]; -nbVar = 3; -nbCon = 0; - +//Find x in R^6 such that: +// An example with constraints, variable bounds and intial guess +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); //Output // //Optimal Solution Found. -// -// lower: [0,0,0] -// upper: [0,0,0] -// constraint: [0x0 constant] +// +// lower: [1x6 constant] +// upper: [1x6 constant] +// constraint: [1x5 constant] // // lambda // -// Iterations: 1 -// ConstrViolation: 0 +// Iterations: 13 +// ConstrViolation: 9.968D-09 // output // // 0 // // exitflag // -// - 249. +// - 14.843248 // // fopt // -// 3. -// 5. -// 7. +// 1.7975426 +// - 0.3381487 +// 0.1633880 +// - 4.9884023 +// 0.6054943 +// - 3.1155623 // // xopt -[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB); -disp("xopt",xopt,"fopt",fopt,"exitflag",exitflag,"output",output,"lambda",lambda); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0); + +disp("xopt",xopt,"fopt",fopt,"exitflag",exitflag,"output",output,"lambda",lambda) diff --git a/tests/general_tests/qpipopt/qpipopt_logical_3.sce b/tests/general_tests/qpipopt/qpipopt_logical_3.sce new file mode 100644 index 0000000..f2e80c9 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_logical_3.sce @@ -0,0 +1,52 @@ +//Find x in R^6 such that: +// An example with constraints and variable bounds +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; + +//Output +// +//Optimal Solution Found. +// +// lower: [1x6 constant] +// upper: [1x6 constant] +// constraint: [1x5 constant] +// +// lambda +// +// Iterations: 13 +// ConstrViolation: 9.968D-09 +// output +// +// 0 +// +// exitflag +// +// - 14.843248 +// +// fopt +// +// 1.7975426 +// - 0.3381487 +// 0.1633880 +// - 4.9884023 +// 0.6054943 +// - 3.1155623 +// +// xopt + +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB); + +disp("xopt",xopt,"fopt",fopt,"exitflag",exitflag,"output",output,"lambda",lambda) + + diff --git a/tests/general_tests/qpipopt/qpipopt_logical_4.sce b/tests/general_tests/qpipopt/qpipopt_logical_4.sce new file mode 100644 index 0000000..28c4f32 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_logical_4.sce @@ -0,0 +1,39 @@ +// A simple example without constraints +A= []; +conLB=[]; +conUB = []; +lb=repmat(0,3,1); +ub=repmat(3,3,1); +f=[2 -35 -47]'; +H =[5 -2 -1; -2 4 3; -1 3 5]; +nbVar = 3; +nbCon = 0; + + +//Output +// +//Optimal Solution Found. +// lambda = +// +// lower: [7.097D-12,3.333D-12,3.333D-12] +// upper: [6.559D-12,16.8,24.4] +// constraint: [0x0 constant] +// output = +// +// Iterations: 8 +// ConstrViolation: 0 +// exitflag = +// +// 0 +// fopt = +// +// - 183.4 +// xopt = +// +// 1.4 +// 3. +// 3. + +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB) + + diff --git a/tests/general_tests/qpipopt/qpipopt_logical_5.sce b/tests/general_tests/qpipopt/qpipopt_logical_5.sce new file mode 100644 index 0000000..f628b86 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_logical_5.sce @@ -0,0 +1,38 @@ +// A simple example without constraints +A= []; +conLB=[]; +conUB = []; +lb=[]; +ub=[]; +f=[2 -35 -47]'; +H =[5 -2 -1; -2 4 3; -1 3 5]; +nbVar = 3; +nbCon = 0; + + +//Output +// +//Optimal Solution Found. +// lambda = +// +// lower: [0,0,0] +// upper: [0,0,0] +// constraint: [0x0 constant] +// output = +// +// Iterations: 1 +// ConstrViolation: 0 +// exitflag = +// +// 0 +// fopt = +// +// - 249. +// xopt = +// +// 3. +// 5. +// 7. + +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB) + |