From a2d9c2bfd6eb83d1a494821176388eb312d08254 Mon Sep 17 00:00:00 2001 From: Harpreet Date: Mon, 25 Jan 2016 01:05:02 +0530 Subject: functions added --- demos/exmip1.mps | 70 ++ demos/fgoalattain.dem.sce | 26 + demos/fminbnd.dem.sce | 54 ++ demos/fmincon.dem.sce | 155 ++++ demos/fminimax.dem.sce | 73 ++ demos/fminunc.dem.sce | 61 ++ demos/linprog.dem.sce | 64 ++ help/en_US/fgoalattain.xml | 232 ++++++ help/en_US/fminbnd.xml | 197 +++++ help/en_US/fmincon.xml | 334 ++++++++ help/en_US/fminimax.xml | 293 +++++++ help/en_US/fminunc.xml | 196 +++++ help/en_US/linprog.xml | 222 +++++ help/en_US/master_help.xml | 10 + help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS | Bin 7090 -> 8232 bytes .../scilab_en_US_help/JavaHelpSearch/DOCS.TAB | Bin 781 -> 922 bytes .../en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS | Bin 266 -> 296 bytes .../scilab_en_US_help/JavaHelpSearch/POSITIONS | Bin 34613 -> 43830 bytes help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA | 2 +- help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP | Bin 16384 -> 18432 bytes .../scilab_en_US_help/_LaTeX_fgoalattain.xml_1.png | Bin 0 -> 4343 bytes .../scilab_en_US_help/_LaTeX_fminbnd.xml_1.png | Bin 0 -> 1792 bytes .../scilab_en_US_help/_LaTeX_fmincon.xml_1.png | Bin 0 -> 3781 bytes .../scilab_en_US_help/_LaTeX_fminunc.xml_1.png | Bin 0 -> 714 bytes .../scilab_en_US_help/_LaTeX_linprog.xml_1.png | Bin 0 -> 2509 bytes help/en_US/scilab_en_US_help/fgoalattain.html | 195 +++++ help/en_US/scilab_en_US_help/fminbnd.html | 174 ++++ help/en_US/scilab_en_US_help/fmincon.html | 302 +++++++ help/en_US/scilab_en_US_help/fminunc.html | 178 ++++ help/en_US/scilab_en_US_help/index.html | 32 +- help/en_US/scilab_en_US_help/jhelpmap.jhm | 5 + help/en_US/scilab_en_US_help/jhelptoc.xml | 5 + help/en_US/scilab_en_US_help/linprog.html | 188 +++++ help/en_US/scilab_en_US_help/lsqlin.html | 4 +- .../section_19f4f1e5726c01d683e8b82be0a7e910.html | 32 +- jar/scilab_en_US_help.jar | Bin 208569 -> 252170 bytes macros/fgoalattain.bin | Bin 0 -> 79236 bytes macros/fgoalattain.sci | 514 ++++++++++++ macros/fgoalattainFunctions.bin | Bin 0 -> 10432 bytes macros/fgoalattainFunctions.sci | 76 ++ macros/fminbnd.bin | Bin 0 -> 53656 bytes macros/fminbnd.sci | 356 ++++++++ macros/fmincon.bin | Bin 0 -> 149436 bytes macros/fmincon.sci | 928 +++++++++++++++++++++ macros/fminimax.bin | Bin 0 -> 85668 bytes macros/fminimax.sci | 511 ++++++++++++ macros/fminimaxCheckdims.bin | Bin 0 -> 8332 bytes macros/fminimaxCheckdims.sci | 56 ++ macros/fminimaxChecklhs.bin | Bin 0 -> 10472 bytes macros/fminimaxChecklhs.sci | 79 ++ macros/fminimaxCheckrhs.bin | Bin 0 -> 13076 bytes macros/fminimaxCheckrhs.sci | 102 +++ macros/fminimaxChecktype.bin | Bin 0 -> 9252 bytes macros/fminimaxChecktype.sci | 65 ++ macros/fminimaxCheckvector.bin | Bin 0 -> 9760 bytes macros/fminimaxCheckvector.sci | 63 ++ macros/fminunc.bin | Bin 0 -> 60820 bytes macros/fminunc.sci | 427 ++++++++++ macros/lib | Bin 528 -> 864 bytes macros/linprog.bin | Bin 0 -> 28836 bytes macros/linprog.sci | 199 +++++ macros/lsqlin.bin | Bin 58956 -> 59776 bytes macros/lsqlin.sci | 5 + macros/lsqnonneg.bin | Bin 29856 -> 30692 bytes macros/lsqnonneg.sci | 6 + macros/matrix_linprog.bin | Bin 0 -> 30556 bytes macros/matrix_linprog.sci | 245 ++++++ macros/mps_linprog.bin | Bin 0 -> 9028 bytes macros/mps_linprog.sci | 90 ++ macros/names | 14 + macros/qpipoptmat.bin | Bin 60708 -> 61536 bytes macros/qpipoptmat.sci | 5 +- macros/symphonymat.bin | Bin 62364 -> 63268 bytes macros/symphonymat.sci | 6 +- sci_gateway/cpp/LinCLP.hpp | 82 ++ sci_gateway/cpp/builder_gateway_cpp.sce | 36 +- sci_gateway/cpp/libFAMOS.c | 10 + sci_gateway/cpp/libFAMOS.so | Bin 122920 -> 199006 bytes sci_gateway/cpp/loader.sce | 5 + sci_gateway/cpp/minbndNLP.hpp | 116 +++ sci_gateway/cpp/minconNLP.hpp | 173 ++++ sci_gateway/cpp/minuncNLP.hpp | 113 +++ sci_gateway/cpp/read_mps.cpp | 113 +++ sci_gateway/cpp/sci_LinCLP.cpp | 119 +++ sci_gateway/cpp/sci_LinProg.cpp | 150 ++++ sci_gateway/cpp/sci_iofunc.cpp | 67 +- sci_gateway/cpp/sci_iofunc.hpp | 16 +- sci_gateway/cpp/sci_ipoptfminbnd.cpp | 195 +++++ sci_gateway/cpp/sci_ipoptfmincon.cpp | 273 ++++++ sci_gateway/cpp/sci_ipoptfminunc.cpp | 201 +++++ sci_gateway/cpp/sci_minbndNLP.cpp | 353 ++++++++ sci_gateway/cpp/sci_minconNLP.cpp | 797 ++++++++++++++++++ sci_gateway/cpp/sci_minuncNLP.cpp | 377 +++++++++ 93 files changed, 10011 insertions(+), 36 deletions(-) create mode 100644 demos/exmip1.mps create mode 100644 demos/fgoalattain.dem.sce create mode 100644 demos/fminbnd.dem.sce create mode 100644 demos/fmincon.dem.sce create mode 100644 demos/fminimax.dem.sce create mode 100644 demos/fminunc.dem.sce create mode 100755 demos/linprog.dem.sce create mode 100644 help/en_US/fgoalattain.xml create mode 100644 help/en_US/fminbnd.xml create mode 100644 help/en_US/fmincon.xml create mode 100644 help/en_US/fminimax.xml create mode 100644 help/en_US/fminunc.xml create mode 100755 help/en_US/linprog.xml create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_fgoalattain.xml_1.png create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_fminbnd.xml_1.png create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_fmincon.xml_1.png create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_fminunc.xml_1.png create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_linprog.xml_1.png create mode 100644 help/en_US/scilab_en_US_help/fgoalattain.html create mode 100644 help/en_US/scilab_en_US_help/fminbnd.html create mode 100644 help/en_US/scilab_en_US_help/fmincon.html create mode 100644 help/en_US/scilab_en_US_help/fminunc.html create mode 100644 help/en_US/scilab_en_US_help/linprog.html create mode 100644 macros/fgoalattain.bin create mode 100644 macros/fgoalattain.sci create mode 100644 macros/fgoalattainFunctions.bin create mode 100644 macros/fgoalattainFunctions.sci create mode 100644 macros/fminbnd.bin create mode 100644 macros/fminbnd.sci create mode 100644 macros/fmincon.bin create mode 100644 macros/fmincon.sci create mode 100644 macros/fminimax.bin create mode 100644 macros/fminimax.sci create mode 100644 macros/fminimaxCheckdims.bin create mode 100644 macros/fminimaxCheckdims.sci create mode 100644 macros/fminimaxChecklhs.bin create mode 100644 macros/fminimaxChecklhs.sci create mode 100644 macros/fminimaxCheckrhs.bin create mode 100644 macros/fminimaxCheckrhs.sci create mode 100644 macros/fminimaxChecktype.bin create mode 100644 macros/fminimaxChecktype.sci create mode 100644 macros/fminimaxCheckvector.bin create mode 100644 macros/fminimaxCheckvector.sci create mode 100644 macros/fminunc.bin create mode 100644 macros/fminunc.sci create mode 100644 macros/linprog.bin create mode 100644 macros/linprog.sci create mode 100644 macros/matrix_linprog.bin create mode 100755 macros/matrix_linprog.sci create mode 100644 macros/mps_linprog.bin create mode 100644 macros/mps_linprog.sci create mode 100755 sci_gateway/cpp/LinCLP.hpp create mode 100644 sci_gateway/cpp/minbndNLP.hpp create mode 100644 sci_gateway/cpp/minconNLP.hpp create mode 100644 sci_gateway/cpp/minuncNLP.hpp create mode 100644 sci_gateway/cpp/read_mps.cpp create mode 100644 sci_gateway/cpp/sci_LinCLP.cpp create mode 100644 sci_gateway/cpp/sci_LinProg.cpp create mode 100644 sci_gateway/cpp/sci_ipoptfminbnd.cpp create mode 100644 sci_gateway/cpp/sci_ipoptfmincon.cpp create mode 100644 sci_gateway/cpp/sci_ipoptfminunc.cpp create mode 100644 sci_gateway/cpp/sci_minbndNLP.cpp create mode 100644 sci_gateway/cpp/sci_minconNLP.cpp create mode 100644 sci_gateway/cpp/sci_minuncNLP.cpp diff --git a/demos/exmip1.mps b/demos/exmip1.mps new file mode 100644 index 0000000..4f73ac5 --- /dev/null +++ b/demos/exmip1.mps @@ -0,0 +1,70 @@ +************************************************************************ +* +* The data in this file represents the following problem: +* +* Minimize or maximize Z = x1 + 2x5 - x8 +* +* Subject to: +* +* 2.5 <= 3x1 + x2 - 2x4 - x5 - x8 +* 2x2 + 1.1x3 <= 2.1 +* x3 + x6 = 4.0 +* 1.8 <= 2.8x4 -1.2x7 <= 5.0 +* 3.0 <= 5.6x1 + x5 + 1.9x8 <= 15.0 +* +* where: +* +* 2.5 <= x1 +* 0 <= x2 <= 4.1 +* 0 <= x3 +* 0 <= x4 +* 0.5 <= x5 <= 4.0 +* 0 <= x6 +* 0 <= x7 +* 0 <= x8 <= 4.3 +* +* x3, x4 are 0,1 variables. +* +************************************************************************ +NAME EXAMPLE +ROWS + N OBJ + G ROW01 + L ROW02 + E ROW03 + G ROW04 + L ROW05 +COLUMNS + COL01 OBJ 1.0 + COL01 ROW01 3.0 ROW05 5.6 + COL02 ROW01 1.0 ROW02 2.0 +* +* Mark COL03 and COL04 as integer variables. +* + INT1 'MARKER' 'INTORG' + COL03 ROW02 1.1 ROW03 1.0 + COL04 ROW01 -2.0 ROW04 2.8 + INT1END 'MARKER' 'INTEND' +* + COL05 OBJ 2.0 + COL05 ROW01 -1.0 ROW05 1.0 + COL06 ROW03 1.0 + COL07 ROW04 -1.2 + COL08 OBJ -1.0 + COL08 ROW01 -1.0 ROW05 1.9 +RHS + RHS1 ROW01 2.5 + RHS1 ROW02 2.1 + RHS1 ROW03 4.0 + RHS1 ROW04 1.8 + RHS1 ROW05 15.0 +RANGES + RNG1 ROW04 3.2 + RNG1 ROW05 12.0 +BOUNDS + LO BND1 COL01 2.5 + UP BND1 COL02 4.1 + LO BND1 COL05 0.5 + UP BND1 COL05 4.0 + UP BND1 COL08 4.3 +ENDATA diff --git a/demos/fgoalattain.dem.sce b/demos/fgoalattain.dem.sce new file mode 100644 index 0000000..89a5957 --- /dev/null +++ b/demos/fgoalattain.dem.sce @@ -0,0 +1,26 @@ +mode(1) +// +// Demo of fgoalattain.sci +// + +function f1 = fun(x) +f1(1)=2*x(1)*x(1)+x(2)*x(2)-48*x(1)-40*x(2)+304 +f1(2)=-x(1)*x(1)-3*x(2)*x(2) +f1(3)=x(1)+3*x(2)-18 +f1(4)=-x(1)-x(2) +f1(5)=x(1)+x(2)-8 +endfunction +x0=[-1,1]; +halt() // Press return to continue + +goal=[-5,-3,-2,-1,-4]; +weight=abs(goal) +//xopt = [-0.0000011 -63.999998 -2.0000002 -8 3.485D-08] +//fval = [4 3.99] +halt() // Press return to continue + +//Run fgoalattain +[xopt,fval,attainfactor,exitflag,output,lambda]=fgoalattain(fun,x0,goal,weight) +halt() // Press return to continue + +//========= E N D === O F === D E M O =========// diff --git a/demos/fminbnd.dem.sce b/demos/fminbnd.dem.sce new file mode 100644 index 0000000..a9b4865 --- /dev/null +++ b/demos/fminbnd.dem.sce @@ -0,0 +1,54 @@ +mode(1) +// +// Demo of fminbnd.sci +// + +//Find x in R^6 such that it minimizes: +//f(x)= sin(x1) + sin(x2) + sin(x3) + sin(x4) + sin(x5) + sin(x6) +//-2 <= x1,x2,x3,x4,x5,x6 <= 2 +//Objective function to be minimised +function y=f(x) +y=0 +for i =1:6 +y=y+sin(x(i)); +end +endfunction +//Variable bounds +x1 = [-2, -2, -2, -2, -2, -2]; +x2 = [2, 2, 2, 2, 2, 2]; +//Options +options=list("MaxIter",[1500],"CpuTime", [100],"TolX",[1e-6]) +//Calling Ipopt +[x,fval] =fminbnd(f, x1, x2, options) +halt() // Press return to continue + +//Find x in R such that it minimizes: +//f(x)= 1/x^2 +//0 <= x <= 1000 +//Objective function to be minimised +function y=f(x) +y=1/x^2 +endfunction +//Variable bounds +x1 = [0]; +x2 = [1000]; +//Calling Ipopt +[x,fval,exitflag,output,lambda] =fminbnd(f, x1, x2) +halt() // Press return to continue + +//The below problem is an unbounded problem: +//Find x in R^2 such that it minimizes: +//f(x)= -[(x1-1)^2 + (x2-1)^2] +//-inf <= x1,x2 <= inf +//Objective function to be minimised +function y=f(x) +y=-((x(1)-1)^2+(x(2)-1)^2); +endfunction +//Variable bounds +x1 = [-%inf , -%inf]; +x2 = []; +//Options +options=list("MaxIter",[1500],"CpuTime", [100],"TolX",[1e-6]) +//Calling Ipopt +[x,fval,exitflag,output,lambda] =fminbnd(f, x1, x2, options) +//========= E N D === O F === D E M O =========// diff --git a/demos/fmincon.dem.sce b/demos/fmincon.dem.sce new file mode 100644 index 0000000..790c67f --- /dev/null +++ b/demos/fmincon.dem.sce @@ -0,0 +1,155 @@ +mode(1) +// +// Demo of fmincon.sci +// + +//Find x in R^2 such that it minimizes: +//f(x)= -x1 -x2/3 +//x0=[0,0] +//constraint-1 (c1): x1 + x2 <= 2 +//constraint-2 (c2): x1 + x2/4 <= 1 +//constraint-3 (c3): x1 - x2 <= 2 +//constraint-4 (c4): -x1/4 - x2 <= 1 +//constraint-5 (c5): -x1 - x2 <= -1 +//constraint-6 (c6): -x1 + x2 <= 2 +//constraint-7 (c7): x1 + x2 = 2 +//Objective function to be minimised +function y=f(x) +y=-x(1)-x(2)/3; +endfunction +//Starting point, linear constraints and variable bounds +x0=[0 , 0]; +A=[1,1 ; 1,1/4 ; 1,-1 ; -1/4,-1 ; -1,-1 ; -1,1]; +b=[2;1;2;1;-1;2]; +Aeq=[1,1]; +beq=[2]; +lb=[]; +ub=[]; +nlc=[]; +//Gradient of objective function +function y= fGrad(x) +y= [-1,-1/3]; +endfunction +//Hessian of lagrangian +function y= lHess(x,obj,lambda) +y= obj*[0,0;0,0] +endfunction +//Options +options=list("GradObj", fGrad, "Hessian", lHess); +//Calling Ipopt +[x,fval,exitflag,output,lambda,grad,hessian] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options) +halt() // Press return to continue + +//Find x in R^3 such that it minimizes: +//f(x)= x1*x2 + x2*x3 +//x0=[0.1 , 0.1 , 0.1] +//constraint-1 (c1): x1^2 - x2^2 + x3^2 <= 2 +//constraint-2 (c2): x1^2 + x2^2 + x3^2 <= 10 +//Objective function to be minimised +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=[]; +//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 +//Gradient of objective function +function y= fGrad(x) +y= [x(2),x(1)+x(3),x(2)]; +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 +//Gradient of Non-Linear Constraints +function [cg,ceqg] = cGrad(x) +cg=[2*x(1) , -2*x(2) , 2*x(3) ; 2*x(1) , 2*x(2) , 2*x(3)]; +ceqg=[]; +endfunction +//Options +options=list("MaxIter", [1500], "CpuTime", [500], "GradObj", fGrad, "Hessian", lHess,"GradCon", cGrad); +//Calling Ipopt +[x,fval,exitflag,output] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options) +halt() // Press return to continue + +//The below problem is an unbounded problem: +//Find x in R^3 such that it minimizes: +//f(x)= -(x1^2 + x2^2 + x3^2) +//x0=[0.1 , 0.1 , 0.1] +// x1 <= 0 +// x2 <= 0 +// x3 <= 0 +//Objective function to be minimised +function y=f(x) +y=-(x(1)^2+x(2)^2+x(3)^2); +endfunction +//Starting point, linear constraints and variable bounds +x0=[0.1 , 0.1 , 0.1]; +A=[]; +b=[]; +Aeq=[]; +beq=[]; +lb=[]; +ub=[0,0,0]; +//Options +options=list("MaxIter", [1500], "CpuTime", [500]); +//Calling Ipopt +[x,fval,exitflag,output,lambda,grad,hessian] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,[],options) +halt() // Press return to continue + +//The below problem is an infeasible problem: +//Find x in R^3 such that in minimizes: +//f(x)=x1*x2 + x2*x3 +//x0=[1,1,1] +//constraint-1 (c1): x1^2 <= 1 +//constraint-2 (c2): x1^2 + x2^2 <= 1 +//constraint-3 (c3): x3^2 <= 1 +//constraint-4 (c4): x1^3 = 0.5 +//constraint-5 (c5): x2^2 + x3^2 = 0.75 +// 0 <= x1 <=0.6 +// 0.2 <= x2 <= inf +// -inf <= x3 <= 1 +//Objective function to be minimised +function y=f(x) +y=x(1)*x(2)+x(2)*x(3); +endfunction +//Starting point, linear constraints and variable bounds +x0=[1,1,1]; +A=[]; +b=[]; +Aeq=[]; +beq=[]; +lb=[0 0.2,-%inf]; +ub=[0.6 %inf,1]; +//Nonlinear constraints +function [c,ceq]=nlc(x) +c=[x(1)^2-1,x(1)^2+x(2)^2-1,x(3)^2-1]; +ceq=[x(1)^3-0.5,x(2)^2+x(3)^2-0.75]; +endfunction +//Gradient of objective function +function y= fGrad(x) +y= [x(2),x(1)+x(3),x(2)]; +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,0,0;0,0,0] + lambda(2)*[2,0,0;0,2,0;0,0,0] +lambda(3)*[0,0,0;0,0,0;0,0,2] + lambda(4)*[6*x(1 ),0,0;0,0,0;0,0,0] + lambda(5)*[0,0,0;0,2,0;0,0,2]; +endfunction +//Gradient of Non-Linear Constraints +function [cg,ceqg] = cGrad(x) +cg = [2*x(1),0,0;2*x(1),2*x(2),0;0,0,2*x(3)]; +ceqg = [3*x(1)^2,0,0;0,2*x(2),2*x(3)]; +endfunction +//Options +options=list("MaxIter", [1500], "CpuTime", [500], "GradObj", fGrad, "Hessian", lHess,"GradCon", cGrad); +//Calling Ipopt +[x,fval,exitflag,output,lambda,grad,hessian] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options) +//========= E N D === O F === D E M O =========// diff --git a/demos/fminimax.dem.sce b/demos/fminimax.dem.sce new file mode 100644 index 0000000..404af00 --- /dev/null +++ b/demos/fminimax.dem.sce @@ -0,0 +1,73 @@ +mode(1) +// +// Demo of fminimax.sci +// + +// A basic case : +// we provide only the objective function and the nonlinear constraint +// function +function f = myfun(x) +f(1)= 2*x(1)^2 + x(2)^2 - 48*x(1) - 40*x(2) + 304; //Objectives +f(2)= -x(1)^2 - 3*x(2)^2; +f(3)= x(1) + 3*x(2) -18; +f(4)= -x(1) - x(2); +f(5)= x(1) + x(2) - 8; +endfunction +// The initial guess +x0 = [0.1,0.1]; +// The expected solution : only 4 digits are guaranteed +//xopt = [4 4] +//fopt = [0 -64 -2 -8 0] +maxfopt = 0 +// Run fminimax +[xopt,fopt,maxfval,exitflag,output,lambda] = fminimax(myfun, x0) +// Press ENTER to continue +halt() // Press return to continue + +// A case where we provide the gradient of the objective +// functions and the Jacobian matrix of the constraints. +// The objective function and its gradient +function f = myfun(x) +f(1)= 2*x(1)^2 + x(2)^2 - 48*x(1) - 40*x(2) + 304; +f(2)= -x(1)^2 - 3*x(2)^2; +f(3)= x(1) + 3*x(2) -18; +f(4)= -x(1) - x(2); +f(5)= x(1) + x(2) - 8; +endfunction +// Defining gradient of myfun +function G = myfungrad(x) +G = [ 4*x(1) - 48, -2*x(1), 1, -1, 1; +2*x(2) - 40, -6*x(2), 3, -1, 1; ]' +endfunction +// The nonlinear constraints and the Jacobian +// matrix of the constraints +function [c,ceq] = confun(x) +// Inequality constraints +c = [1.5 + x(1)*x(2) - x(1) - x(2), -x(1)*x(2) - 10] +// No nonlinear equality constraints +ceq=[] +endfunction +// Defining gradient of confungrad +function [DC,DCeq] = cgrad(x) +// DC(:,i) = gradient of the i-th constraint +// DC = [ +// Dc1/Dx1 Dc1/Dx2 +// Dc2/Dx1 Dc2/Dx2 +// ] +DC= [ +x(2)-1, -x(2) +x(1)-1, -x(1) +]' +DCeq = []' +endfunction +// Test with both gradient of objective and gradient of constraints +minimaxOptions = list("GradObj",myfungrad,"GradCon",cgrad); +// The initial guess +x0 = [0,10]; +// The expected solution : only 4 digits are guaranteed +//xopt = [0.92791 7.93551] +//fopt = [6.73443 -189.778 6.73443 -8.86342 0.86342] +maxfopt = 6.73443 +// Run fminimax +[xopt,fopt,maxfval,exitflag,output] = fminimax(myfun,x0,[],[],[],[],[],[], confun, minimaxOptions) +//========= E N D === O F === D E M O =========// diff --git a/demos/fminunc.dem.sce b/demos/fminunc.dem.sce new file mode 100644 index 0000000..80eed72 --- /dev/null +++ b/demos/fminunc.dem.sce @@ -0,0 +1,61 @@ +mode(1) +// +// Demo of fminunc.sci +// + +//Find x in R^2 such that it minimizes the Rosenbrock function +//f = 100*(x2 - x1^2)^2 + (1-x1)^2 +//Objective function to be minimised +function y= f(x) +y= 100*(x(2) - x(1)^2)^2 + (1-x(1))^2; +endfunction +//Starting point +x0=[-1,2]; +//Gradient of objective function +function y= fGrad(x) +y= [-400*x(1)*x(2) + 400*x(1)^3 + 2*x(1)-2, 200*(x(2)-x(1)^2)]; +endfunction +//Hessian of Objective Function +function y= fHess(x) +y= [1200*x(1)^2- 400*x(2) + 2, -400*x(1);-400*x(1), 200 ]; +endfunction +//Options +options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", fGrad, "Hessian", fHess); +//Calling Ipopt +[xopt,fopt,exitflag,output,gradient,hessian]=fminunc(f,x0,options) +halt() // Press return to continue + +//Find x in R^2 such that the below function is minimum +//f = x1^2 + x2^2 +//Objective function to be minimised +function y= f(x) +y= x(1)^2 + x(2)^2; +endfunction +//Starting point +x0=[2,1]; +//Calling Ipopt +[xopt,fopt]=fminunc(f,x0) +halt() // Press return to continue + +//The below problem is an unbounded problem: +//Find x in R^2 such that the below function is minimum +//f = - x1^2 - x2^2 +//Objective function to be minimised +function y= f(x) +y= -x(1)^2 - x(2)^2; +endfunction +//Starting point +x0=[2,1]; +//Gradient of objective function +function y= fGrad(x) +y= [-2*x(1),-2*x(2)]; +endfunction +//Hessian of Objective Function +function y= fHess(x) +y= [-2,0;0,-2]; +endfunction +//Options +options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", fGrad, "Hessian", fHess); +//Calling Ipopt +[xopt,fopt,exitflag,output,gradient,hessian]=fminunc(f,x0,options) +//========= E N D === O F === D E M O =========// diff --git a/demos/linprog.dem.sce b/demos/linprog.dem.sce new file mode 100755 index 0000000..337a5dc --- /dev/null +++ b/demos/linprog.dem.sce @@ -0,0 +1,64 @@ +mode(1) +// +// Demo of linprog.sci +// + +//Optimal problems +//Linear program, linear inequality constraints +c=[-1,-1/3]' +A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1] +b=[2,1,2,1,-1,2] +[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b) +// Press ENTER to continue +halt() // Press return to continue + +//Linear program with Linear Inequalities and Equalities` +c=[-1,-1/3]' +A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1] +b=[2,1,2,1,-1,2] +Aeq=[1,1/4] +beq=[1/2] +[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq) +// Press ENTER to continue +halt() // Press return to continue + +//Linear program with all constraint types +c=[-1,-1/3]' +A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1] +b=[2,1,2,1,-1,2] +Aeq=[1,1/4] +beq=[1/2] +lb=[-1,-0.5] +ub=[1.5,1.25] +[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq, lb, ub) +// Press ENTER to continue +halt() // Press return to continue + +//Primal Infeasible Problem +c=[-1,-1,-1]' +A=[1,2,-1] +b=[-4] +Aeq=[1,5,3;1,1,0] +beq=[10,100] +lb=[0,0,0] +ub=[%inf,%inf,%inf] +[xopt,fopt,exitflag,output,lambda]= linprog(c,A,b,Aeq,beq,lb,ub) +// Press ENTER to continue +halt() // Press return to continue + +//Dual Infeasible Problem +c=[3,5,-7]' +A=[-1,-1,4;1,1,4] +b=[-8,5] +Aeq=[] +beq=[] +lb=[-%inf,-%inf,-%inf] +ub=[%inf,%inf,%inf] +[xopt,fopt,exitflag,output,lambda]= linprog(c,A,b,Aeq,beq,lb,ub) +// Press ENTER to continue +halt() // Press return to continue + +filepath = get_absolute_file_path('linprog.dem.sce'); +filepath = filepath + "exmip1.mps" +[xopt,fopt,exitflag,output,lambda] =linprog(filepath); +//========= E N D === O F === D E M O =========// diff --git a/help/en_US/fgoalattain.xml b/help/en_US/fgoalattain.xml new file mode 100644 index 0000000..29a9923 --- /dev/null +++ b/help/en_US/fgoalattain.xml @@ -0,0 +1,232 @@ + + + + + + + + fgoalattain + Solves a multiobjective goal attainment problem + + + + + Calling Sequence + + x = fgoalattain(fun,x0,goal,weight) + x = fgoalattain(fun,x0,goal,weight,A,b) + x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq) + x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub) + x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon) + x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon,options) + [x,fval] = fgoalattain(...) + [x,fval,attainfactor] = fgoalattain(...) + [x,fval,attainfactor,exitflag] = fgoalattain(...) + [x,fval,attainfactor,exitflag,output] = fgoalattain(...) + [x,fval,attainfactor,exitflag,output,lambda] = fgoalattain(...) + + + + + + Parameters + + fun: + a function that accepts a vector x and returns a vector F + x0: + a nx1 or 1xn matrix of double, where n is the number of variables. + A: + a nil x n matrix of double, where n is the number of variables and + b: + a nil x 1 matrix of double, where nil is the number of linear + Aeq: + a nel x n matrix of double, where n is the number of variables + beq: + a nel x 1 matrix of double, where nel is the number of linear + lb: + a nx1 or 1xn matrix of double, where n is the number of variables. + ub: + a nx1 or 1xn matrix of double, where n is the number of variables. + nonlcon: + a function, the nonlinear constraints + options : + a list, containing the option for user to specify. See below for details. + x: + a nx1 matrix of double, the computed solution of the optimization problem + fval: + a vector of double, the value of functions at x + attainfactor: + The amount of over- or underachievement of the goals,γ at the solution. + exitflag: + a 1x1 matrix of floating point integers, the exit status + output: + a struct, the details of the optimization process + lambda: + a struct, the Lagrange multipliers at optimum + + + + + Description + +fgoalattain solves the goal attainment problem, which is one formulation for minimizing a multiobjective optimization problem. +Finds the minimum of a problem specified by: +Minimise Y such that + + + +\begin{eqnarray} +\mbox{min}_{x,\gamma} & f(x)-weight \ast \gamma \leq goal \\ +\mbox{subject to} & c(x) \leq 0 \\ +& c_{eq}(x) = 0 \\ +& Ax \leq b \\ +& A_{eq} x = b_{eq} \\ +& lb \leq x \leq ub +\end{eqnarray} + + + +The solver makes use of fmincon to find the minimum. + + +The fgoalattain finds out the maximum value of Y for the objectives evaluated at the starting point and +adds that as another variable to the vector x +This is passed to the fmincon function to get the optimised value of Y +Hence, the algorithm used mainly is "ipopt" to obtain the optimum solution +The relations between f(x), Y, weights and goals are added as additional non-linear inequality constraints + + +The options allows the user to set various parameters of the Optimization problem. +It should be defined as type "list" and contains the following fields. + +Syntax : options= list("MaxIter", [---], "CpuTime", [---], "GradObj", ---, "GradCon", ---); +MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take. +CpuTime : a Scalar, containing the Maximum amount of CPU Time that the solver should take. +GradObj : a function, representing the gradient function of the Objective in Vector Form. +GradCon : a function, representing the gradient of the Non-Linear Constraints (both Equality and Inequality) of the problem. It is declared in such a way that gradient of non-linear inequality constraints are defined first as a separate Matrix (cg of size m2 X n or as an empty), followed by gradient of non-linear equality constraints as a separate Matrix (ceqg of size m2 X n or as an empty) where m2 & m3 are number of non-linear inequality and equality constraints respectively. +Default Values : options = list("MaxIter", [3000], "CpuTime", [600]); + + + +By default, the gradient options for fminimax are turned off and and fmincon does the gradient opproximation of minmaxObjfun. In case the GradObj option is off and GradConstr option is on, fminimax approximates minmaxObjfun gradient using numderivative toolbox. + + +If we can provide exact gradients, we should do so since it improves the convergence speed of the optimization algorithm. + + +Furthermore, we must enable the "GradObj" option with the statement : + +minimaxOptions = list("GradObj",fGrad); + +This will let fminimax know that the exact gradient of the objective function is known, so that it can change the calling sequence to the objective function. Note that, fGrad should be mentioned in the form of N x n where n is the number of variables, N is the number of functions in objective function. + + +The constraint function must have header : + +[c, ceq] = confun(x) + +where x is a n x 1 matrix of dominmaxUbles, c is a 1 x nni matrix of doubles and ceq is a 1 x nne matrix of doubles (nni : number of nonlinear inequality constraints, nne : number of nonlinear equality constraints). +On input, the variable x contains the current point and, on output, the variable c must contain the nonlinear inequality constraints and ceq must contain the nonlinear equality constraints. + + +By default, the gradient options for fminimax are turned off and and fmincon does the gradient opproximation of confun. In case the GradObj option is on and GradCons option is off, fminimax approximates confun gradient using numderivative toolbox. + + +If we can provide exact gradients, we should do so since it improves the convergence speed of the optimization algorithm. + + +Furthermore, we must enable the "GradCon" option with the statement : + +minimaxOptions = list("GradCon",confunGrad); + +This will let fminimax know that the exact gradient of the objective function is known, so that it can change the calling sequence to the objective function. + + +The constraint derivative function must have header : + +[dc,dceq] = confungrad(x) + +where dc is a nni x n matrix of doubles and dceq is a nne x n matrix of doubles. + + +The exitflag allows to know the status of the optimization which is given back by Ipopt. + +exitflag=0 : Optimal Solution Found +exitflag=1 : Maximum Number of Iterations Exceeded. Output may not be optimal. +exitflag=2 : Maximum amount of CPU Time exceeded. Output may not be optimal. +exitflag=3 : Stop at Tiny Step. +exitflag=4 : Solved To Acceptable Level. +exitflag=5 : Converged to a point of local infeasibility. + + + +For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/ + + +The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. + +output.Iterations: The number of iterations performed during the search +output.Cpu_Time: The total cpu-time spend during the search +output.Objective_Evaluation: The number of Objective Evaluations performed during the search +output.Dual_Infeasibility: The Dual Infeasiblity of the final soution + + + +The lambda data structure contains the Lagrange multipliers at the end +of optimization. In the current version the values are returned only when the the solution is optimal. +It has type "struct" and contains the following fields. + +lambda.lower: The Lagrange multipliers for the lower bound constraints. +lambda.upper: The Lagrange multipliers for the upper bound constraints. +lambda.eqlin: The Lagrange multipliers for the linear equality constraints. +lambda.ineqlin: The Lagrange multipliers for the linear inequality constraints. +lambda.eqnonlin: The Lagrange multipliers for the non-linear equality constraints. +lambda.ineqnonlin: The Lagrange multipliers for the non-linear inequality constraints. + + + + + + + + Examples + + + + + Authors + + Prajwala TM, Sheetal Shalini , 2015 + + + diff --git a/help/en_US/fminbnd.xml b/help/en_US/fminbnd.xml new file mode 100644 index 0000000..baf2f34 --- /dev/null +++ b/help/en_US/fminbnd.xml @@ -0,0 +1,197 @@ + + + + + + + + fminbnd + Solves a multi-variable optimization problem on a bounded interval + + + + + Calling Sequence + + xopt = fminbnd(f,x1,x2) + xopt = fminbnd(f,x1,x2,options) + [xopt,fopt] = fminbnd(.....) + [xopt,fopt,exitflag]= fminbnd(.....) + [xopt,fopt,exitflag,output]=fminbnd(.....) + [xopt,fopt,exitflag,output,lambda]=fminbnd(.....) + + + + + + Parameters + + f : + a function, representing the objective function of the problem + x1 : + a vector, containing the lower bound of the variables of size (1 X n) or (n X 1) where 'n' is the number of Variables, where n is number of Variables + x2 : + a vector, containing the upper bound of the variables of size (1 X n) or (n X 1) or (0 X 0) where 'n' is the number of Variables. If x2 is empty it means upper bound is +infinity + options : + a list, containing the option for user to specify. See below for details. + xopt : + a vector of doubles, containing the the computed solution of the optimization problem. + fopt : + a scalar of double, containing the the function value at x. + exitflag : + a scalar of integer, containing the flag which denotes the reason for termination of algorithm. See below for details. + output : + a structure, containing the information about the optimization. See below for details. + lambda : + a structure, containing the Lagrange multipliers of lower bound and upper bound at the optimized point. See below for details. + + + + + Description + +Search the minimum of a multi-variable function on bounded interval specified by : +Find the minimum of f(x) such that + + + +\begin{eqnarray} +&\mbox{min}_{x} +& f(x)\\ +& \text{subject to} & x1 \ < x \ < x2 \\ +\end{eqnarray} + + + +The routine calls Ipopt for solving the Bounded Optimization problem, Ipopt is a library written in C++. + + +The options allows the user to set various parameters of the Optimization problem. +It should be defined as type "list" and contains the following fields. + +Syntax : options= list("MaxIter", [---], "CpuTime", [---], TolX, [----]); +MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take. +CpuTime : a Scalar, containing the Maximum amount of CPU Time that the solver should take. +TolX : a Scalar, containing the Tolerance value that the solver should take. +Default Values : options = list("MaxIter", [3000], "CpuTime", [600], TolX, [1e-4]); + + + +The exitflag allows to know the status of the optimization which is given back by Ipopt. + +exitflag=0 : Optimal Solution Found +exitflag=1 : Maximum Number of Iterations Exceeded. Output may not be optimal. +exitflag=2 : Maximum CPU Time exceeded. Output may not be optimal. +exitflag=3 : Stop at Tiny Step. +exitflag=4 : Solved To Acceptable Level. +exitflag=5 : Converged to a point of local infeasibility. + + + +For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/ + + +The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. + +output.Iterations: The number of iterations performed during the search +output.Cpu_Time: The total cpu-time spend during the search +output.Objective_Evaluation: The number of Objective Evaluations performed during the search +output.Dual_Infeasibility: The Dual Infeasiblity of the final soution + + + +The lambda data structure contains the Lagrange multipliers at the end +of optimization. In the current version the values are returned only when the the solution is optimal. +It has type "struct" and contains the following fields. + +lambda.lower: The Lagrange multipliers for the lower bound constraints. +lambda.upper: The Lagrange multipliers for the upper bound constraints. + + + + + + + + Examples + + + + + Examples + + + + + Examples + + + + + Authors + + R.Vidyadhar , Vignesh Kannan + + + diff --git a/help/en_US/fmincon.xml b/help/en_US/fmincon.xml new file mode 100644 index 0000000..d8a7c4b --- /dev/null +++ b/help/en_US/fmincon.xml @@ -0,0 +1,334 @@ + + + + + + + + fmincon + Solves a multi-variable constrainted optimization problem + + + + + Calling Sequence + + xopt = fmincon(f,x0,A,b) + xopt = fmincon(f,x0,A,b,Aeq,beq) + xopt = fmincon(f,x0,A,b,Aeq,beq,lb,ub) + xopt = fmincon(f,x0,A,b,Aeq,beq,lb,ub,nlc) + xopt = fmincon(f,x0,A,b,Aeq,beq,lb,ub,nlc,options) + [xopt,fopt] = fmincon(.....) + [xopt,fopt,exitflag]= fmincon(.....) + [xopt,fopt,exitflag,output]= fmincon(.....) + [xopt,fopt,exitflag,output,lambda]=fmincon(.....) + [xopt,fopt,exitflag,output,lambda,gradient]=fmincon(.....) + [xopt,fopt,exitflag,output,lambda,gradient,hessian]=fmincon(.....) + + + + + + Parameters + + f : + a function, representing the objective function of the problem + x0 : + a vector of doubles, containing the starting values of variables of size (1 X n) or (n X 1) where 'n' is the number of Variables + A : + a matrix of doubles, containing the coefficients of linear inequality constraints of size (m X n) where 'm' is the number of linear inequality constraints + b : + a vector of doubles, related to 'A' and containing the the Right hand side equation of the linear inequality constraints of size (m X 1) + Aeq : + a matrix of doubles, containing the coefficients of linear equality constraints of size (m1 X n) where 'm1' is the number of linear equality constraints + beq : + a vector of doubles, related to 'Aeq' and containing the the Right hand side equation of the linear equality constraints of size (m1 X 1) + lb : + a vector of doubles, containing the lower bounds of the variables of size (1 X n) or (n X 1) where 'n' is the number of Variables + ub : + a vector of doubles, containing the upper bounds of the variables of size (1 X n) or (n X 1) where 'n' is the number of Variables + nlc : + a function, representing the Non-linear Constraints functions(both Equality and Inequality) of the problem. It is declared in such a way that non-linear inequality constraints are defined first as a single row vector (c), followed by non-linear equality constraints as another single row vector (ceq). Refer Example for definition of Constraint function. + options : + a list, containing the option for user to specify. See below for details. + xopt : + a vector of doubles, cointating the computed solution of the optimization problem + fopt : + a scalar of double, containing the the function value at x + exitflag : + a scalar of integer, containing the flag which denotes the reason for termination of algorithm. See below for details. + output : + a structure, containing the information about the optimization. See below for details. + lambda : + a structure, containing the Lagrange multipliers of lower bound, upper bound and constraints at the optimized point. See below for details. + gradient : + a vector of doubles, containing the Objective's gradient of the solution. + hessian : + a matrix of doubles, containing the Lagrangian's hessian of the solution. + + + + + Description + +Search the minimum of a constrained optimization problem specified by : +Find the minimum of f(x) such that + + + +\begin{eqnarray} +&\mbox{min}_{x} +& f(x) \\ +& \text{subject to} & A*x \leq b \\ +& & Aeq*x \ = beq\\ +& & c(x) \leq 0\\ +& & ceq(x) \ = 0\\ +& & lb \leq x \leq ub \\ +\end{eqnarray} + + + +The routine calls Ipopt for solving the Constrained Optimization problem, Ipopt is a library written in C++. + + +The options allows the user to set various parameters of the Optimization problem. +It should be defined as type "list" and contains the following fields. + +Syntax : options= list("MaxIter", [---], "CpuTime", [---], "GradObj", ---, "Hessian", ---, "GradCon", ---); +MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take. +CpuTime : a Scalar, containing the Maximum amount of CPU Time that the solver should take. +GradObj : a function, representing the gradient function of the Objective in Vector Form. +Hessian : a function, representing the hessian function of the Lagrange in Symmetric Matrix Form with Input parameters x, Objective factor and Lambda. Refer Example for definition of Lagrangian Hessian function. +GradCon : a function, representing the gradient of the Non-Linear Constraints (both Equality and Inequality) of the problem. It is declared in such a way that gradient of non-linear inequality constraints are defined first as a separate Matrix (cg of size m2 X n or as an empty), followed by gradient of non-linear equality constraints as a separate Matrix (ceqg of size m2 X n or as an empty) where m2 & m3 are number of non-linear inequality and equality constraints respectively. +Default Values : options = list("MaxIter", [3000], "CpuTime", [600]); + + + +The exitflag allows to know the status of the optimization which is given back by Ipopt. + +exitflag=0 : Optimal Solution Found +exitflag=1 : Maximum Number of Iterations Exceeded. Output may not be optimal. +exitflag=2 : Maximum amount of CPU Time exceeded. Output may not be optimal. +exitflag=3 : Stop at Tiny Step. +exitflag=4 : Solved To Acceptable Level. +exitflag=5 : Converged to a point of local infeasibility. + + + +For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/ + + +The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. + +output.Iterations: The number of iterations performed during the search +output.Cpu_Time: The total cpu-time spend during the search +output.Objective_Evaluation: The number of Objective Evaluations performed during the search +output.Dual_Infeasibility: The Dual Infeasiblity of the final soution + + + +The lambda data structure contains the Lagrange multipliers at the end +of optimization. In the current version the values are returned only when the the solution is optimal. +It has type "struct" and contains the following fields. + +lambda.lower: The Lagrange multipliers for the lower bound constraints. +lambda.upper: The Lagrange multipliers for the upper bound constraints. +lambda.eqlin: The Lagrange multipliers for the linear equality constraints. +lambda.ineqlin: The Lagrange multipliers for the linear inequality constraints. +lambda.eqnonlin: The Lagrange multipliers for the non-linear equality constraints. +lambda.ineqnonlin: The Lagrange multipliers for the non-linear inequality constraints. + + + + + + + + Examples + + + + + Examples + + + + + Examples + + + + + Examples + + + + + Authors + + R.Vidyadhar , Vignesh Kannan + + + diff --git a/help/en_US/fminimax.xml b/help/en_US/fminimax.xml new file mode 100644 index 0000000..ddab078 --- /dev/null +++ b/help/en_US/fminimax.xml @@ -0,0 +1,293 @@ + + + + + + + + fminimax + Solves minimax constraint problem + + + + + Calling Sequence + + x = fminimax(fun,x0) + x = fminimax(fun,x0,A,b) + x = fminimax(fun,x0,A,b,Aeq,beq) + x = fminimax(fun,x0,A,b,Aeq,beq,lb,ub) + x = fminimax(fun,x0,A,b,Aeq,beq,lb,ub,nonlinfun) + x = fminimax(fun,x0,A,b,Aeq,beq,lb,ub,nonlinfun,options) + [x, fval] = fmincon(.....) + [x, fval, maxfval]= fmincon(.....) + [x, fval, maxfval, exitflag]= fmincon(.....) + [x, fval, maxfval, exitflag, output]= fmincon(.....) + [x, fval, maxfval, exitflag, output, lambda]= fmincon(.....) + + + + + + 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. + x0: + a nx1 or 1xn matrix of doubles, where n is the number of variables, the initial guess for the optimization algorithm + A: + a nil x n matrix of doubles, where n is the number of variables and nil is the number of linear inequalities. If A==[] and b==[], it is assumed that there is no linear inequality constraints. If (A==[] & b<>[]), fminimax generates an error (the same happens if (A<>[] & b==[])) + b: + a nil x 1 matrix of doubles, where nil is the number of linear inequalities + Aeq: + a nel x n matrix of doubles, where n is the number of variables and nel is the number of linear equalities. If Aeq==[] and beq==[], it is assumed that there is no linear equality constraints. If (Aeq==[] & beq<>[]), fminimax generates an error (the same happens if (Aeq<>[] & beq==[])) + beq: + a nel x 1 matrix of doubles, where nel is the number of linear equalities + lb: + a nx1 or 1xn matrix of doubles, where n is the number of variables. The lower bound for x. If lb==[], then the lower bound is automatically set to -inf + ub: + a nx1 or 1xn matrix of doubles, where n is the number of variables. The upper bound for x. If ub==[], then the upper bound is automatically set to +inf + nonlinfun: + function that computes the nonlinear inequality constraints c(x) <= 0 and nonlinear equality constraints ceq(x) = 0. + x: + a nx1 matrix of doubles, the computed solution of the optimization problem + fval: + a vector of doubles, the value of fun at x + maxfval: + a 1x1 matrix of doubles, the maximum value in vector fval + exitflag: + a 1x1 matrix of floating point integers, the exit status + output: + a struct, the details of the optimization process + lambda: + a struct, the Lagrange multipliers at optimum + options: + a list, containing the option for user to specify. See below for details. + + + + + Description + +fminimax minimizes the worst-case (largest) value of a set of multivariable functions, starting at an initial estimate. This is generally referred to as the minimax problem. + + + +\min_{x} \max_{i} F_{i}(x)\: \textrm{such that} \:\begin{cases} +& c(x) \leq 0 \\ +& ceq(x) = 0 \\ +& A.x \leq b \\ +& Aeq.x = beq \\ +& minmaxLb \leq x \leq minmaxUb +\end{cases} + + + +Currently, fminimax calls fmincon which uses the ip-opt algorithm. + + +max-min problems can also be solved with fminimax, using the identity + + + +\max_{x} \min_{i} F_{i}(x) = -\min_{x} \max_{i} \left( -F_{i}(x) \right) + + + +The options allows the user to set various parameters of the Optimization problem. +It should be defined as type "list" and contains the following fields. + +Syntax : options= list("MaxIter", [---], "CpuTime", [---], "GradObj", ---, "GradCon", ---); +MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take. +CpuTime : a Scalar, containing the Maximum amount of CPU Time that the solver should take. +GradObj : a function, representing the gradient function of the Objective in Vector Form. +GradCon : a function, representing the gradient of the Non-Linear Constraints (both Equality and Inequality) of the problem. It is declared in such a way that gradient of non-linear inequality constraints are defined first as a separate Matrix (cg of size m2 X n or as an empty), followed by gradient of non-linear equality constraints as a separate Matrix (ceqg of size m2 X n or as an empty) where m2 & m3 are number of non-linear inequality and equality constraints respectively. +Default Values : options = list("MaxIter", [3000], "CpuTime", [600]); + + + +The objective function must have header : + +F = fun(x) + +where x is a n x 1 matrix of doubles and F is a m x 1 matrix of doubles where m is the total number of objective functions inside F. +On input, the variable x contains the current point and, on output, the variable F must contain the objective function values. + + +By default, the gradient options for fminimax are turned off and and fmincon does the gradient opproximation of minmaxObjfun. In case the GradObj option is off and GradConstr option is on, fminimax approximates minmaxObjfun gradient using numderivative toolbox. + + +If we can provide exact gradients, we should do so since it improves the convergence speed of the optimization algorithm. + + +Furthermore, we must enable the "GradObj" option with the statement : + +minimaxOptions = list("GradObj",fGrad); + +This will let fminimax know that the exact gradient of the objective function is known, so that it can change the calling sequence to the objective function. Note that, fGrad should be mentioned in the form of N x n where n is the number of variables, N is the number of functions in objective function. + + +The constraint function must have header : + +[c, ceq] = confun(x) + +where x is a n x 1 matrix of dominmaxUbles, c is a 1 x nni matrix of doubles and ceq is a 1 x nne matrix of doubles (nni : number of nonlinear inequality constraints, nne : number of nonlinear equality constraints). +On input, the variable x contains the current point and, on output, the variable c must contain the nonlinear inequality constraints and ceq must contain the nonlinear equality constraints. + + +By default, the gradient options for fminimax are turned off and and fmincon does the gradient opproximation of confun. In case the GradObj option is on and GradCons option is off, fminimax approximates confun gradient using numderivative toolbox. + + +If we can provide exact gradients, we should do so since it improves the convergence speed of the optimization algorithm. + + +Furthermore, we must enable the "GradCon" option with the statement : + +minimaxOptions = list("GradCon",confunGrad); + +This will let fminimax know that the exact gradient of the objective function is known, so that it can change the calling sequence to the objective function. + + +The constraint derivative function must have header : + +[dc,dceq] = confungrad(x) + +where dc is a nni x n matrix of doubles and dceq is a nne x n matrix of doubles. + + +The exitflag allows to know the status of the optimization which is given back by Ipopt. + +exitflag=0 : Optimal Solution Found +exitflag=1 : Maximum Number of Iterations Exceeded. Output may not be optimal. +exitflag=2 : Maximum amount of CPU Time exceeded. Output may not be optimal. +exitflag=3 : Stop at Tiny Step. +exitflag=4 : Solved To Acceptable Level. +exitflag=5 : Converged to a point of local infeasibility. + + + +For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/ + + +The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. + +output.Iterations: The number of iterations performed during the search +output.Cpu_Time: The total cpu-time spend during the search +output.Objective_Evaluation: The number of Objective Evaluations performed during the search +output.Dual_Infeasibility: The Dual Infeasiblity of the final soution + + + +The lambda data structure contains the Lagrange multipliers at the end +of optimization. In the current version the values are returned only when the the solution is optimal. +It has type "struct" and contains the following fields. + +lambda.lower: The Lagrange multipliers for the lower bound constraints. +lambda.upper: The Lagrange multipliers for the upper bound constraints. +lambda.eqlin: The Lagrange multipliers for the linear equality constraints. +lambda.ineqlin: The Lagrange multipliers for the linear inequality constraints. +lambda.eqnonlin: The Lagrange multipliers for the non-linear equality constraints. +lambda.ineqnonlin: The Lagrange multipliers for the non-linear inequality constraints. + + + + + + + + Examples + + + + + Examples + + + + + Authors + + Animesh Baranawal + + + diff --git a/help/en_US/fminunc.xml b/help/en_US/fminunc.xml new file mode 100644 index 0000000..a28a82a --- /dev/null +++ b/help/en_US/fminunc.xml @@ -0,0 +1,196 @@ + + + + + + + + fminunc + Solves a multi-variable unconstrainted optimization problem + + + + + Calling Sequence + + xopt = fminunc(f,x0) + xopt = fminunc(f,x0,options) + [xopt,fopt] = fminunc(.....) + [xopt,fopt,exitflag]= fminunc(.....) + [xopt,fopt,exitflag,output]= fminunc(.....) + [xopt,fopt,exitflag,output,gradient]=fminunc(.....) + [xopt,fopt,exitflag,output,gradient,hessian]=fminunc(.....) + + + + + + Parameters + + f : + a function, representing the objective function of the problem + x0 : + a vector of doubles, containing the starting of variables. + options: + a list, containing the option for user to specify. See below for details. + xopt : + a vector of doubles, the computed solution of the optimization problem. + fopt : + a scalar of double, the function value at x. + exitflag : + a scalar of integer, containing the flag which denotes the reason for termination of algorithm. See below for details. + output : + a structure, containing the information about the optimization. See below for details. + gradient : + a vector of doubles, containing the the gradient of the solution. + hessian : + a matrix of doubles, containing the the hessian of the solution. + + + + + Description + +Search the minimum of an unconstrained optimization problem specified by : +Find the minimum of f(x) such that + + + +\begin{eqnarray} +&\mbox{min}_{x} +& f(x)\\ +\end{eqnarray} + + + +The routine calls Ipopt for solving the Un-constrained Optimization problem, Ipopt is a library written in C++. + + +The options allows the user to set various parameters of the Optimization problem. +It should be defined as type "list" and contains the following fields. + +Syntax : options= list("MaxIter", [---], "CpuTime", [---], "Gradient", ---, "Hessian", ---); +MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take. +CpuTime : a Scalar, containing the Maximum amount of CPU Time that the solver should take. +Gradient : a function, representing the gradient function of the Objective in Vector Form. +Hessian : a function, representing the hessian function of the Objective in Symmetric Matrix Form. +Default Values : options = list("MaxIter", [3000], "CpuTime", [600]); + + + +The exitflag allows to know the status of the optimization which is given back by Ipopt. + +exitflag=0 : Optimal Solution Found +exitflag=1 : Maximum Number of Iterations Exceeded. Output may not be optimal. +exitflag=2 : Maximum CPU Time exceeded. Output may not be optimal. +exitflag=3 : Stop at Tiny Step. +exitflag=4 : Solved To Acceptable Level. +exitflag=5 : Converged to a point of local infeasibility. + + + +For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/ + + +The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. + +output.Iterations: The number of iterations performed during the search +output.Cpu_Time: The total cpu-time spend during the search +output.Objective_Evaluation: The number of Objective Evaluations performed during the search +output.Dual_Infeasibility: The Dual Infeasiblity of the final soution + + + + + + + + Examples + + + + + Examples + + + + + Examples + + + + + Authors + + R.Vidyadhar , Vignesh Kannan + + + diff --git a/help/en_US/linprog.xml b/help/en_US/linprog.xml new file mode 100755 index 0000000..1aa6e7c --- /dev/null +++ b/help/en_US/linprog.xml @@ -0,0 +1,222 @@ + + + + + + + + linprog + Solves a linear programming problem. + + + + + Calling Sequence + + xopt = linprog(c,A,b) + xopt = linprog(c,A,b,Aeq,beq) + xopt = linprog(c,A,b,Aeq,beq,lb,ub) + xopt = linprog(c,A,b,Aeq,beq,lb,ub,param) + [xopt, fopt, exitflag, output, lambda] = linprog(file) + [xopt,fopt,exitflag,output,lambda] = linprog( ... ) + + + + + + Parameters + + c : + a vector of double, contains coefficients of the variables in the objective + A : + a matrix of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b. + b : + a vector of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b. + Aeq : + a matrix of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq. + beq : + a vector of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq. + lb : + Lower bounds, specified as a vector or array of double. lb represents the lower bounds elementwise in lb ≤ x ≤ ub. + ub : + Upper bounds, specified as a vector or array of double. ub represents the upper bounds elementwise in lb ≤ x ≤ ub. + options : + a list containing the parameters to be set. + file : + a string describing the path to the mps file. + xopt : + a vector of double, the computed solution of the optimization problem. + fopt : + a double, the value of the function at x. + status : + status flag returned from symphony. See below for details. + output : + The output data structure contains detailed information about the optimization process. See below for details. + lambda : + The structure consist of the Lagrange multipliers at the solution of problem. See below for details. + + + + + Description + +OSI-CLP is used for solving the linear programming problems, OSI-CLP is a library written in C++. +Search the minimum of a constrained linear programming problem specified by : + + + +\begin{eqnarray} +&\mbox{min}_{x} +& c^T⋅x \\ +& \text{subject to} & A⋅x \leq b \\ +& & Aeq⋅x = beq \\ +& & lb \leq x \leq ub \\ +\end{eqnarray} + +The routine calls Clp for solving the linear programming problem, Clp is a library written in C++. + + +The exitflag allows to know the status of the optimization which is given back by Ipopt. + +exitflag=0 : Optimal Solution Found +exitflag=1 : Primal Infeasible +exitflag=2 : Dual Infeasible +exitflag=3 : Maximum Number of Iterations Exceeded. Output may not be optimal. +exitflag=4 : Solution Abandoned +exitflag=5 : Primal objective limit reached. +exitflag=6 : Dual objective limit reached. + + + +For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/ + + +The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. + +output.iterations: The number of iterations performed during the search +output.constrviolation: The max-norm of the constraint violation. + + + +The lambda data structure contains the Lagrange multipliers at the end +of optimization. In the current version the values are returned only when the the solution is optimal. +It has type "struct" and contains the following fields. + +lambda.lower: The Lagrange multipliers for the lower bound constraints. +lambda.upper: The Lagrange multipliers for the upper bound constraints. +lambda.eqlin: The Lagrange multipliers for the linear equality constraints. +lambda.ineqlin: The Lagrange multipliers for the linear inequality constraints. + + + + + + + + Examples + + + + + Examples + + + + + Examples + + + + + Examples + + + + + Examples + + + + + Examples + + + + + Authors + + Bhanu Priya Sayal, Guru Pradeep Reddy + + + diff --git a/help/en_US/master_help.xml b/help/en_US/master_help.xml index e59ac6c..0e162f7 100644 --- a/help/en_US/master_help.xml +++ b/help/en_US/master_help.xml @@ -1,6 +1,11 @@ + + + + + @@ -81,6 +86,11 @@ Symphony Toolbox +&a745e19a6383796e6f5680cdcc44cfcce; +&a2b24cb19de46f878f11e6be9eb411170; +&a52664d077cac340a0384efe1ac107088; +&a14f1077f437dbe35eb1cac51fed7a9fc; +&aa809ed678033fc05c9b60a71de55b2ce; &a3d4ec65684b561d91f7a255acd23f51c; &aa4a031935f5eed6cfc8fc4a49823b00b; &a6b85f6e0c98751f20b68663a23cb4cd2; diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS index 2a1feb2..5ece28b 100644 Binary files a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS and b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS differ diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB index 386e0dd..5ba83c4 100644 Binary files a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB and b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB differ diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS b/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS index 465e052..bfdb148 100644 Binary files a/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS and b/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS differ diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS b/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS index 629f1cc..c20654a 100644 Binary files a/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS and b/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS differ diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA b/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA index dab0526..0648b6b 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA @@ -1,2 +1,2 @@ JavaSearch 1.0 -TMAP bs=2048 rt=1 fl=-1 id1=1279 id2=1 +TMAP bs=2048 rt=1 fl=-1 id1=1494 id2=1 diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP b/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP index 775c132..af633ee 100644 Binary files a/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP and b/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP differ diff --git a/help/en_US/scilab_en_US_help/_LaTeX_fgoalattain.xml_1.png b/help/en_US/scilab_en_US_help/_LaTeX_fgoalattain.xml_1.png new file mode 100644 index 0000000..7d7a4b6 Binary files /dev/null and b/help/en_US/scilab_en_US_help/_LaTeX_fgoalattain.xml_1.png differ diff --git a/help/en_US/scilab_en_US_help/_LaTeX_fminbnd.xml_1.png b/help/en_US/scilab_en_US_help/_LaTeX_fminbnd.xml_1.png new file mode 100644 index 0000000..2634ce3 Binary files /dev/null and b/help/en_US/scilab_en_US_help/_LaTeX_fminbnd.xml_1.png differ diff --git a/help/en_US/scilab_en_US_help/_LaTeX_fmincon.xml_1.png b/help/en_US/scilab_en_US_help/_LaTeX_fmincon.xml_1.png new file mode 100644 index 0000000..07910ed Binary files /dev/null and b/help/en_US/scilab_en_US_help/_LaTeX_fmincon.xml_1.png differ diff --git a/help/en_US/scilab_en_US_help/_LaTeX_fminunc.xml_1.png b/help/en_US/scilab_en_US_help/_LaTeX_fminunc.xml_1.png new file mode 100644 index 0000000..5250091 Binary files /dev/null and b/help/en_US/scilab_en_US_help/_LaTeX_fminunc.xml_1.png differ diff --git a/help/en_US/scilab_en_US_help/_LaTeX_linprog.xml_1.png b/help/en_US/scilab_en_US_help/_LaTeX_linprog.xml_1.png new file mode 100644 index 0000000..1dd1d5e Binary files /dev/null and b/help/en_US/scilab_en_US_help/_LaTeX_linprog.xml_1.png differ diff --git a/help/en_US/scilab_en_US_help/fgoalattain.html b/help/en_US/scilab_en_US_help/fgoalattain.html new file mode 100644 index 0000000..a9aa43d --- /dev/null +++ b/help/en_US/scilab_en_US_help/fgoalattain.html @@ -0,0 +1,195 @@ + + + fgoalattain + + + +
+ + + + +
+ << Symphony Toolbox + + + Symphony Toolbox + + + fminbnd >> + +
+
+
+ + + + Symphony Toolbox >> Symphony Toolbox > fgoalattain + +

