diff options
Diffstat (limited to 'tests/general_tests/intfminbnd')
21 files changed, 389 insertions, 0 deletions
diff --git a/tests/general_tests/intfminbnd/Easom.sce b/tests/general_tests/intfminbnd/Easom.sce new file mode 100644 index 0000000..5758aa2 --- /dev/null +++ b/tests/general_tests/intfminbnd/Easom.sce @@ -0,0 +1,20 @@ +function z=f(xx) +x=xx(1) +y=xx(2) +z=-cos(x)*cos(y)*exp(-((x-%pi)^2+(y-%pi)^2)) +endfunction + +x1=[-100,-100]; +x2=[100,100]; +intcon=[1,2]; + +[x,fval] =intfminbnd(f ,intcon, x1, x2) + +// Optimal Solution Found. +// fval = + +// 0. +// x = + +// 99. +// 100. diff --git a/tests/general_tests/intfminbnd/ackley.sci b/tests/general_tests/intfminbnd/ackley.sci new file mode 100644 index 0000000..8bf5f5a --- /dev/null +++ b/tests/general_tests/intfminbnd/ackley.sci @@ -0,0 +1,34 @@ +function y=ackley(x) +y=0; +d=length(x) +sum1 = 0; +sum2 = 0; +a=20; +b=0.2; +c=2*%pi; +for ii = 1:d + xi = x(ii); + sum1 = sum1 + xi^2; + sum2 = sum2 + cos(c*xi); +end +term1 = -a * exp(-b*sqrt(sum1/d)); +term2 = -exp(sum2/d); +y = term1 + term2 + a + exp(1); + +endfunction + +x1=[-5,-5]; +x2=[5,5]; +intcon=[1,2]; + +[x,fval] =intfminbnd(ackley ,intcon, x1, x2) + +// Optimal Solution Found. +// fval = + +// 4.441D-16 +// x = + +// 0. +// 0. + diff --git a/tests/general_tests/intfminbnd/eggholder.sce b/tests/general_tests/intfminbnd/eggholder.sce new file mode 100644 index 0000000..e07551b --- /dev/null +++ b/tests/general_tests/intfminbnd/eggholder.sce @@ -0,0 +1,22 @@ +function z=f(xx) +x=xx(1) +y=xx(2) +p=y-0.2319+47 +z=-p*sin(sqrt(abs((x/2)+p)))-x*sin(sqrt(abs(x-p))) +endfunction + +x1=[-512,-512]; +x2=[512,512]; +intcon=[1,2]; + +[x,fval] =intfminbnd(f ,intcon, x1, x2) + + +// Optimal Solution Found. +// fval = + +// - 582.0055 +// x = + +// 324. +// 215.
\ No newline at end of file diff --git a/tests/general_tests/intfminbnd/intfminbnd_f.sce b/tests/general_tests/intfminbnd/intfminbnd_f.sce new file mode 100644 index 0000000..4f86898 --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_f.sce @@ -0,0 +1,16 @@ +// Testing first input f +fun = []; +x1 = [1,1,1,1,1,1]; +x2 = [6,6,6,6,6,6]; +options=list("MaxIter", [1500], "CpuTime", [500],"TolX",[1e-6]); +intcon=1:6 + +[xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2, options); + +// !--error 10000 +// intfminbnd: Expected type ["function"] for input argument fun at input #1, but got "constant" instead. +// at line 56 of function Checktype called by : +// at line 141 of function intfminbnd called by : +// [xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2, options); +// at line 7 of exec file called by : +// exec intfminbnd_f.sce diff --git a/tests/general_tests/intfminbnd/intfminbnd_lb1.sce b/tests/general_tests/intfminbnd/intfminbnd_lb1.sce new file mode 100644 index 0000000..822bb5e --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_lb1.sce @@ -0,0 +1,18 @@ +function y=fun(x) +y=0 +for i =1:6 +y=y+sin(x(i)); +end +endfunction +x1 = []; +x2 = [6,6,6,6,6,6]; +options=list("MaxIter", [1500], "CpuTime", [500],"TolX",[1e-6]); +intcon=1:6 + +[xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2, options); +// !--error 10000 +// intfminbnd: x1 cannot be an empty +// at line 150 of function intfminbnd called by : +// [xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2, options); +// at line 12 of exec file called by : +// intfminbnd_lb1.sce
\ No newline at end of file diff --git a/tests/general_tests/intfminbnd/intfminbnd_lb2.sce b/tests/general_tests/intfminbnd/intfminbnd_lb2.sce new file mode 100644 index 0000000..0919d45 --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_lb2.sce @@ -0,0 +1,20 @@ +function y=f(x) +y=0 +for i =1:6 +y=y+sin(x(i)); +end +endfunction +x1 = [1,1,1,1,1]; +x2 = [6,6,6,6,6,6]; +options=list("MaxIter", [1500], "CpuTime", [500]); +intcon=[1,2,3,4,5,6] + +[xopt,fopt,exitflag,output,lambda] = intfminbnd (f, intcon, x1, x2, options); + +// !--error 10000 +// intfminbnd: Expected 5 entries for input argument x2 at input #4, but current dimensions are [1 6] instead. +// at line 54 of function Checkvector called by : +// at line 156 of function intfminbnd called by : +// [xopt,fopt,exitflag,output,lambda] = intfminbnd (f, intcon, x1, x2, options); +// at line 12 of exec file called by : +// exec intfminbnd_lb2.sce diff --git a/tests/general_tests/intfminbnd/intfminbnd_logical10.sce b/tests/general_tests/intfminbnd/intfminbnd_logical10.sce new file mode 100644 index 0000000..dbbf85b --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_logical10.sce @@ -0,0 +1,15 @@ +// Testing with Imaginary numbers +function y = fun(x) + y = -sqrt(x^3); +endfunction +x1 = [-10]; +x2 = [-5]; +intcon=[1]; +[xopt,fopt,exitflag,output,lambda] = intfminbnd (fun,intcon, x1, x2) +// !--error 999 + +// Ipopt has failed to solve the problem! +// at line 310 of function intfminbnd called by : +// [xopt,fopt,exitflag,output,lambda] = intfminbnd (fun,intcon, x1, x2) +// at line 7 of exec file called by : +// exec intfminbnd_logical10.sce diff --git a/tests/general_tests/intfminbnd/intfminbnd_logical2.sce b/tests/general_tests/intfminbnd/intfminbnd_logical2.sce new file mode 100644 index 0000000..1deee8a --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_logical2.sce @@ -0,0 +1,20 @@ +// Passing an unknown option(tolx) to the function +function y=f(x) +y=0 +for i =1:6 +y=y+sin(x(i)); +end +endfunction +x1 = [1,1,1,1,1,1]; +x2 = [6,6,6,6,6,6]; +options=list("maxiter", [1500], "cputime", [0.01],"tolx",[1e-6]); +intcon=1:6 + +[xopt,fopt,exitflag,output,lambda] = intfminbnd (f, intcon, x1, x2, options); + +// !--error 999 +// Unknown string argument passed. +// at line 223 of function intfminbnd called by : +// [xopt,fopt,exitflag,output,lambda] = intfminbnd (f, intcon, x1, x2, options); +// at line 12 of exec file called by : +// exec intfminbnd_logical2.sce diff --git a/tests/general_tests/intfminbnd/intfminbnd_logical3.sce b/tests/general_tests/intfminbnd/intfminbnd_logical3.sce new file mode 100644 index 0000000..a34582a --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_logical3.sce @@ -0,0 +1,14 @@ +// Objective function is not defined at the minimum + +function y = fun(x) + y = -1/x; +endfunction +x1 = [0]; +x2 = [1.5]; +intcon=[1] + +[xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2); + + +// Optimal Solution Found. + diff --git a/tests/general_tests/intfminbnd/intfminbnd_logical4.sce b/tests/general_tests/intfminbnd/intfminbnd_logical4.sce new file mode 100644 index 0000000..0a22bc4 --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_logical4.sce @@ -0,0 +1,12 @@ +// function is not defined at the starting point + +function y = fun(x) + y = 1/x; +endfunction +x1 = [-10]; +x2 = [0] +intcon=[1] + +[xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2); + +// InFeasible Solution.
\ No newline at end of file diff --git a/tests/general_tests/intfminbnd/intfminbnd_logical5.sce b/tests/general_tests/intfminbnd/intfminbnd_logical5.sce new file mode 100644 index 0000000..7d5135c --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_logical5.sce @@ -0,0 +1,19 @@ +// function is not defined at the minimum + +function y = fun(x) + y = -1/(x*x); +endfunction +x1 = [0]; +x2 = [1.5]; +intcon=[1] + +[xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2); + +// !--error 999 + +// Ipopt has failed to solve the problem! +// at line 310 of function intfminbnd called by : +// [xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2); +// at line 8 of exec file called by : +// exec intfminbnd_logical5.sce + diff --git a/tests/general_tests/intfminbnd/intfminbnd_logical6.sce b/tests/general_tests/intfminbnd/intfminbnd_logical6.sce new file mode 100644 index 0000000..328c829 --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_logical6.sce @@ -0,0 +1,18 @@ +// Checking a function which has infinity in its range +function y = fun(x) + y = -1/(x*x); +endfunction +x1 = [0]; +x2 = [10]; +intcon=[1] + +[xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2); + +// !--error 999 + +// Ipopt has failed to solve the problem! +// at line 310 of function intfminbnd called by : +// [xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2); +// at line 9 of exec file called by : +// exec tests/general_tests/intfminbnd/intfminbnd_logical6.sce + diff --git a/tests/general_tests/intfminbnd/intfminbnd_logical7.sce b/tests/general_tests/intfminbnd/intfminbnd_logical7.sce new file mode 100644 index 0000000..b698b1c --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_logical7.sce @@ -0,0 +1,12 @@ +// Checking exponential function +function y = fun(x) + y = exp(x); +endfunction +x1 = [-1000]; +x2 = [1000]; +intcon=[1] + +[xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2); + +// Optimal Solution Found. + diff --git a/tests/general_tests/intfminbnd/intfminbnd_logical8.sce b/tests/general_tests/intfminbnd/intfminbnd_logical8.sce new file mode 100644 index 0000000..f875763 --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_logical8.sce @@ -0,0 +1,10 @@ +// Testing square root function +function y = fun(x) + y = sqrt(x*x); +endfunction +x1 = [100]; +x2 = [500]; +intcon=[1]; +[xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2); + +// Optimal Solution Found. diff --git a/tests/general_tests/intfminbnd/intfminbnd_logical9.sce b/tests/general_tests/intfminbnd/intfminbnd_logical9.sce new file mode 100644 index 0000000..7d1b495 --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_logical9.sce @@ -0,0 +1,17 @@ +//testing log function; log is not defined at the its minimum +function y = fun(x) + y = log(x); +endfunction +x1 = [-10]; +x2 = [0]; +intcon=[1]; +[xopt,fopt,exitflag,output,lambda] = intfminbnd (fun,intcon, x1, x2) + + +// !--error 999 + +// Ipopt has failed to solve the problem! +// at line 310 of function intfminbnd called by : +// [xopt,fopt,exitflag,output,lambda] = intfminbnd (fun,intcon, x1, x2) +// at line 7 of exec file called by : +// exec intfminbnd_logical9.sce diff --git a/tests/general_tests/intfminbnd/intfminbnd_options1.sce b/tests/general_tests/intfminbnd/intfminbnd_options1.sce new file mode 100644 index 0000000..c9fb2e3 --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_options1.sce @@ -0,0 +1,15 @@ +function y = fun(x) + y = x(1)^2 + x(2)^2; +endfunction +x1 = [1,2]; +x2 = [3,4]; +intcon=[1,2]; +options=list("MaxIter", "", "CpuTime", [500],"TolX",[1e-6]); +[xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2, options); +// !--error 10000 +// intfminbnd_options: Expected type ["constant"] for input argument MaxIter at input #2, but got "string" instead. +// at line 56 of function Checktype called by : +// at line 202 of function intfminbnd called by : +// [xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2, options); +// at line 8 of exec file called by : +// exec intfminbnd_options1.sce diff --git a/tests/general_tests/intfminbnd/intfminbnd_options2.sce b/tests/general_tests/intfminbnd/intfminbnd_options2.sce new file mode 100644 index 0000000..50d4832 --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_options2.sce @@ -0,0 +1,14 @@ +function y = fun(x) + y = x(1)^2 + x(2)^2; +endfunction +x1 = [1,2]; +x2 = [3,4]; +options=list("MaxIter", [1000], "CpuTime", "TolX",[1e-6]); +intcon=[1,2]; +[xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2, options); +// !--error 999 +// Unknown string argument passed. +// at line 223 of function intfminbnd called by : +// [xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2, options); +// at line 8 of exec file called by : +// exec intfminbnd_options3.sce diff --git a/tests/general_tests/intfminbnd/intfminbnd_options3.sce b/tests/general_tests/intfminbnd/intfminbnd_options3.sce new file mode 100644 index 0000000..b1d543b --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_options3.sce @@ -0,0 +1,15 @@ +function y = fun(x) + y = x(1)^2 + x(2)^2; +endfunction +x1 = [1,2]; +x2 = [3,4]; +options=list("MaxIter", [1000], "CpuTime", [100], "TolX", " "); +intcon=[1,2]; +[xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2, options); + +// !--error 999 +// Unknown string argument passed. +// at line 223 of function intfminbnd called by : +// [xopt,fopt,exitflag,output,lambda] = intfminbnd (fun, intcon, x1, x2, options); +// at line 8 of exec file called by : +// exec intfminbnd_options3.sce diff --git a/tests/general_tests/intfminbnd/intfminbnd_ub1.sce b/tests/general_tests/intfminbnd/intfminbnd_ub1.sce new file mode 100644 index 0000000..cbb3f62 --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_ub1.sce @@ -0,0 +1,16 @@ +function y = fun(x) + y = x(1)^2 + x(2)^2; +endfunction +x1 = [1,2]; +x2 = [1]; +options=list("MaxIter", [1500], "CpuTime", [500],"TolX",[1e-6]); +intcon=[1,2] +// !--error 10000 +// intfminbnd: Expected 2 entries for input argument x2 at input #4, but current dimensions are [1 1] instead. +// at line 54 of function Checkvector called by : +// at line 156 of function intfminbnd called by : +// [xopt,fopt,exitflag,output,lambda] = intfminbnd(fun ,intcon, x1, x2, options) +// at line 8 of exec file called by : +// exec intfminbnd_ub1.sce + +[xopt,fopt,exitflag,output,lambda] = intfminbnd(fun ,intcon, x1, x2, options) diff --git a/tests/general_tests/intfminbnd/intfminbnd_ub2.sce b/tests/general_tests/intfminbnd/intfminbnd_ub2.sce new file mode 100644 index 0000000..c98b22f --- /dev/null +++ b/tests/general_tests/intfminbnd/intfminbnd_ub2.sce @@ -0,0 +1,16 @@ +function y = fun(x) + y = x(1)^2 + x(2)^2; +endfunction +x1 = [1;2]; +x2 = list(2,3); +options=list("MaxIter", [1500], "CpuTime", [500],"TolX",[1e-6]); +intcon=[1,2] +// !--error 10000 +// intfminbnd: Expected type ["constant"] for input argument x2 at input #4, but got "list" instead. +// at line 56 of function Checktype called by : +// at line 144 of function intfminbnd called by : +// [xopt,fopt,exitflag,output,lambda] = intfminbnd(fun ,intcon, x1, x2, options) +// at line 8 of exec file called by : +// exec intfminbnd_ub2.sce + +[xopt,fopt,exitflag,output,lambda] = intfminbnd(fun ,intcon, x1, x2, options) diff --git a/tests/general_tests/intfminbnd/levi.sce b/tests/general_tests/intfminbnd/levi.sce new file mode 100644 index 0000000..c51fd9c --- /dev/null +++ b/tests/general_tests/intfminbnd/levi.sce @@ -0,0 +1,46 @@ +function z=f(xx) +x=xx(1) +y=xx(2) +z=(sin(3*%pi*x))^2+((x-1)^2)*(1+(sin(3*%pi*y))^2)+((y-1)^2)*(1+(sin(3*%pi*y))^2) +endfunction + +x1=[-10,-10]; +x2=[10,10]; +intcon=[1,2]; + +[x,fval] =intfminbnd(f ,intcon, x1, x2) + +// NLP0012I +// Num Status Obj It time Location +// NLP0014I 1 OPT 1.9831281 5 0.008 +// NLP0014I 2 OPT 19.547902 30 0.048 +// NLP0014I 3 OPT 6.3807612 13 0.016 +// NLP0014I 4 OPT 6.4237104 12 0.016 +// NLP0014I 5 OPT 4.9797617 12 0.02 +// Cbc0010I After 0 nodes, 1 on tree, 1e+50 best solution, best possible -1.7976931e+308 (0.10 seconds) +// NLP0014I 6 OPT 6.3807612 13 0.02 +// NLP0014I 7 OPT 19.547902 30 0.048 +// NLP0014I 8 OPT 16.807565 11 0.02 +// NLP0014I 9 OPT 1.4316016 12 0.02 +// NLP0014I 10 OPT 2.7537464 11 0.02 +// NLP0014I 11 OPT 0.98856488 5 0.008 +// NLP0014I 12 OPT 0.98856488 13 0.024 +// NLP0014I 13 OPT 3.9886994 14 0.024 +// NLP0014I 14 OPT 2.766458 11 0.02 +// NLP0014I 15 OPT 1.3497838e-31 0 0 +// NLP0012I +// Num Status Obj It time Location +// NLP0014I 1 OPT 1.3497838e-31 0 0 +// Cbc0004I Integer solution of 1.3497838e-31 found after 120 iterations and 10 nodes (0.31 seconds) +// Cbc0001I Search completed - best objective 1.349783804395672e-31, took 120 iterations and 10 nodes (0.31 seconds) +// Cbc0032I Strong branching done 2 times (67 iterations), fathomed 0 nodes and fixed 0 variables +// Cbc0035I Maximum depth 5, 0 variables fixed on reduced cost + +// Optimal Solution Found. +// fval = + +// 1.350D-31 +// x = + +// 1. +// 1.
\ No newline at end of file |