summaryrefslogtreecommitdiff
path: root/build/Scilab
diff options
context:
space:
mode:
authorHarpreet2016-08-31 11:10:22 +0530
committerHarpreet2016-08-31 11:10:22 +0530
commitd19794fb80a271a4c885ed90f97cfc12baa012f2 (patch)
treeebcdc604cb1ee22debc888a1ec772be5c9161b26 /build/Scilab
parente4fe6bdb7023464e750f882e19b393d3073365a2 (diff)
downloadFOSSEE-Optim-toolbox-development-d19794fb80a271a4c885ed90f97cfc12baa012f2.tar.gz
FOSSEE-Optim-toolbox-development-d19794fb80a271a4c885ed90f97cfc12baa012f2.tar.bz2
FOSSEE-Optim-toolbox-development-d19794fb80a271a4c885ed90f97cfc12baa012f2.zip
intfminimax examples added
Diffstat (limited to 'build/Scilab')
-rw-r--r--build/Scilab/intfminimax.sci29
1 files changed, 16 insertions, 13 deletions
diff --git a/build/Scilab/intfminimax.sci b/build/Scilab/intfminimax.sci
index 2b51fd5..0fb66c3 100644
--- a/build/Scilab/intfminimax.sci
+++ b/build/Scilab/intfminimax.sci
@@ -9,7 +9,7 @@
// Organization: FOSSEE, IIT Bombay
// Email: toolbox@scilab.in
-function [x,fval,maxfval,exitflag,output,lambda] = intfminimax(varargin)
+function [x,fval,maxfval,exitflag] = intfminimax(varargin)
// Solves minimax constraint problem
//
// Calling Sequence
@@ -22,8 +22,6 @@ function [x,fval,maxfval,exitflag,output,lambda] = intfminimax(varargin)
// [xopt, fval] = intfminimax(.....)
// [xopt, fval, maxfval]= intfminimax(.....)
// [xopt, fval, maxfval, exitflag]= intfminimax(.....)
- // [xopt, fval, maxfval, exitflag, output]= intfminimax(.....)
- // [xopt, fval, maxfval, exitflag, output, lambda]= intfminimax(.....)
//
// Parameters
// fun: The function to be minimized. fun is a function that accepts a vector x and returns a vector F, the objective functions evaluated at x.
@@ -122,7 +120,7 @@ function [x,fval,maxfval,exitflag,output,lambda] = intfminimax(varargin)
// intcon = [1]
// maxfopt = 0
// // Run fminimax
- // [x,fval,maxfval,exitflag,output,lambda] = fminimax(myfun, x0,intcon)
+ // [x,fval,maxfval,exitflag] = intfminimax(myfun, x0,intcon)
// // Press ENTER to continue
//
// Examples
@@ -154,8 +152,7 @@ function [x,fval,maxfval,exitflag,output,lambda] = intfminimax(varargin)
// x0 = [0,10];
// intcon = [2]
// // Run intfminimax
- // [x,fval,maxfval,exitflag,output] = intfminimax(myfun,x0,intcon,[],[],[],[],[],[], confun, minimaxOptions)
- //
+ // [x,fval,maxfval,exitflag] = intfminimax(myfun,x0,intcon,[],[],[],[],[],[], confun, minimaxOptions)
// Authors
// Harpreet Singh
@@ -271,8 +268,9 @@ function [x,fval,maxfval,exitflag,output,lambda] = intfminimax(varargin)
else
minmaxNonlinfun = varargin(10)
end
-
- Checktype("fminimax", minmaxNonlinfun, "nonlinfun", 10, "function")
+ if(minmaxNonlinfun<>[]) then
+ Checktype("fminimax", minmaxNonlinfun, "nonlinfun", 10, "function")
+ end
//To check, Whether minimaxOptions is been entered by user
if ( minmaxRhs<11 ) then
@@ -415,7 +413,11 @@ minmaxoptions = list('integertolerance',1d-06,'maxnodes',2147483647,'cputime',1d
function [nc,nceq,dnc,dnceq] = newNonlinfun(z)
dnc = [];
dnceq = [];
- [nc,nceq] = minmaxNonlinfun(z)
+ nc = [];
+ nceq= [];
+ if (minmaxNonlinfun<>[]) then
+ [nc,nceq] = minmaxNonlinfun(z)
+ end
// add inequalities of the form Fi(x) - y <= 0
tmp = [minmaxObjfun(z) - z(minmaxNumvar+1)]'
nc = [nc, tmp]
@@ -425,7 +427,9 @@ minmaxoptions = list('integertolerance',1d-06,'maxnodes',2147483647,'cputime',1d
dnceq = [dnceq, zeros(size(dnceq,'r'),1)]
else
// else use numderivative method to calculate gradient of constraints
- [dnc, dnceq] = minmaxNonlinDer(z)
+ if (minmaxNonlinfun<>[]) then
+ [dnc, dnceq] = minmaxNonlinDer(z)
+ end
end
if(options(12) =="on") then
@@ -443,12 +447,11 @@ minmaxoptions = list('integertolerance',1d-06,'maxnodes',2147483647,'cputime',1d
options(14)="on";
end
- options(12)="off";
-
+ minmaxoptions(12)="off";
[x,fval,exitflag,gradient,hessian] = ...
intfmincon(newObjfun,minmaxStartpoint,intcon,minmaxA,minmaxB,minmaxAeq,minmaxBeq,minmaxLb,minmaxUb,newNonlinfun,minmaxoptions)
x = x(1:minmaxNumvar)
- fval = minmaxObjun(x)
+ fval = minmaxObjfun(x)
maxfval = max(fval)
endfunction