+

fgoalattain

+

Solves a multiobjective goal attainment problem

+ + +

Calling Sequence

+
x = fgoalattain(fun,x0,goal,weight)
+x = fgoalattain(fun,x0,goal,weight,A,b)
+x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq)
+x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub)
+x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon)
+x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon,options)
+[x,fval] = fgoalattain(...)
+[x,fval,attainfactor] = fgoalattain(...)
+[x,fval,attainfactor,exitflag] = fgoalattain(...)
+[x,fval,attainfactor,exitflag,output] = fgoalattain(...)
+[x,fval,attainfactor,exitflag,output,lambda] = fgoalattain(...)
+ +

Parameters

+
fun: +

a function that accepts a vector x and returns a vector F

+
x0: +

a nx1 or 1xn matrix of double, where n is the number of variables.

+
A: +

a nil x n matrix of double, where n is the number of variables and

+
b: +

a nil x 1 matrix of double, where nil is the number of linear

+
Aeq: +

a nel x n matrix of double, where n is the number of variables

+
beq: +

a nel x 1 matrix of double, where nel is the number of linear

+
lb: +

a nx1 or 1xn matrix of double, where n is the number of variables.

+
ub: +

a nx1 or 1xn matrix of double, where n is the number of variables.

+
nonlcon: +

