From eb9ca1191c94059cd7adcf69805906c809fe9712 Mon Sep 17 00:00:00 2001 From: Harpreet Date: Tue, 29 Dec 2015 00:38:48 +0530 Subject: Bugs fixed 4 --- help/en_US/lsqlin.xml | 24 +- help/en_US/lsqnonneg.xml | 18 +- help/en_US/qpipopt.xml | 42 +-- help/en_US/qpipoptmat.xml | 16 +- help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS | Bin 7491 -> 7534 bytes .../scilab_en_US_help/JavaHelpSearch/DOCS.TAB | Bin 867 -> 872 bytes .../en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS | Bin 270 -> 270 bytes .../scilab_en_US_help/JavaHelpSearch/POSITIONS | Bin 36132 -> 36377 bytes help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA | 2 +- help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP | Bin 16384 -> 16384 bytes .../scilab_en_US_help/_LaTeX_lsqlin.xml_1.png | Bin 3129 -> 3046 bytes .../scilab_en_US_help/_LaTeX_lsqnonneg.xml_1.png | Bin 1508 -> 1456 bytes .../scilab_en_US_help/_LaTeX_qpipopt.xml_1.png | Bin 3527 -> 3304 bytes .../scilab_en_US_help/_LaTeX_qpipoptmat.xml_1.png | Bin 3180 -> 3148 bytes .../scilab_en_US_help/_LaTeX_symphony.xml_1.png | Bin 3468 -> 3383 bytes .../scilab_en_US_help/_LaTeX_symphonymat.xml_1.png | Bin 3187 -> 3140 bytes help/en_US/scilab_en_US_help/lsqlin.html | 20 +- help/en_US/scilab_en_US_help/lsqnonneg.html | 18 +- help/en_US/scilab_en_US_help/qpipopt.html | 40 +-- help/en_US/scilab_en_US_help/qpipoptmat.html | 12 +- help/en_US/scilab_en_US_help/symphony.html | 46 +-- help/en_US/scilab_en_US_help/symphony.html~ | 318 --------------------- help/en_US/scilab_en_US_help/symphonymat.html | 38 +-- help/en_US/symphony.xml | 48 ++-- help/en_US/symphonymat.xml | 42 +-- 25 files changed, 183 insertions(+), 501 deletions(-) delete mode 100644 help/en_US/scilab_en_US_help/symphony.html~ (limited to 'help') diff --git a/help/en_US/lsqlin.xml b/help/en_US/lsqlin.xml index 73416a9..c08905e 100644 --- a/help/en_US/lsqlin.xml +++ b/help/en_US/lsqlin.xml @@ -38,9 +38,9 @@
a matrix of double, represents the multiplier of the solution x in the expression C*x - d. C is M-by-N, where M is the number of equations, and N is the number of elements of x.
a matrix of double, represents the multiplier of the solution x in the expression C*x - d. Number of columns in C is equal to the number of elements in x.
a vector of double, represents the additive constant term in the expression C*x - d. d is M-by-1, where M is the number of equations.
a vector of double, represents the additive constant term in the expression C*x - d. Number of elements in d is equal to the number of rows in C matrix.
a vector of double, represents the linear coefficients in the inequality constraints
a matrix of double, represents the linear coefficients in the equality constraints
a vector of double, represents the linear coefficients in the equality constraints
a vector of double, contains lower bounds of the variables.
a vector of double, contains upper bounds of the variables.
a vector of double, contains initial guess of variables.
a vector of double, solution residuals returned as the vector C*x-d.
Integer identifying the reason the algorithm terminated.
Integer identifying the reason the algorithm terminated. It could be 0, 1 or 2 etc. i.e. Optimal, Maximum Number of Iterations Exceeded, CPU time exceeded. Other flags one can see in the lsqlin macro.
Structure containing information about the optimization. Right now it contains number of iteration.
Structure containing information about the optimization. This version only contains number of iterations.
Structure containing the Lagrange multipliers at the solution x (separated by constraint type).It contains lower, upper and linear equality, inequality constraints.
Structure containing the Lagrange multipliers at the solution x (separated by constraint type).It contains lower, upper bound multiplier and linear equality, inequality constraints.
Search the minimum of a constrained linear least square problem specified by :
-We are calling IPOpt for solving the linear least square problem, IPOpt is a library written in C++.
+The routine calls Ipopt for solving the linear least square problem, Ipopt is a library written in C++.
//A basic example for equality, inequality and bounds + | ![]() | ![]() |
a matrix of double, represents the linear coefficients in the equality constraints
a vector of double, represents the linear coefficients in the equality constraints
a vector of double, contains lower bounds of the variables.
a vector of double, contains upper bounds of the variables.
a vector of double, contains initial guess of variables.
a double, the function value at x.
Integer identifying the reason the algorithm terminated.
Integer identifying the reason the algorithm terminated.It could be 0, 1 or 2 etc. i.e. Optimal, Maximum Number of Iterations Exceeded, CPU time exceeded. Other flags one can see in the qpipoptmat macro.
Structure containing information about the optimization. Right now it contains number of iteration.
Structure containing information about the optimization. This version only contains number of iterations.
Structure containing the Lagrange multipliers at the solution x (separated by constraint type).It contains lower, upper and linear equality, inequality constraints.
Search the minimum of a constrained linear quadratic optimization problem specified by : find the minimum of f(x) such that
-We are calling IPOpt for solving the quadratic problem, IPOpt is a library written in C++.
+The routine calls Ipopt for solving the quadratic problem, Ipopt is a library written in C++.
xopt = symphony(nbVar,nbCon,objCoef,isInt,LB,UB,conMatrix,conLB,conUB) -xopt = symphony(nbVar,nbCon,objCoef,isInt,LB,UB,conMatrix,conLB,conUB,objSense) -xopt = symphony(nbVar,nbCon,objCoef,isInt,LB,UB,conMatrix,conLB,conUB,objSense,options) +xopt = symphony(nbVar,nbCon,c,isInt,lb,ub,A,conLB,conUB) +xopt = symphony(nbVar,nbCon,c,isInt,lb,ub,A,conLB,conUB,objSense) +xopt = symphony(nbVar,nbCon,c,isInt,lb,ub,A,conLB,conUB,objSense,options) [xopt,fopt,status,output] = symphony( ... )
a double, number of variables.
a double, number of constraints.
a vector of double, represents coefficients of the variables in the objective.
a vector of boolean, represents wether a variable is constrained to be an integer.
a vector of double, represents lower bounds of the variables.
a vector of double, represents upper bounds of the variables.
a matrix of double, represents matrix representing the constraint matrix.
a vector of double, represents lower bounds of the constraints.
The sense (maximization/minimization) of the objective. Use 1(sym_minimize ) or -1 (sym_maximize) here.
a a list containing the the parameters to be set.
a list containing the the parameters to be set.
a vector of double, the computed solution of the optimization problem.
a double, the function value at x.
status flag from symphony.
status flag from symphony. 227 is optimal, 228 is Time limit exceeded, 230 is iteration limit exceeded.
The output data structure contains detailed informations about the optimization process. Right now it contains number of iteration.
The output data structure contains detailed information about the optimization process. This version only contains number of iterations
Search the minimum or maximum of a constrained mixed integer linear programming optimization problem specified by : find the minimum or maximum of f(x) such that
-We are calling SYMPHONY written in C by gateway files for the actual computation.
+The routine calls SYMPHONY written in C by gateway files for the actual computation.
//A basic case : // Objective function -objCoef = [350*5,330*3,310*4,280*6,500,450,400,100]'; +c = [350*5,330*3,310*4,280*6,500,450,400,100]'; // Lower Bound of variable lb = repmat(0,8,1); // Upper Bound of variables ub = [repmat(1,4,1);repmat(%inf,4,1)]; // Constraint Matrix -conMatrix = [5,3,4,6,1,1,1,1; +A = [5,3,4,6,1,1,1,1; 5*0.05,3*0.04,4*0.05,6*0.03,0.08,0.07,0.06,0.03; 5*0.03,3*0.03,4*0.04,6*0.04,0.06,0.07,0.08,0.09;] -// Lower Bound of constrains +// Lower Bound of constraints conlb = [ 25; 1.25; 1.25] -// Upper Bound of constrains +// Upper Bound of constraints conub = [ 25; 1.25; 1.25] // Row Matrix for telling symphony that the is integer or not isInt = [repmat(%t,1,4) repmat(%f,1,4)]; xopt = [1 1 0 1 7.25 0 0.25 3.5] fopt = [8495] // Calling Symphony -[x,f,status,output] = symphony(8,3,c,isInt,lb,ub,conMatrix,conlb,conub,1) +[x,f,status,output] = symphony(8,3,c,isInt,lb,ub,A,conlb,conub,1) // Press ENTER to continue | ![]() | ![]() |
Solves a nonlinearily constrained optimization problem.
x = fmincon(fun,x0) -x = fmincon(fun,x0,A,b) -x = fmincon(fun,x0,A,b,Aeq,beq) -x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub) -x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon) -x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options) -[x,fval,exitflag,output,lambda,grad,hessian] = fmincon ( ... )
a function, the function to minimize. See below for the complete specifications.
a nx1 or 1xn matrix of doubles, where n is the number of variables. The initial guess for the optimization algorithm.
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<>[]), fmincon generates an error (the same happens if (A<>[] & b==[])).
a nil x 1 matrix of doubles, where nil is the number of linear inequalities.
a nel x n matrix of doubles, where n is the number of variables and nel is the number of linear equalities. If A==[] and b==[], it is assumed that there is no linear equality constraints. If (Aeq==[] & beq<>[]), fmincon generates an error (the same happens if (Aeq<>[] & beq==[])).
a nel x 1 matrix of doubles, where nel is the number of linear inequalities.
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.
a nx1 or 1xn matrix of doubles, where n is the number of variables. The upper bound for x. If lb==[], then the upper bound is automatically set to +inf.
a function, the nonlinear constraints. See below for the complete specifications.
a nx1 matrix of doubles, the computed solution of the optimization problem
a 1x1 matrix of doubles, the function value at x
a 1x1 matrix of floating point integers, the exit status. See below for details.
a struct, the details of the optimization process. See below for details.
a struct, the Lagrange multipliers at optimum. See below for details.
a nx1 matrix of doubles, the gradient of the objective function at optimum
a nxn matrix of doubles, the Hessian of the objective function at optimum
an optional struct, as provided by optimset
Search the minimum of a constrained optimization problem specified by : -find the minimum of f(x) such that
-c(x)<=0, ceq(x)<=0, A*x<=b, Aeq*x=beq and lb<=x<=ub.
-Currently, we use ipopt for the actual solver of fmincon.
-See the demonstrations for additionnal examples.
-The objective function must have header : -
-where x is a n x 1 matrix of doubles and f is a 1 x 1 matrix of doubles. -On input, the variable x contains the current point and, on output, -the variable f must contain the objective function value. -By default, fmincon uses finite differences with order 2 formulas and -optimum step size in order to compute a numerical gradient of the -objective function. -If we can provide exact gradients, we should do so since it improves -the convergence speed of the optimization algorithm. -In order to use exact gradients, we must update the header of the -objective function to : -
-where x is a n x 1 matrix of doubles, f is a 1 x 1 matrix of doubles -and G is a n x 1 matrix of doubles. -On input, the variable x contains the current point and, on output, -the variable f must contain the objective function value and the variable -G must contain the gradient of the objective function. -Furthermore, we must enable the "GradObj" option with the statement : -options = optimset("GradObj","on"); | ![]() | ![]() |
The constraint function must have header : -
-where x is a n x 1 matrix of doubles, c is a nni x 1 matrix of doubles and -ceq is a nne x 1 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, fmincon uses finite differences with order 2 formulas and -optimum step size in order to compute a numerical gradient of the -constraint function. -In order to use exact gradients, we must update the header of the -constraint function to : -
-where x is a n x 1 matrix of doubles, c is a nni x 1 matrix of doubles, -ceq is a nne x 1 matrix of doubles, DC is a n x nni matrix of doubles and -DCeq is a n x nne matrix of doubles. -On input, the variable x contains the current point and, on output, -the variable c must contain the nonlinear inequality constraint function value, -the variable ceq must contain the nonlinear equality constraint function value, -the variable DC must contain the Jacobian matrix of the nonlinear inequality constraints -and the variable DCeq must contain the Jacobian matrix of the nonlinear equality constraints. -The i-th nonlinear inequality constraint is associated to the i-th column of -the matrix DC, i.e, it is stored in DC(:,i) (same for DCeq). -Furthermore, we must enable the "GradObj" option with the statement : -options = optimset("GradConstr","on"); | ![]() | ![]() |
By default, fmincon uses a L-BFGS formula to compute an -approximation of the Hessian of the Lagrangian. -Notice that this is different from Matlab's fmincon, which -default is to use a BFGS.
-The exitflag variable allows to know the status of the optimization. -
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. -It has type "struct" and contains the following -fields. -
TODO : exitflag=2 : Change in x was less than options.TolX and maximum constraint violation was less than options.TolCon. -TODO : exitflag=-3 : Current point x went below options.ObjectiveLimit and maximum constraint violation was less than options.TolCon. -TODO : fill lambda.lower and lambda.upper consistently. See ticket #111 : http://forge.scilab.org/index.php/p/sci-ipopt/issues/111/ -TODO : test with A, b -TODO : test with Aeq, beq -TODO : test with ceq -TODO : avoid using global for ipopt_data -TODO : implement Display option -TODO : implement FinDiffType option -TODO : implement MaxFunEvals option -TODO : implement DerivativeCheck option -TODO : implement MaxIter option -TODO : implement OutputFcn option -TODO : implement PlotFcns option -TODO : implement TolFun option -TODO : implement TolCon option -TODO : implement TolX option -TODO : implement Hessian option -TODO : check that the hessian output argument is Hessian of f only -TODO : test all exitflag values
-// A basic case : -// we provide only the objective function and the nonlinear constraint -// function : we let fmincon compute the gradients by numerical -// derivatives. -function f=objfun(x) -f = exp(x(1))*(4*x(1)^2 + 2*x(2)^2 + 4*x(1)*x(2) + 2*x(2) + 1) -endfunction -function [c, ceq]=confun(x) -// Nonlinear inequality constraints -c = [ -1.5 + x(1)*x(2) - x(1) - x(2) --x(1)*x(2) - 10 -] -// Nonlinear equality constraints -ceq = [] -endfunction -// The initial guess -x0 = [-1,1]; -// The expected solution : only 4 digits are guaranteed -xopt = [-9.547345885974547 1.047408305349257] -fopt = 0.023551460139148 -// Run fmincon -[x,fval,exitflag,output,lambda,grad,hessian] = .. -fmincon ( objfun,x0,[],[],[],[],[],[], confun ) | ![]() | ![]() |
// A case where we provide the gradient of the objective -// function and the Jacobian matrix of the constraints. -// The objective function and its gradient -function [f, G]=objfungrad(x) -[lhs,rhs]=argn() -f = exp(x(1))*(4*x(1)^2+2*x(2)^2+4*x(1)*x(2)+2*x(2)+1) -if ( lhs > 1 ) then -G = [ -f + exp(x(1)) * (8*x(1) + 4*x(2)) -exp(x(1))*(4*x(1)+4*x(2)+2) -] -end -endfunction -// The nonlinear constraints and the Jacobian -// matrix of the constraints -function [c, ceq, DC, DCeq]=confungrad(x) -// Inequality constraints -c(1) = 1.5 + x(1) * x(2) - x(1) - x(2) -c(2) = -x(1) * x(2)-10 -// No nonlinear equality constraints -ceq=[] -[lhs,rhs]=argn() -if ( lhs > 2 ) then -// DC(:,i) = gradient of the i-th constraint -// DC = [ -// Dc1/Dx1 Dc2/Dx1 -// Dc1/Dx2 Dc2/Dx2 -// ] -DC= [ -x(2)-1, -x(2) -x(1)-1, -x(1) -] -DCeq = [] -end -endfunction -// Test with both gradient of objective and gradient of constraints -options = optimset("GradObj","on","GradConstr","on"); -// The initial guess -x0 = [-1,1]; -// The expected solution : only 4 digits are guaranteed -xopt = [-9.547345885974547 1.047408305349257] -fopt = 0.023551460139148 -// Run fmincon -[x,fval,exitflag,output] = .. -fmincon(objfungrad,x0,[],[],[],[],[],[], confungrad,options) | ![]() | ![]() |
// A case where we set the bounds of the optimization. -// By default, the bounds are set to infinity. -function f=objfun(x) -f = exp(x(1))*(4*x(1)^2 + 2*x(2)^2 + 4*x(1)*x(2) + 2*x(2) + 1) -endfunction -function [c, ceq]=confun(x) -// Nonlinear inequality constraints -c = [ -1.5 + x(1)*x(2) - x(1) - x(2) --x(1)*x(2) - 10 -] -// Nonlinear equality constraints -ceq = [] -endfunction -// The initial guess -x0 = [-1,1]; -// The expected solution -xopt = [0 1.5] -fopt = 8.5 -// Make sure that x(1)>=0, and x(2)>=0 -lb = [0,0]; -ub = [ ]; -// Run fmincon -[x,fval] = fmincon ( objfun , x0,[],[],[],[],lb,ub,confun) | ![]() | ![]() |
xopt = symphonymat(C,intcon,A,b) -xopt = symphonymat(C,intcon,A,b,Aeq,beq) -xopt = symphonymat(C,intcon,A,b,Aeq,beq,lb,ub) -xopt = symphonymat(C,intcon,A,b,Aeq,beq,lb,ub,options) +xopt = symphonymat(c,intcon,A,b) +xopt = symphonymat(c,intcon,A,b,Aeq,beq) +xopt = symphonymat(c,intcon,A,b,Aeq,beq,lb,ub) +xopt = symphonymat(c,intcon,A,b,Aeq,beq,lb,ub,options) [xopt,fopt,status,output] = symphonymat( ... )
a vector of double, contains coefficients of the variables in the objective
Vector of integer constraints, specified as a vector of positive integers. The values in intcon indicate the components of the decision variable x that are integer-valued. intcon has values from 1 through number of variable.
Linear inequality constraint matrix, specified as a matrix of double. A represents the linear coefficients in the constraints A*x ≤ b. A has size M-by-N, where M is the number of constraints and N is number of variables
Linear inequality constraint matrix, specified as a matrix of double. A represents the linear coefficients in the constraints A*x ≤ b. A has the size where columns equals to the number of variables.
Linear inequality constraint vector, specified as a vector of double. b represents the constant vector in the constraints A*x ≤ b. b has length M, where A is M-by-N
Linear inequality constraint vector, specified as a vector of double. b represents the constant vector in the constraints A*x ≤ b. b has size equals to the number of rows in A.
Linear equality constraint matrix, specified as a matrix of double. Aeq represents the linear coefficients in the constraints Aeq*x = beq. Aeq has size Meq-by-N, where Meq is the number of constraints and N is number of variables
Linear equality constraint matrix, specified as a matrix of double. Aeq represents the linear coefficients in the constraints Aeq*x = beq. Aeq has the size where columns equals to the number of variables.
Linear equality constraint vector, specified as a vector of double. beq represents the constant vector in the constraints Aeq*x = beq. beq has length Meq, where Aeq is Meq-by-N.
Linear equality constraint vector, specified as a vector of double. beq represents the constant vector in the constraints Aeq*x = beq. beq has size equals to the number of rows in Aeq.
Lower bounds, specified as a vector or array of double. lb represents the lower bounds elementwise in lb ≤ x ≤ ub.
a list containing the the parameters to be set.
a vector of double, the computed solution of the optimization problem
a vector of double, the computed solution of the optimization problem.
a double, the function value at x
status flag from symphony.
status flag from symphony. 227 is optimal, 228 is Time limit exceeded, 230 is iteration limit exceeded.
The output data structure contains detailed informations about the optimization process. Right now it contains number of iteration.
The output data structure contains detailed information about the optimization process. This version only contains number of iterations.
Search the minimum or maximum of a constrained mixed integer linear programming optimization problem specified by : -find the minimum or maximum of f(x) such that
-We are calling SYMPHONY written in C by gateway files for the actual computation.
+find the minimum or maximum of C'⋅x such that +The routine calls SYMPHONY written in C by gateway files for the actual computation.
// Objective function -C = [350*5,330*3,310*4,280*6,500,450,400,100]'; +c = [350*5,330*3,310*4,280*6,500,450,400,100]'; // Lower Bound of variable lb = repmat(0,1,8); // Upper Bound of variables @@ -106,7 +106,7 @@ find the minimum or maximum of f(x) such that // st sum{j=1,...,n} r(i,j)x(j) <= b(i) i=1,...,m // x(j)=0 or 1 // The function to be maximize i.e. P(j) -C = -1*[ 504 803 667 1103 834 585 811 856 690 832 846 813 868 793 .. +c = -1*[ 504 803 667 1103 834 585 811 856 690 832 846 813 868 793 .. 825 1002 860 615 540 797 616 660 707 866 647 746 1006 608 .. 877 900 573 788 484 853 942 630 591 630 640 1169 932 1034 .. 957 798 669 625 467 1051 552 717 654 388 559 555 1104 783 .. @@ -155,7 +155,7 @@ find the minimum or maximum of f(x) such that 483 336 765 637 981 980 202 35 594 689 602 76 767 693 .. 893 160 785 311 417 748 375 362 617 553 474 915 457 261 350 635 ; ]; -nbVar = size(objCoef,1) +nbVar = size(c,1) b=[11927 13727 11551 13056 13460 ]; // Lower Bound of variables lb = repmat(0,1,nbVar) @@ -175,7 +175,7 @@ find the minimum or maximum of f(x) such that // Optimal value fopt = [ 24381 ] // Calling Symphony -[x,f,status,output] = symphonymat(C,intcon,A,b,[],[],lb,ub,options); | ![]() | ![]() |