diff options
Diffstat (limited to 'tests/general_tests/fmincon/fmincon_logical14.sce')
-rw-r--r-- | tests/general_tests/fmincon/fmincon_logical14.sce | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/tests/general_tests/fmincon/fmincon_logical14.sce b/tests/general_tests/fmincon/fmincon_logical14.sce index 2febc72..33e108f 100644 --- a/tests/general_tests/fmincon/fmincon_logical14.sce +++ b/tests/general_tests/fmincon/fmincon_logical14.sce @@ -1,10 +1,7 @@ -// Example with objective function and inequality constraints +// Example with objective function, inequality constraints and non linear constraints function y=fun(x) - y=0 - for i = 1:20 - y = y + exp(x(i)) - end + y=-sum(exp(x)) endfunction x0 = repmat(1,1,20); @@ -15,11 +12,7 @@ b=[-100 -50]'; //Nonlinear constraints function [c,ceq]=nlc(x) - cfor = 0; - for i = 1:20 - cfor = cfor + 2*exp(x(i)) - end - c = [ cfor + 1]; + c = [ sum(2*exp(x)) + 1]; ceq = []; endfunction |