a function, the nonlinear constraints

+
options : +

a list, containing the option for user to specify. See below for details.

+
x: +

a nx1 matrix of double, the computed solution of the optimization problem

+
fval: +

a vector of double, the value of functions at x

+
attainfactor: +

The amount of over- or underachievement of the goals,γ at the solution.

+
exitflag: +

a 1x1 matrix of floating point integers, the exit status

+
output: +

a struct, the details of the optimization process

+
lambda: +

a struct, the Lagrange multipliers at optimum

+ +

Description

+

fgoalattain solves the goal attainment problem, which is one formulation for minimizing a multiobjective optimization problem. +Finds the minimum of a problem specified by: +Minimise Y such that

+

+

The solver makes use of fmincon to find the minimum.

+

The fgoalattain finds out the maximum value of Y for the objectives evaluated at the starting point and +adds that as another variable to the vector x +This is passed to the fmincon function to get the optimised value of Y +Hence, the algorithm used mainly is "ipopt" to obtain the optimum solution +The relations between f(x), Y, weights and goals are added as additional non-linear inequality constraints

+

The options allows the user to set various parameters of the Optimization problem. +It should be defined as type "list" and contains the following fields. +

+

By default, the gradient options for fminimax are turned off and and fmincon does the gradient opproximation of minmaxObjfun. In case the GradObj option is off and GradConstr option is on, fminimax approximates minmaxObjfun gradient using numderivative toolbox.

