diff options
author | Georgey | 2017-07-05 11:42:11 +0530 |
---|---|---|
committer | Georgey | 2017-07-05 11:42:11 +0530 |
commit | 536bbd0cd8e4ca5b29d07e472e682bbb5db63a97 (patch) | |
tree | 7b7c9ee9b99de05aa95db57063a3ca2f84a846eb /tests/general_tests/intfmincon/intfmincon_cputime.sce | |
parent | 938fef4a37a7b7c61b4b6ff74cb4cfd2f100c427 (diff) | |
download | FOSSEE-Optimization-toolbox-536bbd0cd8e4ca5b29d07e472e682bbb5db63a97.tar.gz FOSSEE-Optimization-toolbox-536bbd0cd8e4ca5b29d07e472e682bbb5db63a97.tar.bz2 FOSSEE-Optimization-toolbox-536bbd0cd8e4ca5b29d07e472e682bbb5db63a97.zip |
Updated tests for int and ecos functions
Diffstat (limited to 'tests/general_tests/intfmincon/intfmincon_cputime.sce')
-rw-r--r-- | tests/general_tests/intfmincon/intfmincon_cputime.sce | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/general_tests/intfmincon/intfmincon_cputime.sce b/tests/general_tests/intfmincon/intfmincon_cputime.sce new file mode 100644 index 0000000..34a5018 --- /dev/null +++ b/tests/general_tests/intfmincon/intfmincon_cputime.sce @@ -0,0 +1,49 @@ +//Example where cputime is exceeded + +function y=f(x) +y=x(1)*x(2)+x(2)*x(3); +endfunction +//Starting point, linear constraints and variable bounds +x0=[0.1 , 0.1 , 0.1]; +A=[]; +b=[]; +Aeq=[]; +beq=[]; +lb=[]; +ub=[]; +intcon=[1,2]; +//Nonlinear constraints +function [c,ceq]=nlc(x) +c = [x(1)^2 - x(2)^2 + x(3)^2 - 2 ; x(1)^2 + x(2)^2 + x(3)^2 - 10]'; +ceq = []; +endfunction + +//Hessian of the Lagrange Function +function y= lHess(x,obj,lambda) +y= obj*[0,1,0;1,0,1;0,1,0] + lambda(1)*[2,0,0;0,-2,0;0,0,2] + lambda(2)*[2,0,0;0,2,0;0,0,2] +endfunction + +//Options +options=list("MaxIter", [100], "CpuTime", [5], "Hessian", lHess); + +//Calling fmincon +[xopt,fopt,exitflag,output,hessian] =intfmincon(f, x0,intcon,A,b,Aeq,beq,lb,ub,nlc,options) + +// Limit Exceeded. +// hessian = + +// 0. 1. 0. 1. 0. 1. 0. 1. 0. +// output = + +// - 2. 3.4142136 - 2. +// exitflag = + +// 3 +// fopt = + +// - 6.8284271 +// xopt = + +// 2. +// - 2. +// 1.4142136 |