diff options
Diffstat (limited to 'macros')
-rw-r--r-- | macros/buildmacros.sce | 6 | ||||
-rw-r--r-- | macros/lsqlin.bin | bin | 53548 -> 50916 bytes | |||
-rw-r--r-- | macros/lsqlin.sci | 84 | ||||
-rw-r--r-- | macros/lsqnonneg.bin | bin | 23840 -> 24024 bytes | |||
-rw-r--r-- | macros/lsqnonneg.sci | 32 | ||||
-rw-r--r-- | macros/qpipopt.bin | bin | 50496 -> 50352 bytes | |||
-rw-r--r-- | macros/qpipopt.sci | 185 | ||||
-rw-r--r-- | macros/qpipoptmat.bin | bin | 52464 -> 52688 bytes | |||
-rw-r--r-- | macros/qpipoptmat.sci | 38 | ||||
-rw-r--r-- | macros/setOptions.sci | 6 | ||||
-rw-r--r-- | macros/symphony.bin | bin | 54340 -> 56296 bytes | |||
-rw-r--r-- | macros/symphony.sci | 30 | ||||
-rw-r--r-- | macros/symphony_call.sci | 6 | ||||
-rw-r--r-- | macros/symphonymat.bin | bin | 60108 -> 60688 bytes | |||
-rw-r--r-- | macros/symphonymat.sci | 295 |
15 files changed, 345 insertions, 337 deletions
diff --git a/macros/buildmacros.sce b/macros/buildmacros.sce index 656ff4a..fe6a619 100644 --- a/macros/buildmacros.sce +++ b/macros/buildmacros.sce @@ -1,13 +1,13 @@ // Copyright (C) 2015 - IIT Bombay - FOSSEE // -// Author: Harpreet Singh -// Organization: FOSSEE, IIT Bombay -// Email: harpreet.mertia@gmail.com // This file must be used under the terms of the CeCILL. // This source file is licensed as described in the file COPYING, which // you should have received as part of this distribution. The terms // are also available at // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Harpreet Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in tbx_build_macros("Symphony", get_absolute_file_path("buildmacros.sce")); diff --git a/macros/lsqlin.bin b/macros/lsqlin.bin Binary files differindex 8c30789..1359535 100644 --- a/macros/lsqlin.bin +++ b/macros/lsqlin.bin diff --git a/macros/lsqlin.sci b/macros/lsqlin.sci index fba036d..9460424 100644 --- a/macros/lsqlin.sci +++ b/macros/lsqlin.sci @@ -1,13 +1,13 @@ // Copyright (C) 2015 - IIT Bombay - FOSSEE // -// Author: Harpreet Singh -// Organization: FOSSEE, IIT Bombay -// Email: harpreet.mertia@gmail.com // This file must be used under the terms of the CeCILL. // This source file is licensed as described in the file COPYING, which // you should have received as part of this distribution. The terms // are also available at // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Harpreet Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in function [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin (varargin) @@ -34,10 +34,10 @@ function [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin (varargin) // param : a list containing the the parameters to be set. // xopt : a vector of double, the computed solution of the optimization problem. // resnorm : a double, objective value returned as the scalar value norm(C*x-d)^2. - // residual : a vector of double, solution residuals returned as the vector C*x-d. - // exitflag : 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. + // residual : a vector of double, solution residuals returned as the vector d-C*x. + // exitflag : A flag showing returned exit flag from Ipopt. 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. // output : Structure containing information about the optimization. This version only contains number of iterations. - // lambda : Structure containing the Lagrange multipliers at the solution x (separated by constraint type).It contains lower, upper bound multiplier and linear equality, inequality constraints. + // lambda : Structure containing the Lagrange multipliers at the solution x (separated by constraint type).It contains lower, upper bound multiplier and linear equality, inequality constraint multiplier. // // Description // Search the minimum of a constrained linear least square problem specified by : @@ -56,48 +56,42 @@ function [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin (varargin) // // Examples // //A simple linear least square example - // C = [0.9501 0.7620 0.6153 0.4057 - // 0.2311 0.4564 0.7919 0.9354 - // 0.6068 0.0185 0.9218 0.9169 - // 0.4859 0.8214 0.7382 0.4102 - // 0.8912 0.4447 0.1762 0.8936]; - // d = [0.0578 - // 0.3528 - // 0.8131 - // 0.0098 - // 0.1388]; - // A = [0.2027 0.2721 0.7467 0.4659 - // 0.1987 0.1988 0.4450 0.4186 - // 0.6037 0.0152 0.9318 0.8462]; - // b = [0.5251 - // 0.2026 - // 0.6721]; + // C = [ 2 0; + // -1 1; + // 0 2] + // d = [1 + // 0 + // -1]; + // A = [10 -2; + // -2 10]; + // b = [4 + // -4]; // [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b) // // Press ENTER to continue // // Examples // //A basic example for equality, inequality constraints and variable bounds - // C = [0.9501 0.7620 0.6153 0.4057 - // 0.2311 0.4564 0.7919 0.9354 - // 0.6068 0.0185 0.9218 0.9169 - // 0.4859 0.8214 0.7382 0.4102 - // 0.8912 0.4447 0.1762 0.8936]; - // d = [0.0578 - // 0.3528 - // 0.8131 - // 0.0098 - // 0.1388]; - // A =[0.2027 0.2721 0.7467 0.4659 - // 0.1987 0.1988 0.4450 0.4186 - // 0.6037 0.0152 0.9318 0.8462]; - // b =[0.5251 - // 0.2026 - // 0.6721]; - // Aeq = [3 5 7 9]; - // beq = 4; - // lb = -0.1*ones(4,1); - // ub = 2*ones(4,1); - // [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,Aeq,beq,lb,ub) + // C = [1 1 1; + // 1 1 0; + // 0 1 1; + // 1 0 0; + // 0 0 1] + // d = [89; + // 67; + // 53; + // 35; + // 20;] + // A = [3 2 1; + // 2 3 4; + // 1 2 3]; + // b = [191 + // 209 + // 162]; + // Aeq = [1 2 1]; + // beq = 10; + // lb = repmat(0.1,3,1); + // ub = repmat(4,3,1); + // [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,Aeq,beq,lb,ub) // Authors // Harpreet Singh @@ -238,7 +232,7 @@ function [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin (varargin) //Check the size of equality constraint which should be equal to the number of variables if ( size(Aeq,2) ~= nbVar & size(Aeq,2) ~= 0 ) then - errmsg = msprintf(gettext("%s: The number of columns in Aeq must be the same as the number of elements of d"), "lsqlin"); + errmsg = msprintf(gettext("%s: The number of columns in Aeq must be the same as the number of columns in C"), "lsqlin"); error(errmsg); end @@ -333,7 +327,7 @@ function [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin (varargin) [xopt,fopt,status,iter,Zl,Zu,lmbda] = solveqp(nbVar,nbCon,H,f,conMatrix,conLB,conUB,lb,ub,x0,options); xopt = xopt'; - residual = -1*(C*xopt-d); + residual = d-C*xopt; resnorm = residual'*residual; exitflag = status; output = struct("Iterations" , []); diff --git a/macros/lsqnonneg.bin b/macros/lsqnonneg.bin Binary files differindex 182cfa9..b480250 100644 --- a/macros/lsqnonneg.bin +++ b/macros/lsqnonneg.bin diff --git a/macros/lsqnonneg.sci b/macros/lsqnonneg.sci index 5f6ffa2..80ec92a 100644 --- a/macros/lsqnonneg.sci +++ b/macros/lsqnonneg.sci @@ -1,13 +1,13 @@ // Copyright (C) 2015 - IIT Bombay - FOSSEE // -// Author: Harpreet Singh -// Organization: FOSSEE, IIT Bombay -// Email: harpreet.mertia@gmail.com // This file must be used under the terms of the CeCILL. // This source file is licensed as described in the file COPYING, which // you should have received as part of this distribution. The terms // are also available at // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Harpreet Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in function [xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg (varargin) @@ -23,10 +23,10 @@ function [xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg (varargin) // d : 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. // xopt : a vector of double, the computed solution of the optimization problem. // resnorm : a double, objective value returned as the scalar value norm(C*x-d)^2. - // residual : a vector of double, solution residuals returned as the vector C*x-d. - // exitflag : Integer identifying the reason the algorithm terminated. It could be 0, 1 or 2 i.e. Optimal, Maximum Number of Iterations Exceeded, CPU time exceeded. + // residual : a vector of double, solution residuals returned as the vector d-C*x. + // exitflag : A flag showing returned exit flag from Ipopt. 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. // output : Structure containing information about the optimization. This version only contains number of iterations. - // lambda : Structure containing the Lagrange multipliers at the solution x. It contains lower and upper bound multiplier. + // lambda : Structure containing the Lagrange multipliers at the solution xopt. It contains lower, upper bound multiplier and linear equality, inequality constraint multiplier. // // Description // Solves nonnegative least-squares curve fitting problems specified by : @@ -43,16 +43,16 @@ function [xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg (varargin) // // Examples // // A basic lsqnonneg problem - // C = [ - // 0.0372 0.2869 - // 0.6861 0.7071 - // 0.6233 0.6245 - // 0.6344 0.6170]; - // d = [ - // 0.8587 - // 0.1781 - // 0.0747 - // 0.8405]; + // C = [1 1 1; + // 1 1 0; + // 0 1 1; + // 1 0 0; + // 0 0 1] + // d = [89; + // 67; + // 53; + // 35; + // 20;] // [xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d) // Authors // Harpreet Singh diff --git a/macros/qpipopt.bin b/macros/qpipopt.bin Binary files differindex 4a407c4..19a7040 100644 --- a/macros/qpipopt.bin +++ b/macros/qpipopt.bin diff --git a/macros/qpipopt.sci b/macros/qpipopt.sci index ed531e1..e8c945a 100644 --- a/macros/qpipopt.sci +++ b/macros/qpipopt.sci @@ -1,108 +1,109 @@ // Copyright (C) 2015 - IIT Bombay - FOSSEE // -// Author: Harpreet Singh -// Organization: FOSSEE, IIT Bombay -// Email: harpreet.mertia@gmail.com // This file must be used under the terms of the CeCILL. // This source file is licensed as described in the file COPYING, which // you should have received as part of this distribution. The terms // are also available at // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Harpreet Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in function [xopt,fopt,exitflag,output,lambda] = qpipopt (varargin) - // Solves a linear quadratic problem. - // - // Calling Sequence - // xopt = qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB) - // xopt = qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0) - // xopt = qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0,param) - // [xopt,fopt,exitflag,output,lamda] = qpipopt( ... ) - // - // Parameters - // nbVar : a double, number of variables - // nbCon : a double, number of constraints - // H : a symmetric matrix of double, represents coefficients of quadratic in the quadratic problem. - // f : a vector of double, represents coefficients of linear in the quadratic problem - // lb : a vector of double, contains lower bounds of the variables. - // ub : a vector of double, contains upper bounds of the variables. - // A : a matrix of double, contains matrix representing the constraint matrix - // conLB : a vector of double, contains lower bounds of the constraints. - // conUB : a vector of double, contains upper bounds of the constraints. - // x0 : a vector of double, contains initial guess of variables. - // param : a list containing the the parameters to be set. - // xopt : a vector of double, the computed solution of the optimization problem. - // fopt : a double, the function value at x. - // exitflag : 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 qpipopt macro. - // output : Structure containing information about the optimization. This version only contains number of iterations - // lambda : Structure containing the Lagrange multipliers at the solution x (separated by constraint type).It contains lower, upper and linear equality, inequality constraints. - // - // Description - // Search the minimum of a constrained linear quadratic optimization problem specified by : - // find the minimum of f(x) such that - // - // <latex> - // \begin{eqnarray} - // &\mbox{min}_{x} - // & 1/2⋅x^T⋅H⋅x + f^T⋅x \\ - // & \text{subject to} & conLB \leq A⋅x \leq conUB \\ - // & & lb \leq x \leq ub \\ - // \end{eqnarray} - // </latex> - // - // The routine calls Ipopt for solving the quadratic problem, Ipopt is a library written in C++. - // - // Examples - // //Find x in R^6 such that: - // A= [1,-1,1,0,3,1; - // -1,0,-3,-4,5,6; - // 2,5,3,0,1,0 - // 0,1,0,1,2,-1; - // -1,0,2,1,1,0]; - // conLB=[1;2;3;-%inf;-%inf]; - // conUB = [1;2;3;-1;2.5]; - // lb=[-1000;-10000; 0; -1000; -1000; -1000]; - // ub=[10000; 100; 1.5; 100; 100; 1000]; - // //and minimize 0.5*x'⋅H⋅x + f'⋅x with - // f=[1; 2; 3; 4; 5; 6]; H=eye(6,6); - // nbVar = 6; - // nbCon = 5; - // x0 = repmat(0,nbVar,1); - // param = list("MaxIter", 300, "CpuTime", 100); - // [xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0,param) - // // Press ENTER to continue - // - // Examples - // //Find the value of x that minimize following function - // // f(x) = 0.5*x1^2 + x2^2 - x1*x2 - 2*x1 - 6*x2 - // // Subject to: - // // x1 + x2 ≤ 2 - // // –x1 + 2x2 ≤ 2 - // // 2x1 + x2 ≤ 3 - // // 0 ≤ x1, 0 ≤ x2. - // H = [1 -1; -1 2]; - // f = [-2; -6]; - // A = [1 1; -1 2; 2 1]; - // conUB = [2; 2; 3]; - // conLB = [-%inf; -%inf; -%inf]; - // lb = [0; 0]; - // ub = [%inf; %inf]; - // nbVar = 2; - // nbCon = 3; - // [xopt,fopt,exitflag,output,lambda] = qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB) - // Authors - // Keyur Joshi, Saikiran, Iswarya, Harpreet Singh + // Solves a linear quadratic problem. + // + // Calling Sequence + // xopt = qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB) + // xopt = qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0) + // xopt = qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0,param) + // [xopt,fopt,exitflag,output,lamda] = qpipopt( ... ) + // + // Parameters + // nbVar : a double, number of variables + // nbCon : a double, number of constraints + // H : a symmetric matrix of double, represents coefficients of quadratic in the quadratic problem. + // f : a vector of double, represents coefficients of linear in the quadratic problem + // lb : a vector of double, contains lower bounds of the variables. + // ub : a vector of double, contains upper bounds of the variables. + // A : a matrix of double, contains matrix representing the constraint matrix + // conLB : a vector of double, contains lower bounds of the constraints. + // conUB : a vector of double, contains upper bounds of the constraints. + // x0 : a vector of double, contains initial guess of variables. + // param : a list containing the the parameters to be set. + // xopt : a vector of double, the computed solution of the optimization problem. + // fopt : a double, the function value at x. + // exitflag : A flag showing returned exit flag from Ipopt. 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. + // output : Structure containing information about the optimization. This version only contains number of iterations + // lambda : Structure containing the Lagrange multipliers at the solution x (separated by constraint type).It contains lower, upper bound multiplier and linear equality, inequality constraint multiplier. + // + // Description + // Search the minimum of a constrained linear quadratic optimization problem specified by : + // + // <latex> + // \begin{eqnarray} + // &\mbox{min}_{x} + // & 1/2⋅x^T⋅H⋅x + f^T⋅x \\ + // & \text{subject to} & conLB \leq A⋅x \leq conUB \\ + // & & lb \leq x \leq ub \\ + // \end{eqnarray} + // </latex> + // + // The routine calls Ipopt for solving the quadratic problem, Ipopt is a library written in C++. + // + // Examples + // //Ref : example 14 : + // //https://www.me.utexas.edu/~jensen/ORMM/supplements/methods/nlpmethod/S2_quadratic.pdf + // // min. -8*x1*x1 -16*x2*x2 + x1 + 4*x2 + // // such that + // // x1 + x2 <= 5, + // // x1 <= 3, + // // x1 >= 0, + // // x2 >= 0 + // H = [2 0 + // 0 8]; + // f = [-8; -16]; + // A = [1 1;1 0]; + // conUB = [5;3]; + // conLB = [-%inf; -%inf]; + // lb = [0; 0]; + // ub = [%inf; %inf]; + // nbVar = 2; + // nbCon = 2; + // [xopt,fopt,exitflag,output,lambda] = qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB) + // //Press ENTER to continue + // + // Examples + // //Find x in R^6 such that: + // A= [1,-1,1,0,3,1; + // -1,0,-3,-4,5,6; + // 2,5,3,0,1,0 + // 0,1,0,1,2,-1; + // -1,0,2,1,1,0]; + // conLB=[1;2;3;-%inf;-%inf]; + // conUB = [1;2;3;-1;2.5]; + // lb=[-1000;-10000; 0; -1000; -1000; -1000]; + // ub=[10000; 100; 1.5; 100; 100; 1000]; + // //and minimize 0.5*x'⋅H⋅x + f'⋅x with + // f=[1; 2; 3; 4; 5; 6]; H=eye(6,6); + // nbVar = 6; + // nbCon = 5; + // x0 = repmat(0,nbVar,1); + // param = list("MaxIter", 300, "CpuTime", 100); + // [xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0,param) + // Authors + // Keyur Joshi, Saikiran, Iswarya, Harpreet Singh -//To check the number of input and output argument - [lhs , rhs] = argn(); + //To check the number of input and output argument + [lhs , rhs] = argn(); -//To check the number of argument given by user - if ( rhs < 9 | rhs > 11 ) then - errmsg = msprintf(gettext("%s: Unexpected number of input arguments : %d provided while should be 9, 10 or 11"), "qpipopt", rhs); - error(errmsg) - end - + //To check the number of argument given by user + if ( rhs < 9 | rhs > 11 ) then + errmsg = msprintf(gettext("%s: Unexpected number of input arguments : %d provided while should be 9, 10 or 11"), "qpipopt", rhs); + error(errmsg) + end + nbVar = []; nbCon = []; H = []; diff --git a/macros/qpipoptmat.bin b/macros/qpipoptmat.bin Binary files differindex 35142ae..817f0f9 100644 --- a/macros/qpipoptmat.bin +++ b/macros/qpipoptmat.bin diff --git a/macros/qpipoptmat.sci b/macros/qpipoptmat.sci index 8e9c67e..d019aa1 100644 --- a/macros/qpipoptmat.sci +++ b/macros/qpipoptmat.sci @@ -1,13 +1,13 @@ // Copyright (C) 2015 - IIT Bombay - FOSSEE // -// Author: Harpreet Singh -// Organization: FOSSEE, IIT Bombay -// Email: harpreet.mertia@gmail.com // This file must be used under the terms of the CeCILL. // This source file is licensed as described in the file COPYING, which // you should have received as part of this distribution. The terms // are also available at // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Harpreet Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in function [xopt,fopt,exitflag,output,lambda] = qpipoptmat (varargin) @@ -35,13 +35,13 @@ function [xopt,fopt,exitflag,output,lambda] = qpipoptmat (varargin) // param : a list containing the the parameters to be set. // xopt : a vector of double, the computed solution of the optimization problem. // fopt : a double, the function value at x. - // exitflag : 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. + // residual : a vector of double, solution residuals returned as the vector d-C*x. + // exitflag : A flag showing returned exit flag from Ipopt. 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. // output : Structure containing information about the optimization. This version only contains number of iterations. - // lambda : Structure containing the Lagrange multipliers at the solution x (separated by constraint type).It contains lower, upper and linear equality, inequality constraints. + // lambda : Structure containing the Lagrange multipliers at the solution x (separated by constraint type).It contains lower, upper bound multiplier and linear equality, inequality constraint multiplier. // // Description // Search the minimum of a constrained linear quadratic optimization problem specified by : - // find the minimum of f(x) such that // // <latex> // \begin{eqnarray} @@ -56,17 +56,19 @@ function [xopt,fopt,exitflag,output,lambda] = qpipoptmat (varargin) // The routine calls Ipopt for solving the quadratic problem, Ipopt is a library written in C++. // // Examples - // //Find the value of x that minimize following function - // // f(x) = 0.5*x1^2 + x2^2 - x1*x2 - 2*x1 - 6*x2 - // // Subject to: - // // x1 + x2 ≤ 2 - // // –x1 + 2x2 ≤ 2 - // // 2x1 + x2 ≤ 3 - // // 0 ≤ x1, 0 ≤ x2. - // H = [1 -1; -1 2]; - // f = [-2; -6]; - // A = [1 1; -1 2; 2 1]; - // b = [2; 2; 3]; + // //Ref : example 14 : + // //https://www.me.utexas.edu/~jensen/ORMM/supplements/methods/nlpmethod/S2_quadratic.pdf + // // min. -8*x1*x1 -16*x2*x2 + x1 + 4*x2 + // // such that + // // x1 + x2 <= 5, + // // x1 <= 3, + // // x1 >= 0, + // // x2 >= 0 + // H = [2 0 + // 0 8]; + // f = [-8; -16]; + // A = [1 1;1 0]; + // b = [5;3]; // lb = [0; 0]; // ub = [%inf; %inf]; // [xopt,fopt,exitflag,output,lambda] = qpipoptmat(H,f,A,b,[],[],lb,ub) @@ -87,7 +89,7 @@ function [xopt,fopt,exitflag,output,lambda] = qpipoptmat (varargin) // param = list("MaxIter", 300, "CpuTime", 100); // //and minimize 0.5*x'*H*x + f'*x with // f=[1; 2; 3; 4; 5; 6]; H=eye(6,6); - // [xopt,fopt,exitflag,output,lambda]=qpipoptmat(H,f,A,b,Aeq,beq,lb,ub,[],param) + // [xopt,fopt,exitflag,output,lambda]=qpipoptmat(H,f,A,b,Aeq,beq,lb,ub,x0,param) // Authors // Keyur Joshi, Saikiran, Iswarya, Harpreet Singh diff --git a/macros/setOptions.sci b/macros/setOptions.sci index 68aad02..995b2fb 100644 --- a/macros/setOptions.sci +++ b/macros/setOptions.sci @@ -1,13 +1,13 @@ // Copyright (C) 2015 - IIT Bombay - FOSSEE // -// Author: Harpreet Singh -// Organization: FOSSEE, IIT Bombay -// Email: harpreet.mertia@gmail.com // This file must be used under the terms of the CeCILL. // This source file is licensed as described in the file COPYING, which // you should have received as part of this distribution. The terms // are also available at // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Harpreet Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in function setOptions(varargin) diff --git a/macros/symphony.bin b/macros/symphony.bin Binary files differindex 9217660..87b6444 100644 --- a/macros/symphony.bin +++ b/macros/symphony.bin diff --git a/macros/symphony.sci b/macros/symphony.sci index 264a513..d465b90 100644 --- a/macros/symphony.sci +++ b/macros/symphony.sci @@ -1,13 +1,13 @@ // Copyright (C) 2015 - IIT Bombay - FOSSEE // -// Author: Harpreet Singh -// Organization: FOSSEE, IIT Bombay -// Email: harpreet.mertia@gmail.com // This file must be used under the terms of the CeCILL. // This source file is licensed as described in the file COPYING, which // you should have received as part of this distribution. The terms // are also available at // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Harpreet Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in function [xopt,fopt,status,output] = symphony (varargin) // Solves a mixed integer linear programming constrained optimization problem. @@ -32,12 +32,11 @@ function [xopt,fopt,status,output] = symphony (varargin) // options : a list containing the the parameters to be set. // xopt : a vector of double, the computed solution of the optimization problem. // fopt : a double, the function value at x. - // status : status flag from symphony. 227 is optimal, 228 is Time limit exceeded, 230 is iteration limit exceeded. + // status : status flag returned from symphony. 227 is optimal, 228 is Time limit exceeded, 230 is iteration limit exceeded. // output : The output data structure contains detailed information about the optimization process. This version only contains number of iterations // // Description // 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 // // <latex> // \begin{eqnarray} @@ -52,7 +51,7 @@ function [xopt,fopt,status,output] = symphony (varargin) // The routine calls SYMPHONY written in C by gateway files for the actual computation. // // Examples - // //A basic case : + // //Reference: Westerberg, Carl-Henrik, Bengt Bjorklund, and Eskil Hultman. "An application of mixed integer programming in a Swedish steel mill." Interfaces 7, no. 2 (1977): 39-43. // // Objective function // c = [350*5,330*3,310*4,280*6,500,450,400,100]'; // // Lower Bound of variable @@ -203,8 +202,21 @@ function [xopt,fopt,status,output] = symphony (varargin) options = varargin(11); end -// Check if the user gives row vector -// and Changing it to a column matrix + // Check if the user gives empty matrix + if (size(lb,2)==0) then + lb = repmat(-%inf,nbVar,1); + end + + if (size(isInt,2)==0) then + isInt = repmat(%f,nbVar,1); + end + + if (size(ub,2)==0) then + ub = repmat(%inf,nbVar,1); + end + + // Check if the user gives row vector + // and Changing it to a column matrix if (size(isInt,2)== [nbVar]) then isInt = isInt'; @@ -262,7 +274,7 @@ function [xopt,fopt,status,output] = symphony (varargin) end //Check the column of constraint which should equal to the number of variables - if ( size(A,2) ~= nbVar) then + if ( size(A,2) ~= nbVar & size(A,2) ~= 0) then errmsg = msprintf(gettext("%s: The number of columns in constraint should equal to the number of variables"), "Symphony"); error(errmsg); end diff --git a/macros/symphony_call.sci b/macros/symphony_call.sci index cfe73ae..af066f4 100644 --- a/macros/symphony_call.sci +++ b/macros/symphony_call.sci @@ -1,13 +1,13 @@ // Copyright (C) 2015 - IIT Bombay - FOSSEE // -// Author: Harpreet Singh -// Organization: FOSSEE, IIT Bombay -// Email: harpreet.mertia@gmail.com // This file must be used under the terms of the CeCILL. // This source file is licensed as described in the file COPYING, which // you should have received as part of this distribution. The terms // are also available at // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Harpreet Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in function [xopt,fopt,status,output] = symphony_call(nbVar,nbCon,objCoef,isInt,LB,UB,conMatrix,conLB,conUB,objSense,options) diff --git a/macros/symphonymat.bin b/macros/symphonymat.bin Binary files differindex 0841d41..eacbd5c 100644 --- a/macros/symphonymat.bin +++ b/macros/symphonymat.bin diff --git a/macros/symphonymat.sci b/macros/symphonymat.sci index 2c0c18d..67e64c5 100644 --- a/macros/symphonymat.sci +++ b/macros/symphonymat.sci @@ -1,162 +1,162 @@ // Copyright (C) 2015 - IIT Bombay - FOSSEE // -// Author: Harpreet Singh -// Organization: FOSSEE, IIT Bombay -// Email: harpreet.mertia@gmail.com // This file must be used under the terms of the CeCILL. // This source file is licensed as described in the file COPYING, which // you should have received as part of this distribution. The terms // are also available at // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Harpreet Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in function [xopt,fopt,status,iter] = symphonymat (varargin) - // Solves a mixed integer linear programming constrained optimization problem in intlinprog format. - // - // Calling Sequence - // 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( ... ) - // - // Parameters - // c : a vector of double, contains coefficients of the variables in the objective - // intcon : 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. - // A : 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. - // b : 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. - // Aeq : 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. - // beq : 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. - // 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 the parameters to be set. - // xopt : a vector of double, the computed solution of the optimization problem. - // fopt : a double, the function value at x - // status : status flag from symphony. 227 is optimal, 228 is Time limit exceeded, 230 is iteration limit exceeded. - // output : The output data structure contains detailed information about the optimization process. This version only contains number of iterations. - // - // Description - // Search the minimum or maximum of a constrained mixed integer linear programming optimization problem specified by : - // find the minimum or maximum of C'⋅x such that - // - // <latex> - // \begin{eqnarray} - // &\mbox{min}_{x} - // & C^T⋅x \\ - // & \text{subject to} & A⋅x \leq b \\ - // & & Aeq⋅x = beq \\ - // & & lb \leq x \leq ub \\ - // & & x_i \in \!\, \mathbb{Z}, i \in \!\, I - // \end{eqnarray} - // </latex> - // - // The routine calls SYMPHONY written in C by gateway files for the actual computation. - // - // Examples - // // Objective function - // 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 - // ub = [repmat(1,1,4) repmat(%inf,1,4)]; - // // Constraint Matrix - // Aeq = [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;] - // beq = [ 25, 1.25, 1.25] - // intcon = [1 2 3 4]; - // // Calling Symphony - // [x,f,status,output] = symphonymat(c,intcon,[],[],Aeq,beq,lb,ub) - // // Press ENTER to continue - // - // Examples - // // An advanced case where we set some options in symphony - // // This problem is taken from - // // P.C.Chu and J.E.Beasley - // // "A genetic algorithm for the multidimensional knapsack problem", - // // Journal of Heuristics, vol. 4, 1998, pp63-86. - // // The problem to be solved is: - // // Max sum{j=1,...,n} p(j)x(j) - // // 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 .. - // 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 .. - // 959 668 507 855 986 831 821 825 868 852 832 828 799 686 .. - // 510 671 575 740 510 675 996 636 826 1022 1140 654 909 799 .. - // 1162 653 814 625 599 476 767 954 906 904 649 873 565 853 1008 632]'; - // //Constraint Matrix - // A = [ //Constraint 1 - // 42 41 523 215 819 551 69 193 582 375 367 478 162 898 .. - // 550 553 298 577 493 183 260 224 852 394 958 282 402 604 .. - // 164 308 218 61 273 772 191 117 276 877 415 873 902 465 .. - // 320 870 244 781 86 622 665 155 680 101 665 227 597 354 .. - // 597 79 162 998 849 136 112 751 735 884 71 449 266 420 .. - // 797 945 746 46 44 545 882 72 383 714 987 183 731 301 .. - // 718 91 109 567 708 507 983 808 766 615 554 282 995 946 651 298; - // //Constraint 2 - // 509 883 229 569 706 639 114 727 491 481 681 948 687 941 .. - // 350 253 573 40 124 384 660 951 739 329 146 593 658 816 .. - // 638 717 779 289 430 851 937 289 159 260 930 248 656 833 .. - // 892 60 278 741 297 967 86 249 354 614 836 290 893 857 .. - // 158 869 206 504 799 758 431 580 780 788 583 641 32 653 .. - // 252 709 129 368 440 314 287 854 460 594 512 239 719 751 .. - // 708 670 269 832 137 356 960 651 398 893 407 477 552 805 881 850; - // //Constraint 3 - // 806 361 199 781 596 669 957 358 259 888 319 751 275 177 .. - // 883 749 229 265 282 694 819 77 190 551 140 442 867 283 .. - // 137 359 445 58 440 192 485 744 844 969 50 833 57 877 .. - // 482 732 968 113 486 710 439 747 174 260 877 474 841 422 .. - // 280 684 330 910 791 322 404 403 519 148 948 414 894 147 .. - // 73 297 97 651 380 67 582 973 143 732 624 518 847 113 .. - // 382 97 905 398 859 4 142 110 11 213 398 173 106 331 254 447 ; - // //Constraint 4 - // 404 197 817 1000 44 307 39 659 46 334 448 599 931 776 .. - // 263 980 807 378 278 841 700 210 542 636 388 129 203 110 .. - // 817 502 657 804 662 989 585 645 113 436 610 948 919 115 .. - // 967 13 445 449 740 592 327 167 368 335 179 909 825 614 .. - // 987 350 179 415 821 525 774 283 427 275 659 392 73 896 .. - // 68 982 697 421 246 672 649 731 191 514 983 886 95 846 .. - // 689 206 417 14 735 267 822 977 302 687 118 990 323 993 525 322; - // //Constrain 5 - // 475 36 287 577 45 700 803 654 196 844 657 387 518 143 .. - // 515 335 942 701 332 803 265 922 908 139 995 845 487 100 .. - // 447 653 649 738 424 475 425 926 795 47 136 801 904 740 .. - // 768 460 76 660 500 915 897 25 716 557 72 696 653 933 .. - // 420 582 810 861 758 647 237 631 271 91 75 756 409 440 .. - // 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(c,1) - // b=[11927 13727 11551 13056 13460 ]; - // // Lower Bound of variables - // lb = repmat(0,1,nbVar) - // // Upper Bound of variables - // ub = repmat(1,1,nbVar) - // // Lower Bound of constrains - // intcon = []; - // for i = 1:nbVar - // intcon = [intcon i]; - // end - // options = list("time_limit", 25); - // // The expected solution : - // // Output variables - // xopt = [0 1 1 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 1 0 1 1 0 1 .. - // 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 1 .. - // 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 1 0 0 1 0] - // // Optimal value - // fopt = [ 24381 ] - // // Calling Symphony - // [x,f,status,output] = symphonymat(c,intcon,A,b,[],[],lb,ub,options); - // Authors - // Keyur Joshi, Saikiran, Iswarya, Harpreet Singh + // Solves a mixed integer linear programming constrained optimization problem in intlinprog format. + // + // Calling Sequence + // 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( ... ) + // + // Parameters + // c : a vector of double, contains coefficients of the variables in the objective + // intcon : 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. + // A : 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. + // b : 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. + // Aeq : 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. + // beq : 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. + // 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 the parameters to be set. + // xopt : a vector of double, the computed solution of the optimization problem. + // fopt : a double, the function value at x + // status : status flag returned from symphony. 227 is optimal, 228 is Time limit exceeded, 230 is iteration limit exceeded. + // output : The output data structure contains detailed information about the optimization process. This version only contains number of iterations. + // + // Description + // Search the minimum or maximum of a constrained mixed integer linear programming optimization problem specified by : + // + // <latex> + // \begin{eqnarray} + // &\mbox{min}_{x} + // & C^T⋅x \\ + // & \text{subject to} & A⋅x \leq b \\ + // & & Aeq⋅x = beq \\ + // & & lb \leq x \leq ub \\ + // & & x_i \in \!\, \mathbb{Z}, i \in \!\, I + // \end{eqnarray} + // </latex> + // + // The routine calls SYMPHONY written in C by gateway files for the actual computation. + // + // Examples + // // Objective function + // // Reference: Westerberg, Carl-Henrik, Bengt Bjorklund, and Eskil Hultman. "An application of mixed integer programming in a Swedish steel mill." Interfaces 7, no. 2 (1977): 39-43. + // 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 + // ub = [repmat(1,1,4) repmat(%inf,1,4)]; + // // Constraint Matrix + // Aeq = [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;] + // beq = [ 25, 1.25, 1.25] + // intcon = [1 2 3 4]; + // // Calling Symphony + // [x,f,status,output] = symphonymat(c,intcon,[],[],Aeq,beq,lb,ub) + // // Press ENTER to continue + // + // Examples + // // An advanced case where we set some options in symphony + // // This problem is taken from + // // P.C.Chu and J.E.Beasley + // // "A genetic algorithm for the multidimensional knapsack problem", + // // Journal of Heuristics, vol. 4, 1998, pp63-86. + // // The problem to be solved is: + // // Max sum{j=1,...,n} p(j)x(j) + // // 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 .. + // 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 .. + // 959 668 507 855 986 831 821 825 868 852 832 828 799 686 .. + // 510 671 575 740 510 675 996 636 826 1022 1140 654 909 799 .. + // 1162 653 814 625 599 476 767 954 906 904 649 873 565 853 1008 632]'; + // //Constraint Matrix + // A = [ //Constraint 1 + // 42 41 523 215 819 551 69 193 582 375 367 478 162 898 .. + // 550 553 298 577 493 183 260 224 852 394 958 282 402 604 .. + // 164 308 218 61 273 772 191 117 276 877 415 873 902 465 .. + // 320 870 244 781 86 622 665 155 680 101 665 227 597 354 .. + // 597 79 162 998 849 136 112 751 735 884 71 449 266 420 .. + // 797 945 746 46 44 545 882 72 383 714 987 183 731 301 .. + // 718 91 109 567 708 507 983 808 766 615 554 282 995 946 651 298; + // //Constraint 2 + // 509 883 229 569 706 639 114 727 491 481 681 948 687 941 .. + // 350 253 573 40 124 384 660 951 739 329 146 593 658 816 .. + // 638 717 779 289 430 851 937 289 159 260 930 248 656 833 .. + // 892 60 278 741 297 967 86 249 354 614 836 290 893 857 .. + // 158 869 206 504 799 758 431 580 780 788 583 641 32 653 .. + // 252 709 129 368 440 314 287 854 460 594 512 239 719 751 .. + // 708 670 269 832 137 356 960 651 398 893 407 477 552 805 881 850; + // //Constraint 3 + // 806 361 199 781 596 669 957 358 259 888 319 751 275 177 .. + // 883 749 229 265 282 694 819 77 190 551 140 442 867 283 .. + // 137 359 445 58 440 192 485 744 844 969 50 833 57 877 .. + // 482 732 968 113 486 710 439 747 174 260 877 474 841 422 .. + // 280 684 330 910 791 322 404 403 519 148 948 414 894 147 .. + // 73 297 97 651 380 67 582 973 143 732 624 518 847 113 .. + // 382 97 905 398 859 4 142 110 11 213 398 173 106 331 254 447 ; + // //Constraint 4 + // 404 197 817 1000 44 307 39 659 46 334 448 599 931 776 .. + // 263 980 807 378 278 841 700 210 542 636 388 129 203 110 .. + // 817 502 657 804 662 989 585 645 113 436 610 948 919 115 .. + // 967 13 445 449 740 592 327 167 368 335 179 909 825 614 .. + // 987 350 179 415 821 525 774 283 427 275 659 392 73 896 .. + // 68 982 697 421 246 672 649 731 191 514 983 886 95 846 .. + // 689 206 417 14 735 267 822 977 302 687 118 990 323 993 525 322; + // //Constrain 5 + // 475 36 287 577 45 700 803 654 196 844 657 387 518 143 .. + // 515 335 942 701 332 803 265 922 908 139 995 845 487 100 .. + // 447 653 649 738 424 475 425 926 795 47 136 801 904 740 .. + // 768 460 76 660 500 915 897 25 716 557 72 696 653 933 .. + // 420 582 810 861 758 647 237 631 271 91 75 756 409 440 .. + // 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(c,1) + // b=[11927 13727 11551 13056 13460 ]; + // // Lower Bound of variables + // lb = repmat(0,1,nbVar) + // // Upper Bound of variables + // ub = repmat(1,1,nbVar) + // // Lower Bound of constrains + // intcon = []; + // for i = 1:nbVar + // intcon = [intcon i]; + // end + // options = list("time_limit", 25); + // // The expected solution : + // // Output variables + // xopt = [0 1 1 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 1 0 1 1 0 1 .. + // 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 1 .. + // 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 1 0 0 1 0] + // // Optimal value + // fopt = [ 24381 ] + // // Calling Symphony + // [x,f,status,output] = symphonymat(c,intcon,A,b,[],[],lb,ub,options); + // Authors + // Keyur Joshi, Saikiran, Iswarya, Harpreet Singh -//To check the number of input and output argument - [lhs , rhs] = argn(); + //To check the number of input and output argument + [lhs , rhs] = argn(); -//To check the number of argument given by user + //To check the number of argument given by user if ( rhs < 4 | rhs == 5 | rhs == 7 | rhs > 9 ) then errmsg = msprintf(gettext("%s: Unexpected number of input arguments : %d provided while should be in the set [4 6 8 9]"), "Symphony", rhs); error(errmsg); @@ -171,7 +171,6 @@ function [xopt,fopt,status,iter] = symphonymat (varargin) lb = []; ub = []; - c = varargin(1) intcon = varargin(2) A = varargin(3) |