+

If we can provide exact gradients, we should do so since it improves the convergence speed of the optimization algorithm.

+

Furthermore, we must enable the "GradObj" option with the statement : +

minimaxOptions = list("GradObj",fGrad);
+This will let fminimax know that the exact gradient of the objective function is known, so that it can change the calling sequence to the objective function. Note that, fGrad should be mentioned in the form of N x n where n is the number of variables, N is the number of functions in objective function.

+

The constraint function must have header : +

[c, ceq] = confun(x)
+where x is a n x 1 matrix of dominmaxUbles, c is a 1 x nni matrix of doubles and ceq is a 1 x nne matrix of doubles (nni : number of nonlinear inequality constraints, nne : number of nonlinear equality constraints). +On input, the variable x contains the current point and, on output, the variable c must contain the nonlinear inequality constraints and ceq must contain the nonlinear equality constraints.

+

By default, the gradient options for fminimax are turned off and and fmincon does the gradient opproximation of confun. In case the GradObj option is on and GradCons option is off, fminimax approximates confun gradient using numderivative toolbox.

+

If we can provide exact gradients, we should do so since it improves the convergence speed of the optimization algorithm.

+

Furthermore, we must enable the "GradCon" option with the statement : +

minimaxOptions = list("GradCon",confunGrad);
+This will let fminimax know that the exact gradient of the objective function is known, so that it can change the calling sequence to the objective function.

+

The constraint derivative function must have header : +

[dc,dceq] = confungrad(x)
+where dc is a nni x n matrix of doubles and dceq is a nne x n matrix of doubles.

+

The exitflag allows to know the status of the optimization which is given back by Ipopt. +

+

For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/

+

The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +

+

The lambda data structure contains the Lagrange multipliers at the end +of optimization. In the current version the values are returned only when the the solution is optimal. +It has type "struct" and contains the following fields. +

+

+ +

Examples

+
function f1=gattainObjfun(x)
+f1(1)=2*x(1)*x(1)+x(2)*x(2)-48*x(1)-40*x(2)+304
+f1(2)=-x(1)*x(1)-3*x(2)*x(2)
+f1(3)=x(1)+3*x(2)-18
+f1(4)=-x(1)-x(2)
+f1(5)=x(1)+x(2)-8
+endfunction
+x0=[-1,1];
+
+goal=[-5,-3,-2,-1,-4];
+weight=abs(goal)
+gval  =
+[- 0.0000011
+- 63.999998
+- 2.0000002
+- 8.
+3.485D-08]
+z  =
+[4.    3.99]
+
+Run fgoalattain
+[x,fval,attainfactor,exitflag,output,lambda]=fgoalattain(gattainObjfun,x0,goal,weight)
+ +

Authors

+
+
+ +
+ + + + + + +
Report an issue
+ << Symphony Toolbox + + + Symphony Toolbox + + + fminbnd >> + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/fminbnd.html b/help/en_US/scilab_en_US_help/fminbnd.html new file mode 100644 index 0000000..9b64d03 --- /dev/null +++ b/help/en_US/scilab_en_US_help/fminbnd.html @@ -0,0 +1,174 @@ + + + fminbnd + + + +
+ + + + +
+ << fgoalattain + + + Symphony Toolbox + + + fmincon >> + +
+
+
+ + + + Symphony Toolbox >> Symphony Toolbox > fminbnd + +

+

fminbnd

+

Solves a multi-variable optimization problem on a bounded interval

+ + +

Calling Sequence

+
xopt = fminbnd(f,x1,x2)
+xopt = fminbnd(f,x1,x2,options)
+[xopt,fopt] = fminbnd(.....)
+[xopt,fopt,exitflag]= fminbnd(.....)
+[xopt,fopt,exitflag,output]=fminbnd(.....)
+[xopt,fopt,exitflag,output,lambda]=fminbnd(.....)
+ +

Parameters

+
f : +

a function, representing the objective function of the problem

+
x1 : +

a vector, containing the lower bound of the variables of size (1 X n) or (n X 1) where 'n' is the number of Variables, where n is number of Variables

+
x2 : +

a vector, containing the upper bound of the variables of size (1 X n) or (n X 1) or (0 X 0) where 'n' is the number of Variables. If x2 is empty it means upper bound is +infinity

+
options : +

a list, containing the option for user to specify. See below for details.

+
xopt : +

a vector of doubles, containing the the computed solution of the optimization problem.

+
fopt : +

a scalar of double, containing the the function value at x.

+
exitflag : +

a scalar of integer, containing the flag which denotes the reason for termination of algorithm. See below for details.

+
output : +

a structure, containing the information about the optimization. See below for details.

+
lambda : +

a structure, containing the Lagrange multipliers of lower bound and upper bound at the optimized point. See below for details.

+ +

Description

+

Search the minimum of a multi-variable function on bounded interval specified by : +Find the minimum of f(x) such that

+

+

The routine calls Ipopt for solving the Bounded Optimization problem, Ipopt is a library written in C++.

+

The options allows the user to set various parameters of the Optimization problem. +It should be defined as type "list" and contains the following fields. +

+

The exitflag allows to know the status of the optimization which is given back by Ipopt. +

+

For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/

+

The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +

+

The lambda data structure contains the Lagrange multipliers at the end +of optimization. In the current version the values are returned only when the the solution is optimal. +It has type "struct" and contains the following fields. +

+

+ +

Examples

+
//Find x in R^6 such that it minimizes:
+//f(x)= sin(x1) + sin(x2) + sin(x3) + sin(x4) + sin(x5) + sin(x6)
+//-2 <= x1,x2,x3,x4,x5,x6 <= 2
+//Objective function to be minimised
+function y=f(x)
+y=0
+for i =1:6
+y=y+sin(x(i));
+end
+endfunction
+//Variable bounds
+x1 = [-2, -2, -2, -2, -2, -2];
+x2 = [2, 2, 2, 2, 2, 2];
+//Options
+options=list("MaxIter",[1500],"CpuTime", [100],"TolX",[1e-6])
+//Calling Ipopt
+[x,fval] =fminbnd(f, x1, x2, options)
+ +

Examples

+
//Find x in R such that it minimizes:
+//f(x)= 1/x^2
+//0 <= x <= 1000
+//Objective function to be minimised
+function y=f(x)
+y=1/x^2
+endfunction
+//Variable bounds
+x1 = [0];
+x2 = [1000];
+//Calling Ipopt
+[x,fval,exitflag,output,lambda] =fminbnd(f, x1, x2)
+ +

Examples

+
//The below problem is an unbounded problem:
+//Find x in R^2 such that it minimizes:
+//f(x)= -[(x1-1)^2 + (x2-1)^2]
+//-inf <= x1,x2 <= inf
+//Objective function to be minimised
+function y=f(x)
+y=-((x(1)-1)^2+(x(2)-1)^2);
+endfunction
+//Variable bounds
+x1 = [-%inf , -%inf];
+x2 = [];
+//Options
+options=list("MaxIter",[1500],"CpuTime", [100],"TolX",[1e-6])
+//Calling Ipopt
+[x,fval,exitflag,output,lambda] =fminbnd(f, x1, x2, options)
+ +

Authors

+
+
+ +
+ + + + + + +
Report an issue
+ << fgoalattain + + + Symphony Toolbox + + + fmincon >> + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/fmincon.html b/help/en_US/scilab_en_US_help/fmincon.html new file mode 100644 index 0000000..242c58b --- /dev/null +++ b/help/en_US/scilab_en_US_help/fmincon.html @@ -0,0 +1,302 @@ + + + fmincon + + + +
+ + + + +
+ << fminbnd + + + Symphony Toolbox + + + fminunc >> + +
+
+
+ + + + Symphony Toolbox >> Symphony Toolbox > fmincon + +

+

fmincon

+

Solves a multi-variable constrainted optimization problem

+ + +

Calling Sequence

+
xopt = fmincon(f,x0,A,b)
+xopt = fmincon(f,x0,A,b,Aeq,beq)
+xopt = fmincon(f,x0,A,b,Aeq,beq,lb,ub)
+xopt = fmincon(f,x0,A,b,Aeq,beq,lb,ub,nlc)
+xopt = fmincon(f,x0,A,b,Aeq,beq,lb,ub,nlc,options)
+[xopt,fopt] = fmincon(.....)
+[xopt,fopt,exitflag]= fmincon(.....)
+[xopt,fopt,exitflag,output]= fmincon(.....)
+[xopt,fopt,exitflag,output,lambda]=fmincon(.....)
+[xopt,fopt,exitflag,output,lambda,gradient]=fmincon(.....)
+[xopt,fopt,exitflag,output,lambda,gradient,hessian]=fmincon(.....)
+ +

Parameters

+
f : +

a function, representing the objective function of the problem

+
x0 : +

a vector of doubles, containing the starting values of variables of size (1 X n) or (n X 1) where 'n' is the number of Variables

+
A : +

a matrix of doubles, containing the coefficients of linear inequality constraints of size (m X n) where 'm' is the number of linear inequality constraints

+
b : +

a vector of doubles, related to 'A' and containing the the Right hand side equation of the linear inequality constraints of size (m X 1)

+
Aeq : +

a matrix of doubles, containing the coefficients of linear equality constraints of size (m1 X n) where 'm1' is the number of linear equality constraints

+
beq : +

a vector of doubles, related to 'Aeq' and containing the the Right hand side equation of the linear equality constraints of size (m1 X 1)

+
lb : +

a vector of doubles, containing the lower bounds of the variables of size (1 X n) or (n X 1) where 'n' is the number of Variables

+
ub : +

a vector of doubles, containing the upper bounds of the variables of size (1 X n) or (n X 1) where 'n' is the number of Variables

+
nlc : +

a function, representing the Non-linear Constraints functions(both Equality and Inequality) of the problem. It is declared in such a way that non-linear inequality constraints are defined first as a single row vector (c), followed by non-linear equality constraints as another single row vector (ceq). Refer Example for definition of Constraint function.

+
options : +

a list, containing the option for user to specify. See below for details.

+
xopt : +

a vector of doubles, cointating the computed solution of the optimization problem

+
fopt : +

a scalar of double, containing the the function value at x

+
exitflag : +

a scalar of integer, containing the flag which denotes the reason for termination of algorithm. See below for details.

+
output : +

a structure, containing the information about the optimization. See below for details.

+
lambda : +

a structure, containing the Lagrange multipliers of lower bound, upper bound and constraints at the optimized point. See below for details.

+
gradient : +

a vector of doubles, containing the Objective's gradient of the solution.

+
hessian : +

a matrix of doubles, containing the Lagrangian's hessian of the solution.

+ +

Description

+

Search the minimum of a constrained optimization problem specified by : +Find the minimum of f(x) such that

+

+

The routine calls Ipopt for solving the Constrained Optimization problem, Ipopt is a library written in C++.

+

The options allows the user to set various parameters of the Optimization problem. +It should be defined as type "list" and contains the following fields. +

+

The exitflag allows to know the status of the optimization which is given back by Ipopt. +

+

For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/

+

The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +

+

The lambda data structure contains the Lagrange multipliers at the end +of optimization. In the current version the values are returned only when the the solution is optimal. +It has type "struct" and contains the following fields. +

+

+ +

Examples

+
//Find x in R^2 such that it minimizes:
+//f(x)= -x1 -x2/3
+//x0=[0,0]
+//constraint-1 (c1): x1 + x2 <= 2
+//constraint-2 (c2): x1 + x2/4 <= 1
+//constraint-3 (c3): x1 - x2 <= 2
+//constraint-4 (c4): -x1/4 - x2 <= 1
+//constraint-5 (c5): -x1 - x2 <= -1
+//constraint-6 (c6): -x1 + x2 <= 2
+//constraint-7 (c7): x1 + x2 = 2
+//Objective function to be minimised
+function y=f(x)
+y=-x(1)-x(2)/3;
+endfunction
+//Starting point, linear constraints and variable bounds
+x0=[0 , 0];
+A=[1,1 ; 1,1/4 ; 1,-1 ; -1/4,-1 ; -1,-1 ; -1,1];
+b=[2;1;2;1;-1;2];
+Aeq=[1,1];
+beq=[2];
+lb=[];
+ub=[];
+nlc=[];
+//Gradient of objective function
+function y=fGrad(x)
+y= [-1,-1/3];
+endfunction
+//Hessian of lagrangian
+function y=lHess(x, obj, lambda)
+y= obj*[0,0;0,0]
+endfunction
+//Options
+options=list("GradObj", fGrad, "Hessian", lHess);
+//Calling Ipopt
+[x,fval,exitflag,output,lambda,grad,hessian] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options)
+ +

Examples

+
//Find x in R^3 such that it minimizes:
+//f(x)= x1*x2 + x2*x3
+//x0=[0.1 , 0.1 , 0.1]
+//constraint-1 (c1): x1^2 - x2^2 + x3^2 <= 2
+//constraint-2 (c2): x1^2 + x2^2 + x3^2 <= 10
+//Objective function to be minimised
+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=[];
+//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
+//Gradient of objective function
+function y=fGrad(x)
+y= [x(2),x(1)+x(3),x(2)];
+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
+//Gradient of Non-Linear Constraints
+function [cg, ceqg]=cGrad(x)
+cg=[2*x(1) , -2*x(2) , 2*x(3) ; 2*x(1) , 2*x(2) , 2*x(3)];
+ceqg=[];
+endfunction
+//Options
+options=list("MaxIter", [1500], "CpuTime", [500], "GradObj", fGrad, "Hessian", lHess,"GradCon", cGrad);
+//Calling Ipopt
+[x,fval,exitflag,output] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options)
+ +

Examples

+
//The below problem is an unbounded problem:
+//Find x in R^3 such that it minimizes:
+//f(x)= -(x1^2 + x2^2 + x3^2)
+//x0=[0.1 , 0.1 , 0.1]
+//  x1 <= 0
+//  x2 <= 0
+//  x3 <= 0
+//Objective function to be minimised
+function y=f(x)
+y=-(x(1)^2+x(2)^2+x(3)^2);
+endfunction
+//Starting point, linear constraints and variable bounds
+x0=[0.1 , 0.1 , 0.1];
+A=[];
+b=[];
+Aeq=[];
+beq=[];
+lb=[];
+ub=[0,0,0];
+//Options
+options=list("MaxIter", [1500], "CpuTime", [500]);
+//Calling Ipopt
+[x,fval,exitflag,output,lambda,grad,hessian] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,[],options)
+ +

Examples

+
//The below problem is an infeasible problem:
+//Find x in R^3 such that in minimizes:
+//f(x)=x1*x2 + x2*x3
+//x0=[1,1,1]
+//constraint-1 (c1): x1^2 <= 1
+//constraint-2 (c2): x1^2 + x2^2 <= 1
+//constraint-3 (c3): x3^2 <= 1
+//constraint-4 (c4): x1^3 = 0.5
+//constraint-5 (c5): x2^2 + x3^2 = 0.75
+// 0 <= x1 <=0.6
+// 0.2 <= x2 <= inf
+// -inf <= x3 <= 1
+//Objective function to be minimised
+function y=f(x)
+y=x(1)*x(2)+x(2)*x(3);
+endfunction
+//Starting point, linear constraints and variable bounds
+x0=[1,1,1];
+A=[];
+b=[];
+Aeq=[];
+beq=[];
+lb=[0 0.2,-%inf];
+ub=[0.6 %inf,1];
+//Nonlinear constraints
+function [c, ceq]=nlc(x)
+c=[x(1)^2-1,x(1)^2+x(2)^2-1,x(3)^2-1];
+ceq=[x(1)^3-0.5,x(2)^2+x(3)^2-0.75];
+endfunction
+//Gradient of objective function
+function y=fGrad(x)
+y= [x(2),x(1)+x(3),x(2)];
+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,0,0;0,0,0] + lambda(2)*[2,0,0;0,2,0;0,0,0] +lambda(3)*[0,0,0;0,0,0;0,0,2] + lambda(4)*[6*x(1    ),0,0;0,0,0;0,0,0] + lambda(5)*[0,0,0;0,2,0;0,0,2];
+endfunction
+//Gradient of Non-Linear Constraints
+function [cg, ceqg]=cGrad(x)
+cg = [2*x(1),0,0;2*x(1),2*x(2),0;0,0,2*x(3)];
+ceqg = [3*x(1)^2,0,0;0,2*x(2),2*x(3)];
+endfunction
+//Options
+options=list("MaxIter", [1500], "CpuTime", [500], "GradObj", fGrad, "Hessian", lHess,"GradCon", cGrad);
+//Calling Ipopt
+[x,fval,exitflag,output,lambda,grad,hessian] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options)
+ +

Authors

+
+
+ +
+ + + + + + +
Report an issue
+ << fminbnd + + + Symphony Toolbox + + + fminunc >> + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/fminunc.html b/help/en_US/scilab_en_US_help/fminunc.html new file mode 100644 index 0000000..97ffdbf --- /dev/null +++ b/help/en_US/scilab_en_US_help/fminunc.html @@ -0,0 +1,178 @@ + + + fminunc + + + +
+ + + + +
+ << fmincon + + + Symphony Toolbox + + + linprog >> + +
+
+
+ + + + Symphony Toolbox >> Symphony Toolbox > fminunc + +

+

fminunc

+

Solves a multi-variable unconstrainted optimization problem

+ + +

Calling Sequence

+
xopt = fminunc(f,x0)
+xopt = fminunc(f,x0,options)
+[xopt,fopt] = fminunc(.....)
+[xopt,fopt,exitflag]= fminunc(.....)
+[xopt,fopt,exitflag,output]= fminunc(.....)
+[xopt,fopt,exitflag,output,gradient]=fminunc(.....)
+[xopt,fopt,exitflag,output,gradient,hessian]=fminunc(.....)
+ +

Parameters

+
f : +

a function, representing the objective function of the problem

+
x0 : +

a vector of doubles, containing the starting of variables.

+
options: +

a list, containing the option for user to specify. See below for details.

+
xopt : +

a vector of doubles, the computed solution of the optimization problem.

+
fopt : +

a scalar of double, the function value at x.

+
exitflag : +

a scalar of integer, containing the flag which denotes the reason for termination of algorithm. See below for details.

+
output : +

a structure, containing the information about the optimization. See below for details.

+
gradient : +

a vector of doubles, containing the the gradient of the solution.

+
hessian : +

a matrix of doubles, containing the the hessian of the solution.

+ +

Description

+

Search the minimum of an unconstrained optimization problem specified by : +Find the minimum of f(x) such that

+

+

The routine calls Ipopt for solving the Un-constrained Optimization problem, Ipopt is a library written in C++.

+

The options allows the user to set various parameters of the Optimization problem. +It should be defined as type "list" and contains the following fields. +

+

The exitflag allows to know the status of the optimization which is given back by Ipopt. +

+

For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/

+

The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +

+

+ +

Examples

+
//Find x in R^2 such that it minimizes the Rosenbrock function
+//f = 100*(x2 - x1^2)^2 + (1-x1)^2
+//Objective function to be minimised
+function y=f(x)
+y= 100*(x(2) - x(1)^2)^2 + (1-x(1))^2;
+endfunction
+//Starting point
+x0=[-1,2];
+//Gradient of objective function
+function y=fGrad(x)
+y= [-400*x(1)*x(2) + 400*x(1)^3 + 2*x(1)-2, 200*(x(2)-x(1)^2)];
+endfunction
+//Hessian of Objective Function
+function y=fHess(x)
+y= [1200*x(1)^2- 400*x(2) + 2, -400*x(1);-400*x(1), 200 ];
+endfunction
+//Options
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", fGrad, "Hessian", fHess);
+//Calling Ipopt
+[xopt,fopt,exitflag,output,gradient,hessian]=fminunc(f,x0,options)
+ +

Examples

+
//Find x in R^2 such that the below function is minimum
+//f = x1^2 + x2^2
+//Objective function to be minimised
+function y=f(x)
+y= x(1)^2 + x(2)^2;
+endfunction
+//Starting point
+x0=[2,1];
+//Calling Ipopt
+[xopt,fopt]=fminunc(f,x0)
+ +

Examples

+
//The below problem is an unbounded problem:
+//Find x in R^2 such that the below function is minimum
+//f = - x1^2 - x2^2
+//Objective function to be minimised
+function y=f(x)
+y= -x(1)^2 - x(2)^2;
+endfunction
+//Starting point
+x0=[2,1];
+//Gradient of objective function
+function y=fGrad(x)
+y= [-2*x(1),-2*x(2)];
+endfunction
+//Hessian of Objective Function
+function y=fHess(x)
+y= [-2,0;0,-2];
+endfunction
+//Options
+options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", fGrad, "Hessian", fHess);
+//Calling Ipopt
+[xopt,fopt,exitflag,output,gradient,hessian]=fminunc(f,x0,options)
+ +

Authors

+
+
+ +
+ + + + + + +
Report an issue
+ << fmincon + + + Symphony Toolbox + + + linprog >> + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/index.html b/help/en_US/scilab_en_US_help/index.html index 03ce98c..fc07de0 100644 --- a/help/en_US/scilab_en_US_help/index.html +++ b/help/en_US/scilab_en_US_help/index.html @@ -32,7 +32,37 @@