diff options
author | Harpreet | 2015-12-31 16:03:57 +0530 |
---|---|---|
committer | Harpreet | 2015-12-31 16:03:57 +0530 |
commit | d5356061fbd3a9b3052dee25bd9c82c375c42e22 (patch) | |
tree | 72a37d5161eb0f4b895513c46c68e031d1200520 | |
parent | eb9ca1191c94059cd7adcf69805906c809fe9712 (diff) | |
download | FOSSEE-Optimization-toolbox-d5356061fbd3a9b3052dee25bd9c82c375c42e22.tar.gz FOSSEE-Optimization-toolbox-d5356061fbd3a9b3052dee25bd9c82c375c42e22.tar.bz2 FOSSEE-Optimization-toolbox-d5356061fbd3a9b3052dee25bd9c82c375c42e22.zip |
Macros example updated
104 files changed, 1497 insertions, 1273 deletions
diff --git a/demos/lsqlin.dem.sce b/demos/lsqlin.dem.sce index 0b81630..827ba63 100644 --- a/demos/lsqlin.dem.sce +++ b/demos/lsqlin.dem.sce @@ -4,46 +4,40 @@ mode(1) // //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 halt() // Press return to continue //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); +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) //========= E N D === O F === D E M O =========// diff --git a/demos/lsqnonneg.dem.sce b/demos/lsqnonneg.dem.sce index 73fa6df..d8be39b 100644 --- a/demos/lsqnonneg.dem.sce +++ b/demos/lsqnonneg.dem.sce @@ -4,15 +4,15 @@ mode(1) // // 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) //========= E N D === O F === D E M O =========// diff --git a/demos/qpipopt.dem.sce b/demos/qpipopt.dem.sce index 8e405e1..3fa7476 100644 --- a/demos/qpipopt.dem.sce +++ b/demos/qpipopt.dem.sce @@ -3,6 +3,28 @@ mode(1) // Demo of qpipopt.sci // +//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 +halt() // Press return to continue + //Find x in R^6 such that: A= [1,-1,1,0,3,1; -1,0,-3,-4,5,6; @@ -20,24 +42,4 @@ 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 -halt() // Press return to continue - -//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) //========= E N D === O F === D E M O =========// diff --git a/demos/qpipoptmat.dem.sce b/demos/qpipoptmat.dem.sce index 0892855..1e8ebc8 100644 --- a/demos/qpipoptmat.dem.sce +++ b/demos/qpipoptmat.dem.sce @@ -3,17 +3,19 @@ mode(1) // Demo of qpipoptmat.sci // -//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) @@ -34,5 +36,5 @@ x0 = repmat(0,6,1); 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) //========= E N D === O F === D E M O =========// diff --git a/demos/symphony.dem.sce b/demos/symphony.dem.sce index 67886a3..a0b629e 100644 --- a/demos/symphony.dem.sce +++ b/demos/symphony.dem.sce @@ -3,7 +3,7 @@ mode(1) // Demo of symphony.sci // -//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 diff --git a/demos/symphonymat.dem.sce b/demos/symphonymat.dem.sce index a5e19ac..7bc751e 100644 --- a/demos/symphonymat.dem.sce +++ b/demos/symphonymat.dem.sce @@ -4,6 +4,7 @@ mode(1) // // 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); diff --git a/help/en_US/lsqlin.xml b/help/en_US/lsqlin.xml index c08905e..c6ec286 100644 --- a/help/en_US/lsqlin.xml +++ b/help/en_US/lsqlin.xml @@ -62,13 +62,13 @@ <varlistentry><term>resnorm :</term> <listitem><para> a double, objective value returned as the scalar value norm(C*x-d)^2.</para></listitem></varlistentry> <varlistentry><term>residual :</term> - <listitem><para> a vector of double, solution residuals returned as the vector C*x-d.</para></listitem></varlistentry> + <listitem><para> a vector of double, solution residuals returned as the vector d-C*x.</para></listitem></varlistentry> <varlistentry><term>exitflag :</term> - <listitem><para> 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.</para></listitem></varlistentry> + <listitem><para> 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.</para></listitem></varlistentry> <varlistentry><term>output :</term> <listitem><para> Structure containing information about the optimization. This version only contains number of iterations.</para></listitem></varlistentry> <varlistentry><term>lambda :</term> - <listitem><para> Structure containing the Lagrange multipliers at the solution x (separated by constraint type).It contains lower, upper bound multiplier and linear equality, inequality constraints.</para></listitem></varlistentry> + <listitem><para> 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.</para></listitem></varlistentry> </variablelist> </refsection> @@ -99,22 +99,16 @@ The routine calls Ipopt for solving the linear least square problem, Ipopt is a <title>Examples</title> <programlisting role="example"><![CDATA[ //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 @@ -125,26 +119,26 @@ b = [0.5251 <title>Examples</title> <programlisting role="example"><![CDATA[ //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); +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) ]]></programlisting> </refsection> diff --git a/help/en_US/lsqnonneg.xml b/help/en_US/lsqnonneg.xml index 662ba2a..5d78bbd 100644 --- a/help/en_US/lsqnonneg.xml +++ b/help/en_US/lsqnonneg.xml @@ -43,13 +43,13 @@ <varlistentry><term>resnorm :</term> <listitem><para> a double, objective value returned as the scalar value norm(C*x-d)^2.</para></listitem></varlistentry> <varlistentry><term>residual :</term> - <listitem><para> a vector of double, solution residuals returned as the vector C*x-d.</para></listitem></varlistentry> + <listitem><para> a vector of double, solution residuals returned as the vector d-C*x.</para></listitem></varlistentry> <varlistentry><term>exitflag :</term> - <listitem><para> 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.</para></listitem></varlistentry> + <listitem><para> 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.</para></listitem></varlistentry> <varlistentry><term>output :</term> <listitem><para> Structure containing information about the optimization. This version only contains number of iterations.</para></listitem></varlistentry> <varlistentry><term>lambda :</term> - <listitem><para> Structure containing the Lagrange multipliers at the solution x. It contains lower and upper bound multiplier.</para></listitem></varlistentry> + <listitem><para> Structure containing the Lagrange multipliers at the solution xopt. It contains lower, upper bound multiplier and linear equality, inequality constraint multiplier.</para></listitem></varlistentry> </variablelist> </refsection> @@ -78,16 +78,16 @@ The routine calls Ipopt for solving the nonnegative least-squares curve fitting <title>Examples</title> <programlisting role="example"><![CDATA[ // 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) ]]></programlisting> </refsection> diff --git a/help/en_US/qpipopt.xml b/help/en_US/qpipopt.xml index 6dd578d..3ba2107 100644 --- a/help/en_US/qpipopt.xml +++ b/help/en_US/qpipopt.xml @@ -62,11 +62,11 @@ <varlistentry><term>fopt :</term> <listitem><para> a double, the function value at x.</para></listitem></varlistentry> <varlistentry><term>exitflag :</term> - <listitem><para> 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.</para></listitem></varlistentry> + <listitem><para> 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.</para></listitem></varlistentry> <varlistentry><term>output :</term> <listitem><para> Structure containing information about the optimization. This version only contains number of iterations</para></listitem></varlistentry> <varlistentry><term>lambda :</term> - <listitem><para> Structure containing the Lagrange multipliers at the solution x (separated by constraint type).It contains lower, upper and linear equality, inequality constraints.</para></listitem></varlistentry> + <listitem><para> 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.</para></listitem></varlistentry> </variablelist> </refsection> @@ -74,7 +74,6 @@ <title>Description</title> <para> Search the minimum of a constrained linear quadratic optimization problem specified by : -find the minimum of f(x) such that </para> <para> <latex> @@ -96,6 +95,33 @@ The routine calls Ipopt for solving the quadratic problem, Ipopt is a library wr <refsection> <title>Examples</title> <programlisting role="example"><![CDATA[ +//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 + + ]]></programlisting> +</refsection> + +<refsection> + <title>Examples</title> + <programlisting role="example"><![CDATA[ //Find x in R^6 such that: A= [1,-1,1,0,3,1; -1,0,-3,-4,5,6; @@ -113,31 +139,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 - - ]]></programlisting> -</refsection> - -<refsection> - <title>Examples</title> - <programlisting role="example"><![CDATA[ -//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) ]]></programlisting> </refsection> diff --git a/help/en_US/qpipoptmat.xml b/help/en_US/qpipoptmat.xml index 8d0bc0c..1334603 100644 --- a/help/en_US/qpipoptmat.xml +++ b/help/en_US/qpipoptmat.xml @@ -62,12 +62,14 @@ <listitem><para> a vector of double, the computed solution of the optimization problem.</para></listitem></varlistentry> <varlistentry><term>fopt :</term> <listitem><para> a double, the function value at x.</para></listitem></varlistentry> + <varlistentry><term>residual :</term> + <listitem><para> a vector of double, solution residuals returned as the vector d-C*x.</para></listitem></varlistentry> <varlistentry><term>exitflag :</term> - <listitem><para> 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.</para></listitem></varlistentry> + <listitem><para> 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.</para></listitem></varlistentry> <varlistentry><term>output :</term> <listitem><para> Structure containing information about the optimization. This version only contains number of iterations.</para></listitem></varlistentry> <varlistentry><term>lambda :</term> - <listitem><para> Structure containing the Lagrange multipliers at the solution x (separated by constraint type).It contains lower, upper and linear equality, inequality constraints.</para></listitem></varlistentry> + <listitem><para> 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.</para></listitem></varlistentry> </variablelist> </refsection> @@ -75,7 +77,6 @@ <title>Description</title> <para> Search the minimum of a constrained linear quadratic optimization problem specified by : -find the minimum of f(x) such that </para> <para> <latex> @@ -98,17 +99,19 @@ The routine calls Ipopt for solving the quadratic problem, Ipopt is a library wr <refsection> <title>Examples</title> <programlisting role="example"><![CDATA[ -//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) @@ -134,7 +137,7 @@ x0 = repmat(0,6,1); 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) ]]></programlisting> </refsection> diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS Binary files differindex 8ebf21b..d3146bf 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB Binary files differindex 728f68c..f0a1fcb 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS b/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS Binary files differindex 9468d7f..8a63187 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS b/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS Binary files differindex d5dee46..423d132 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA b/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA index e2b33d1..6df2edb 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=1446 id2=1 +TMAP bs=2048 rt=1 fl=-1 id1=1249 id2=1 diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP b/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP Binary files differindex 35dc462..6104335 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP diff --git a/help/en_US/scilab_en_US_help/lsqlin.html b/help/en_US/scilab_en_US_help/lsqlin.html index aef773d..e9253c5 100644 --- a/help/en_US/scilab_en_US_help/lsqlin.html +++ b/help/en_US/scilab_en_US_help/lsqlin.html @@ -70,13 +70,13 @@ <dt><span class="term">resnorm :</span> <dd><p class="para">a double, objective value returned as the scalar value norm(C*x-d)^2.</p></dd></dt> <dt><span class="term">residual :</span> - <dd><p class="para">a vector of double, solution residuals returned as the vector C*x-d.</p></dd></dt> + <dd><p class="para">a vector of double, solution residuals returned as the vector d-C*x.</p></dd></dt> <dt><span class="term">exitflag :</span> - <dd><p class="para">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.</p></dd></dt> + <dd><p class="para">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.</p></dd></dt> <dt><span class="term">output :</span> <dd><p class="para">Structure containing information about the optimization. This version only contains number of iterations.</p></dd></dt> <dt><span class="term">lambda :</span> - <dd><p class="para">Structure containing the Lagrange multipliers at the solution x (separated by constraint type).It contains lower, upper bound multiplier and linear equality, inequality constraints.</p></dd></dt></dl></div> + <dd><p class="para">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.</p></dd></dt></dl></div> <div class="refsection"><h3 class="title">Description</h3> <p class="para">Search the minimum of a constrained linear least square problem specified by :</p> @@ -86,47 +86,41 @@ <div class="refsection"><h3 class="title">Examples</h3> <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">//A simple linear least square example</span> -<span class="scilabid">C</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">0.9501</span> <span class="scilabnumber">0.7620</span> <span class="scilabnumber">0.6153</span> <span class="scilabnumber">0.4057</span> -<span class="scilabnumber">0.2311</span> <span class="scilabnumber">0.4564</span> <span class="scilabnumber">0.7919</span> <span class="scilabnumber">0.9354</span> -<span class="scilabnumber">0.6068</span> <span class="scilabnumber">0.0185</span> <span class="scilabnumber">0.9218</span> <span class="scilabnumber">0.9169</span> -<span class="scilabnumber">0.4859</span> <span class="scilabnumber">0.8214</span> <span class="scilabnumber">0.7382</span> <span class="scilabnumber">0.4102</span> -<span class="scilabnumber">0.8912</span> <span class="scilabnumber">0.4447</span> <span class="scilabnumber">0.1762</span> <span class="scilabnumber">0.8936</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">d</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">0.0578</span> -<span class="scilabnumber">0.3528</span> -<span class="scilabnumber">0.8131</span> -<span class="scilabnumber">0.0098</span> -<span class="scilabnumber">0.1388</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">A</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">0.2027</span> <span class="scilabnumber">0.2721</span> <span class="scilabnumber">0.7467</span> <span class="scilabnumber">0.4659</span> -<span class="scilabnumber">0.1987</span> <span class="scilabnumber">0.1988</span> <span class="scilabnumber">0.4450</span> <span class="scilabnumber">0.4186</span> -<span class="scilabnumber">0.6037</span> <span class="scilabnumber">0.0152</span> <span class="scilabnumber">0.9318</span> <span class="scilabnumber">0.8462</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">b</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">0.5251</span> -<span class="scilabnumber">0.2026</span> -<span class="scilabnumber">0.6721</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">C</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span> <span class="scilabnumber">2</span> <span class="scilabnumber">0</span><span class="scilabdefault">;</span> +<span class="scilaboperator">-</span><span class="scilabnumber">1</span> <span class="scilabnumber">1</span><span class="scilabdefault">;</span> +<span class="scilabnumber">0</span> <span class="scilabnumber">2</span><span class="scilabopenclose">]</span> +<span class="scilabid">d</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">1</span> +<span class="scilabnumber">0</span> +<span class="scilaboperator">-</span><span class="scilabnumber">1</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">A</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">10</span> <span class="scilaboperator">-</span><span class="scilabnumber">2</span><span class="scilabdefault">;</span> +<span class="scilaboperator">-</span><span class="scilabnumber">2</span> <span class="scilabnumber">10</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">b</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">4</span> +<span class="scilaboperator">-</span><span class="scilabnumber">4</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> <span class="scilabopenclose">[</span><span class="scilabid">xopt</span><span class="scilabdefault">,</span><span class="scilabid">resnorm</span><span class="scilabdefault">,</span><span class="scilabid">residual</span><span class="scilabdefault">,</span><span class="scilabid">exitflag</span><span class="scilabdefault">,</span><span class="scilabid">output</span><span class="scilabdefault">,</span><span class="scilabid">lambda</span><span class="scilabopenclose">]</span> <span class="scilaboperator">=</span> <span class="scilabid">lsqlin</span><span class="scilabopenclose">(</span><span class="scilabid">C</span><span class="scilabdefault">,</span><span class="scilabid">d</span><span class="scilabdefault">,</span><span class="scilabid">A</span><span class="scilabdefault">,</span><span class="scilabid">b</span><span class="scilabopenclose">)</span> <span class="scilabcomment">// Press ENTER to continue</span></pre></td><td valign="top"><a href="scilab://scilab.execexample/"><img src="ScilabExecute.png" border="0"/></a></td><td valign="top"><a href="scilab://scilab.editexample/"><img src="ScilabEdit.png" border="0"/></a></td><td></td></tr></table></div></div> <div class="refsection"><h3 class="title">Examples</h3> <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">//A basic example for equality, inequality constraints and variable bounds</span> -<span class="scilabid">C</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">0.9501</span> <span class="scilabnumber">0.7620</span> <span class="scilabnumber">0.6153</span> <span class="scilabnumber">0.4057</span> -<span class="scilabnumber">0.2311</span> <span class="scilabnumber">0.4564</span> <span class="scilabnumber">0.7919</span> <span class="scilabnumber">0.9354</span> -<span class="scilabnumber">0.6068</span> <span class="scilabnumber">0.0185</span> <span class="scilabnumber">0.9218</span> <span class="scilabnumber">0.9169</span> -<span class="scilabnumber">0.4859</span> <span class="scilabnumber">0.8214</span> <span class="scilabnumber">0.7382</span> <span class="scilabnumber">0.4102</span> -<span class="scilabnumber">0.8912</span> <span class="scilabnumber">0.4447</span> <span class="scilabnumber">0.1762</span> <span class="scilabnumber">0.8936</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">d</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">0.0578</span> -<span class="scilabnumber">0.3528</span> -<span class="scilabnumber">0.8131</span> -<span class="scilabnumber">0.0098</span> -<span class="scilabnumber">0.1388</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">A</span> <span class="scilaboperator">=</span><span class="scilabopenclose">[</span><span class="scilabnumber">0.2027</span> <span class="scilabnumber">0.2721</span> <span class="scilabnumber">0.7467</span> <span class="scilabnumber">0.4659</span> -<span class="scilabnumber">0.1987</span> <span class="scilabnumber">0.1988</span> <span class="scilabnumber">0.4450</span> <span class="scilabnumber">0.4186</span> -<span class="scilabnumber">0.6037</span> <span class="scilabnumber">0.0152</span> <span class="scilabnumber">0.9318</span> <span class="scilabnumber">0.8462</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">b</span> <span class="scilaboperator">=</span><span class="scilabopenclose">[</span><span class="scilabnumber">0.5251</span> -<span class="scilabnumber">0.2026</span> -<span class="scilabnumber">0.6721</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">Aeq</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">3</span> <span class="scilabnumber">5</span> <span class="scilabnumber">7</span> <span class="scilabnumber">9</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">beq</span> <span class="scilaboperator">=</span> <span class="scilabnumber">4</span><span class="scilabdefault">;</span> -<span class="scilabid">lb</span> <span class="scilaboperator">=</span> <span class="scilaboperator">-</span><span class="scilabnumber">0.1</span><span class="scilaboperator">*</span><a class="scilabcommand" href="scilab://ones">ones</a><span class="scilabopenclose">(</span><span class="scilabnumber">4</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilabdefault">;</span> -<span class="scilabid">ub</span> <span class="scilaboperator">=</span> <span class="scilabnumber">2</span><span class="scilaboperator">*</span><a class="scilabcommand" href="scilab://ones">ones</a><span class="scilabopenclose">(</span><span class="scilabnumber">4</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilabdefault">;</span> +<span class="scilabid">C</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">1</span> <span class="scilabnumber">1</span> <span class="scilabnumber">1</span><span class="scilabdefault">;</span> +<span class="scilabnumber">1</span> <span class="scilabnumber">1</span> <span class="scilabnumber">0</span><span class="scilabdefault">;</span> +<span class="scilabnumber">0</span> <span class="scilabnumber">1</span> <span class="scilabnumber">1</span><span class="scilabdefault">;</span> +<span class="scilabnumber">1</span> <span class="scilabnumber">0</span> <span class="scilabnumber">0</span><span class="scilabdefault">;</span> +<span class="scilabnumber">0</span> <span class="scilabnumber">0</span> <span class="scilabnumber">1</span><span class="scilabopenclose">]</span> +<span class="scilabid">d</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">89</span><span class="scilabdefault">;</span> +<span class="scilabnumber">67</span><span class="scilabdefault">;</span> +<span class="scilabnumber">53</span><span class="scilabdefault">;</span> +<span class="scilabnumber">35</span><span class="scilabdefault">;</span> +<span class="scilabnumber">20</span><span class="scilabdefault">;</span><span class="scilabopenclose">]</span> +<span class="scilabid">A</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">3</span> <span class="scilabnumber">2</span> <span class="scilabnumber">1</span><span class="scilabdefault">;</span> +<span class="scilabnumber">2</span> <span class="scilabnumber">3</span> <span class="scilabnumber">4</span><span class="scilabdefault">;</span> +<span class="scilabnumber">1</span> <span class="scilabnumber">2</span> <span class="scilabnumber">3</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">b</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">191</span> +<span class="scilabnumber">209</span> +<span class="scilabnumber">162</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">Aeq</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">1</span> <span class="scilabnumber">2</span> <span class="scilabnumber">1</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">beq</span> <span class="scilaboperator">=</span> <span class="scilabnumber">10</span><span class="scilabdefault">;</span> +<span class="scilabid">lb</span> <span class="scilaboperator">=</span> <a class="scilabmacro" href="scilab://repmat">repmat</a><span class="scilabopenclose">(</span><span class="scilabnumber">0.1</span><span class="scilabdefault">,</span><span class="scilabnumber">3</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilabdefault">;</span> +<span class="scilabid">ub</span> <span class="scilaboperator">=</span> <a class="scilabmacro" href="scilab://repmat">repmat</a><span class="scilabopenclose">(</span><span class="scilabnumber">4</span><span class="scilabdefault">,</span><span class="scilabnumber">3</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilabdefault">;</span> <span class="scilabopenclose">[</span><span class="scilabid">xopt</span><span class="scilabdefault">,</span><span class="scilabid">resnorm</span><span class="scilabdefault">,</span><span class="scilabid">residual</span><span class="scilabdefault">,</span><span class="scilabid">exitflag</span><span class="scilabdefault">,</span><span class="scilabid">output</span><span class="scilabdefault">,</span><span class="scilabid">lambda</span><span class="scilabopenclose">]</span> <span class="scilaboperator">=</span> <span class="scilabid">lsqlin</span><span class="scilabopenclose">(</span><span class="scilabid">C</span><span class="scilabdefault">,</span><span class="scilabid">d</span><span class="scilabdefault">,</span><span class="scilabid">A</span><span class="scilabdefault">,</span><span class="scilabid">b</span><span class="scilabdefault">,</span><span class="scilabid">Aeq</span><span class="scilabdefault">,</span><span class="scilabid">beq</span><span class="scilabdefault">,</span><span class="scilabid">lb</span><span class="scilabdefault">,</span><span class="scilabid">ub</span><span class="scilabopenclose">)</span></pre></td><td valign="top"><a href="scilab://scilab.execexample/"><img src="ScilabExecute.png" border="0"/></a></td><td valign="top"><a href="scilab://scilab.editexample/"><img src="ScilabEdit.png" border="0"/></a></td><td></td></tr></table></div></div> <div class="refsection"><h3 class="title">Authors</h3> diff --git a/help/en_US/scilab_en_US_help/lsqnonneg.html b/help/en_US/scilab_en_US_help/lsqnonneg.html index e9a9110..7211c40 100644 --- a/help/en_US/scilab_en_US_help/lsqnonneg.html +++ b/help/en_US/scilab_en_US_help/lsqnonneg.html @@ -51,13 +51,13 @@ <dt><span class="term">resnorm :</span> <dd><p class="para">a double, objective value returned as the scalar value norm(C*x-d)^2.</p></dd></dt> <dt><span class="term">residual :</span> - <dd><p class="para">a vector of double, solution residuals returned as the vector C*x-d.</p></dd></dt> + <dd><p class="para">a vector of double, solution residuals returned as the vector d-C*x.</p></dd></dt> <dt><span class="term">exitflag :</span> - <dd><p class="para">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.</p></dd></dt> + <dd><p class="para">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.</p></dd></dt> <dt><span class="term">output :</span> <dd><p class="para">Structure containing information about the optimization. This version only contains number of iterations.</p></dd></dt> <dt><span class="term">lambda :</span> - <dd><p class="para">Structure containing the Lagrange multipliers at the solution x. It contains lower and upper bound multiplier.</p></dd></dt></dl></div> + <dd><p class="para">Structure containing the Lagrange multipliers at the solution xopt. It contains lower, upper bound multiplier and linear equality, inequality constraint multiplier.</p></dd></dt></dl></div> <div class="refsection"><h3 class="title">Description</h3> <p class="para">Solves nonnegative least-squares curve fitting problems specified by :</p> @@ -67,16 +67,16 @@ <div class="refsection"><h3 class="title">Examples</h3> <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">// A basic lsqnonneg problem</span> -<span class="scilabid">C</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span> -<span class="scilabnumber">0.0372</span> <span class="scilabnumber">0.2869</span> -<span class="scilabnumber">0.6861</span> <span class="scilabnumber">0.7071</span> -<span class="scilabnumber">0.6233</span> <span class="scilabnumber">0.6245</span> -<span class="scilabnumber">0.6344</span> <span class="scilabnumber">0.6170</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">d</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span> -<span class="scilabnumber">0.8587</span> -<span class="scilabnumber">0.1781</span> -<span class="scilabnumber">0.0747</span> -<span class="scilabnumber">0.8405</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">C</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">1</span> <span class="scilabnumber">1</span> <span class="scilabnumber">1</span><span class="scilabdefault">;</span> +<span class="scilabnumber">1</span> <span class="scilabnumber">1</span> <span class="scilabnumber">0</span><span class="scilabdefault">;</span> +<span class="scilabnumber">0</span> <span class="scilabnumber">1</span> <span class="scilabnumber">1</span><span class="scilabdefault">;</span> +<span class="scilabnumber">1</span> <span class="scilabnumber">0</span> <span class="scilabnumber">0</span><span class="scilabdefault">;</span> +<span class="scilabnumber">0</span> <span class="scilabnumber">0</span> <span class="scilabnumber">1</span><span class="scilabopenclose">]</span> +<span class="scilabid">d</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">89</span><span class="scilabdefault">;</span> +<span class="scilabnumber">67</span><span class="scilabdefault">;</span> +<span class="scilabnumber">53</span><span class="scilabdefault">;</span> +<span class="scilabnumber">35</span><span class="scilabdefault">;</span> +<span class="scilabnumber">20</span><span class="scilabdefault">;</span><span class="scilabopenclose">]</span> <span class="scilabopenclose">[</span><span class="scilabid">xopt</span><span class="scilabdefault">,</span><span class="scilabid">resnorm</span><span class="scilabdefault">,</span><span class="scilabid">residual</span><span class="scilabdefault">,</span><span class="scilabid">exitflag</span><span class="scilabdefault">,</span><span class="scilabid">output</span><span class="scilabdefault">,</span><span class="scilabid">lambda</span><span class="scilabopenclose">]</span> <span class="scilaboperator">=</span> <span class="scilabid">lsqnonneg</span><span class="scilabopenclose">(</span><span class="scilabid">C</span><span class="scilabdefault">,</span><span class="scilabid">d</span><span class="scilabopenclose">)</span></pre></td><td valign="top"><a href="scilab://scilab.execexample/"><img src="ScilabExecute.png" border="0"/></a></td><td valign="top"><a href="scilab://scilab.editexample/"><img src="ScilabEdit.png" border="0"/></a></td><td></td></tr></table></div></div> <div class="refsection"><h3 class="title">Authors</h3> diff --git a/help/en_US/scilab_en_US_help/qpipopt.html b/help/en_US/scilab_en_US_help/qpipopt.html index 349bbc4..31f389f 100644 --- a/help/en_US/scilab_en_US_help/qpipopt.html +++ b/help/en_US/scilab_en_US_help/qpipopt.html @@ -70,20 +70,41 @@ <dt><span class="term">fopt :</span> <dd><p class="para">a double, the function value at x.</p></dd></dt> <dt><span class="term">exitflag :</span> - <dd><p class="para">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.</p></dd></dt> + <dd><p class="para">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.</p></dd></dt> <dt><span class="term">output :</span> <dd><p class="para">Structure containing information about the optimization. This version only contains number of iterations</p></dd></dt> <dt><span class="term">lambda :</span> - <dd><p class="para">Structure containing the Lagrange multipliers at the solution x (separated by constraint type).It contains lower, upper and linear equality, inequality constraints.</p></dd></dt></dl></div> + <dd><p class="para">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.</p></dd></dt></dl></div> <div class="refsection"><h3 class="title">Description</h3> - <p class="para">Search the minimum of a constrained linear quadratic optimization problem specified by : -find the minimum of f(x) such that</p> + <p class="para">Search the minimum of a constrained linear quadratic optimization problem specified by :</p> <p class="para"><span><img src='./_LaTeX_qpipopt.xml_1.png' style='position:relative;top:31px;width:292px;height:70px'/></span></p> <p class="para">The routine calls Ipopt for solving the quadratic problem, Ipopt is a library written in C++.</p> <p class="para"></p></div> <div class="refsection"><h3 class="title">Examples</h3> + <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">//Ref : example 14 :</span> +<span class="scilabcomment">//https://www.me.utexas.edu/~jensen/ORMM/supplements/methods/nlpmethod/S2_quadratic.pdf</span> +<span class="scilabcomment">// min. -8*x1*x1 -16*x2*x2 + x1 + 4*x2</span> +<span class="scilabcomment">// such that</span> +<span class="scilabcomment">// x1 + x2 </span><span class="scilabcomment"><</span><span class="scilabcomment">= 5,</span> +<span class="scilabcomment">// x1 </span><span class="scilabcomment"><</span><span class="scilabcomment">= 3,</span> +<span class="scilabcomment">// x1 </span><span class="scilabcomment">></span><span class="scilabcomment">= 0,</span> +<span class="scilabcomment">// x2 </span><span class="scilabcomment">></span><span class="scilabcomment">= 0</span> +<span class="scilabid">H</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">2</span> <span class="scilabnumber">0</span> +<span class="scilabnumber">0</span> <span class="scilabnumber">8</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">f</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilaboperator">-</span><span class="scilabnumber">8</span><span class="scilabdefault">;</span> <span class="scilaboperator">-</span><span class="scilabnumber">16</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">A</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">1</span> <span class="scilabnumber">1</span><span class="scilabdefault">;</span><span class="scilabnumber">1</span> <span class="scilabnumber">0</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">conUB</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">5</span><span class="scilabdefault">;</span><span class="scilabnumber">3</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">conLB</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilaboperator">-</span><span class="scilabconstants">%inf</span><span class="scilabdefault">;</span> <span class="scilaboperator">-</span><span class="scilabconstants">%inf</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">lb</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">0</span><span class="scilabdefault">;</span> <span class="scilabnumber">0</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">ub</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabconstants">%inf</span><span class="scilabdefault">;</span> <span class="scilabconstants">%inf</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">nbVar</span> <span class="scilaboperator">=</span> <span class="scilabnumber">2</span><span class="scilabdefault">;</span> +<span class="scilabid">nbCon</span> <span class="scilaboperator">=</span> <span class="scilabnumber">2</span><span class="scilabdefault">;</span> +<span class="scilabopenclose">[</span><span class="scilabid">xopt</span><span class="scilabdefault">,</span><span class="scilabid">fopt</span><span class="scilabdefault">,</span><span class="scilabid">exitflag</span><span class="scilabdefault">,</span><span class="scilabid">output</span><span class="scilabdefault">,</span><span class="scilabid">lambda</span><span class="scilabopenclose">]</span> <span class="scilaboperator">=</span> <span class="scilabid">qpipopt</span><span class="scilabopenclose">(</span><span class="scilabid">nbVar</span><span class="scilabdefault">,</span><span class="scilabid">nbCon</span><span class="scilabdefault">,</span><span class="scilabid">H</span><span class="scilabdefault">,</span><span class="scilabid">f</span><span class="scilabdefault">,</span><span class="scilabid">lb</span><span class="scilabdefault">,</span><span class="scilabid">ub</span><span class="scilabdefault">,</span><span class="scilabid">A</span><span class="scilabdefault">,</span><span class="scilabid">conLB</span><span class="scilabdefault">,</span><span class="scilabid">conUB</span><span class="scilabopenclose">)</span> +<span class="scilabcomment">//Press ENTER to continue</span></pre></td><td valign="top"><a href="scilab://scilab.execexample/"><img src="ScilabExecute.png" border="0"/></a></td><td valign="top"><a href="scilab://scilab.editexample/"><img src="ScilabEdit.png" border="0"/></a></td><td></td></tr></table></div></div> + +<div class="refsection"><h3 class="title">Examples</h3> <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">//Find x in R^6 such that:</span> <span class="scilabid">A</span><span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilaboperator">-</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabnumber">0</span><span class="scilabdefault">,</span><span class="scilabnumber">3</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabdefault">;</span> <span class="scilaboperator">-</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabnumber">0</span><span class="scilabdefault">,</span><span class="scilaboperator">-</span><span class="scilabnumber">3</span><span class="scilabdefault">,</span><span class="scilaboperator">-</span><span class="scilabnumber">4</span><span class="scilabdefault">,</span><span class="scilabnumber">5</span><span class="scilabdefault">,</span><span class="scilabnumber">6</span><span class="scilabdefault">;</span> @@ -100,27 +121,7 @@ find the minimum of f(x) such that</p> <span class="scilabid">nbCon</span> <span class="scilaboperator">=</span> <span class="scilabnumber">5</span><span class="scilabdefault">;</span> <span class="scilabid">x0</span> <span class="scilaboperator">=</span> <a class="scilabmacro" href="scilab://repmat">repmat</a><span class="scilabopenclose">(</span><span class="scilabnumber">0</span><span class="scilabdefault">,</span><span class="scilabid">nbVar</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilabdefault">;</span> <span class="scilabid">param</span> <span class="scilaboperator">=</span> <a class="scilabcommand" href="scilab://list">list</a><span class="scilabopenclose">(</span><span class="scilabstring">"</span><span class="scilabstring">MaxIter</span><span class="scilabstring">"</span><span class="scilabdefault">,</span> <span class="scilabnumber">300</span><span class="scilabdefault">,</span> <span class="scilabstring">"</span><span class="scilabstring">CpuTime</span><span class="scilabstring">"</span><span class="scilabdefault">,</span> <span class="scilabnumber">100</span><span class="scilabopenclose">)</span><span class="scilabdefault">;</span> -<span class="scilabopenclose">[</span><span class="scilabid">xopt</span><span class="scilabdefault">,</span><span class="scilabid">fopt</span><span class="scilabdefault">,</span><span class="scilabid">exitflag</span><span class="scilabdefault">,</span><span class="scilabid">output</span><span class="scilabdefault">,</span><span class="scilabid">lambda</span><span class="scilabopenclose">]</span><span class="scilaboperator">=</span><span class="scilabid">qpipopt</span><span class="scilabopenclose">(</span><span class="scilabid">nbVar</span><span class="scilabdefault">,</span><span class="scilabid">nbCon</span><span class="scilabdefault">,</span><span class="scilabid">H</span><span class="scilabdefault">,</span><span class="scilabid">f</span><span class="scilabdefault">,</span><span class="scilabid">lb</span><span class="scilabdefault">,</span><span class="scilabid">ub</span><span class="scilabdefault">,</span><span class="scilabid">A</span><span class="scilabdefault">,</span><span class="scilabid">conLB</span><span class="scilabdefault">,</span><span class="scilabid">conUB</span><span class="scilabdefault">,</span><span class="scilabid">x0</span><span class="scilabdefault">,</span><span class="scilabid">param</span><span class="scilabopenclose">)</span> -<span class="scilabcomment">// Press ENTER to continue</span></pre></td><td valign="top"><a href="scilab://scilab.execexample/"><img src="ScilabExecute.png" border="0"/></a></td><td valign="top"><a href="scilab://scilab.editexample/"><img src="ScilabEdit.png" border="0"/></a></td><td></td></tr></table></div></div> - -<div class="refsection"><h3 class="title">Examples</h3> - <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">//Find the value of x that minimize following function</span> -<span class="scilabcomment">// f(x) = 0.5*x1^2 + x2^2 - x1*x2 - 2*x1 - 6*x2</span> -<span class="scilabcomment">// Subject to:</span> -<span class="scilabcomment">// x1 + x2 ≤ 2</span> -<span class="scilabcomment">// –x1 + 2x2 ≤ 2</span> -<span class="scilabcomment">// 2x1 + x2 ≤ 3</span> -<span class="scilabcomment">// 0 ≤ x1, 0 ≤ x2.</span> -<span class="scilabid">H</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">1</span> <span class="scilaboperator">-</span><span class="scilabnumber">1</span><span class="scilabdefault">;</span> <span class="scilaboperator">-</span><span class="scilabnumber">1</span> <span class="scilabnumber">2</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">f</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilaboperator">-</span><span class="scilabnumber">2</span><span class="scilabdefault">;</span> <span class="scilaboperator">-</span><span class="scilabnumber">6</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">A</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">1</span> <span class="scilabnumber">1</span><span class="scilabdefault">;</span> <span class="scilaboperator">-</span><span class="scilabnumber">1</span> <span class="scilabnumber">2</span><span class="scilabdefault">;</span> <span class="scilabnumber">2</span> <span class="scilabnumber">1</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">conUB</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">2</span><span class="scilabdefault">;</span> <span class="scilabnumber">2</span><span class="scilabdefault">;</span> <span class="scilabnumber">3</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">conLB</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilaboperator">-</span><span class="scilabconstants">%inf</span><span class="scilabdefault">;</span> <span class="scilaboperator">-</span><span class="scilabconstants">%inf</span><span class="scilabdefault">;</span> <span class="scilaboperator">-</span><span class="scilabconstants">%inf</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">lb</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">0</span><span class="scilabdefault">;</span> <span class="scilabnumber">0</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">ub</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabconstants">%inf</span><span class="scilabdefault">;</span> <span class="scilabconstants">%inf</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">nbVar</span> <span class="scilaboperator">=</span> <span class="scilabnumber">2</span><span class="scilabdefault">;</span> -<span class="scilabid">nbCon</span> <span class="scilaboperator">=</span> <span class="scilabnumber">3</span><span class="scilabdefault">;</span> -<span class="scilabopenclose">[</span><span class="scilabid">xopt</span><span class="scilabdefault">,</span><span class="scilabid">fopt</span><span class="scilabdefault">,</span><span class="scilabid">exitflag</span><span class="scilabdefault">,</span><span class="scilabid">output</span><span class="scilabdefault">,</span><span class="scilabid">lambda</span><span class="scilabopenclose">]</span> <span class="scilaboperator">=</span> <span class="scilabid">qpipopt</span><span class="scilabopenclose">(</span><span class="scilabid">nbVar</span><span class="scilabdefault">,</span><span class="scilabid">nbCon</span><span class="scilabdefault">,</span><span class="scilabid">H</span><span class="scilabdefault">,</span><span class="scilabid">f</span><span class="scilabdefault">,</span><span class="scilabid">lb</span><span class="scilabdefault">,</span><span class="scilabid">ub</span><span class="scilabdefault">,</span><span class="scilabid">A</span><span class="scilabdefault">,</span><span class="scilabid">conLB</span><span class="scilabdefault">,</span><span class="scilabid">conUB</span><span class="scilabopenclose">)</span></pre></td><td valign="top"><a href="scilab://scilab.execexample/"><img src="ScilabExecute.png" border="0"/></a></td><td valign="top"><a href="scilab://scilab.editexample/"><img src="ScilabEdit.png" border="0"/></a></td><td></td></tr></table></div></div> +<span class="scilabopenclose">[</span><span class="scilabid">xopt</span><span class="scilabdefault">,</span><span class="scilabid">fopt</span><span class="scilabdefault">,</span><span class="scilabid">exitflag</span><span class="scilabdefault">,</span><span class="scilabid">output</span><span class="scilabdefault">,</span><span class="scilabid">lambda</span><span class="scilabopenclose">]</span><span class="scilaboperator">=</span><span class="scilabid">qpipopt</span><span class="scilabopenclose">(</span><span class="scilabid">nbVar</span><span class="scilabdefault">,</span><span class="scilabid">nbCon</span><span class="scilabdefault">,</span><span class="scilabid">H</span><span class="scilabdefault">,</span><span class="scilabid">f</span><span class="scilabdefault">,</span><span class="scilabid">lb</span><span class="scilabdefault">,</span><span class="scilabid">ub</span><span class="scilabdefault">,</span><span class="scilabid">A</span><span class="scilabdefault">,</span><span class="scilabid">conLB</span><span class="scilabdefault">,</span><span class="scilabid">conUB</span><span class="scilabdefault">,</span><span class="scilabid">x0</span><span class="scilabdefault">,</span><span class="scilabid">param</span><span class="scilabopenclose">)</span></pre></td><td valign="top"><a href="scilab://scilab.execexample/"><img src="ScilabExecute.png" border="0"/></a></td><td valign="top"><a href="scilab://scilab.editexample/"><img src="ScilabEdit.png" border="0"/></a></td><td></td></tr></table></div></div> <div class="refsection"><h3 class="title">Authors</h3> <ul class="itemizedlist"><li class="member">Keyur Joshi, Saikiran, Iswarya, Harpreet Singh</li></ul></div> diff --git a/help/en_US/scilab_en_US_help/qpipoptmat.html b/help/en_US/scilab_en_US_help/qpipoptmat.html index 73c7298..6c195ea 100644 --- a/help/en_US/scilab_en_US_help/qpipoptmat.html +++ b/help/en_US/scilab_en_US_help/qpipoptmat.html @@ -70,32 +70,35 @@ <dd><p class="para">a vector of double, the computed solution of the optimization problem.</p></dd></dt> <dt><span class="term">fopt :</span> <dd><p class="para">a double, the function value at x.</p></dd></dt> + <dt><span class="term">residual :</span> + <dd><p class="para">a vector of double, solution residuals returned as the vector d-C*x.</p></dd></dt> <dt><span class="term">exitflag :</span> - <dd><p class="para">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.</p></dd></dt> + <dd><p class="para">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.</p></dd></dt> <dt><span class="term">output :</span> <dd><p class="para">Structure containing information about the optimization. This version only contains number of iterations.</p></dd></dt> <dt><span class="term">lambda :</span> - <dd><p class="para">Structure containing the Lagrange multipliers at the solution x (separated by constraint type).It contains lower, upper and linear equality, inequality constraints.</p></dd></dt></dl></div> + <dd><p class="para">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.</p></dd></dt></dl></div> <div class="refsection"><h3 class="title">Description</h3> - <p class="para">Search the minimum of a constrained linear quadratic optimization problem specified by : -find the minimum of f(x) such that</p> + <p class="para">Search the minimum of a constrained linear quadratic optimization problem specified by :</p> <p class="para"><span><img src='./_LaTeX_qpipoptmat.xml_1.png' style='position:relative;top:41px;width:277px;height:90px'/></span></p> <p class="para">The routine calls Ipopt for solving the quadratic problem, Ipopt is a library written in C++.</p> <p class="para"></p></div> <div class="refsection"><h3 class="title">Examples</h3> - <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">//Find the value of x that minimize following function</span> -<span class="scilabcomment">// f(x) = 0.5*x1^2 + x2^2 - x1*x2 - 2*x1 - 6*x2</span> -<span class="scilabcomment">// Subject to:</span> -<span class="scilabcomment">// x1 + x2 ≤ 2</span> -<span class="scilabcomment">// –x1 + 2x2 ≤ 2</span> -<span class="scilabcomment">// 2x1 + x2 ≤ 3</span> -<span class="scilabcomment">// 0 ≤ x1, 0 ≤ x2.</span> -<span class="scilabid">H</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">1</span> <span class="scilaboperator">-</span><span class="scilabnumber">1</span><span class="scilabdefault">;</span> <span class="scilaboperator">-</span><span class="scilabnumber">1</span> <span class="scilabnumber">2</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">f</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilaboperator">-</span><span class="scilabnumber">2</span><span class="scilabdefault">;</span> <span class="scilaboperator">-</span><span class="scilabnumber">6</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">A</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">1</span> <span class="scilabnumber">1</span><span class="scilabdefault">;</span> <span class="scilaboperator">-</span><span class="scilabnumber">1</span> <span class="scilabnumber">2</span><span class="scilabdefault">;</span> <span class="scilabnumber">2</span> <span class="scilabnumber">1</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">b</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">2</span><span class="scilabdefault">;</span> <span class="scilabnumber">2</span><span class="scilabdefault">;</span> <span class="scilabnumber">3</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> + <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">//Ref : example 14 :</span> +<span class="scilabcomment">//https://www.me.utexas.edu/~jensen/ORMM/supplements/methods/nlpmethod/S2_quadratic.pdf</span> +<span class="scilabcomment">// min. -8*x1*x1 -16*x2*x2 + x1 + 4*x2</span> +<span class="scilabcomment">// such that</span> +<span class="scilabcomment">// x1 + x2 </span><span class="scilabcomment"><</span><span class="scilabcomment">= 5,</span> +<span class="scilabcomment">// x1 </span><span class="scilabcomment"><</span><span class="scilabcomment">= 3,</span> +<span class="scilabcomment">// x1 </span><span class="scilabcomment">></span><span class="scilabcomment">= 0,</span> +<span class="scilabcomment">// x2 </span><span class="scilabcomment">></span><span class="scilabcomment">= 0</span> +<span class="scilabid">H</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">2</span> <span class="scilabnumber">0</span> +<span class="scilabnumber">0</span> <span class="scilabnumber">8</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">f</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilaboperator">-</span><span class="scilabnumber">8</span><span class="scilabdefault">;</span> <span class="scilaboperator">-</span><span class="scilabnumber">16</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">A</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">1</span> <span class="scilabnumber">1</span><span class="scilabdefault">;</span><span class="scilabnumber">1</span> <span class="scilabnumber">0</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">b</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">5</span><span class="scilabdefault">;</span><span class="scilabnumber">3</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> <span class="scilabid">lb</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">0</span><span class="scilabdefault">;</span> <span class="scilabnumber">0</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> <span class="scilabid">ub</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabconstants">%inf</span><span class="scilabdefault">;</span> <span class="scilabconstants">%inf</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> <span class="scilabopenclose">[</span><span class="scilabid">xopt</span><span class="scilabdefault">,</span><span class="scilabid">fopt</span><span class="scilabdefault">,</span><span class="scilabid">exitflag</span><span class="scilabdefault">,</span><span class="scilabid">output</span><span class="scilabdefault">,</span><span class="scilabid">lambda</span><span class="scilabopenclose">]</span> <span class="scilaboperator">=</span> <span class="scilabid">qpipoptmat</span><span class="scilabopenclose">(</span><span class="scilabid">H</span><span class="scilabdefault">,</span><span class="scilabid">f</span><span class="scilabdefault">,</span><span class="scilabid">A</span><span class="scilabdefault">,</span><span class="scilabid">b</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabid">lb</span><span class="scilabdefault">,</span><span class="scilabid">ub</span><span class="scilabopenclose">)</span> @@ -116,7 +119,7 @@ find the minimum of f(x) such that</p> <span class="scilabid">param</span> <span class="scilaboperator">=</span> <a class="scilabcommand" href="scilab://list">list</a><span class="scilabopenclose">(</span><span class="scilabstring">"</span><span class="scilabstring">MaxIter</span><span class="scilabstring">"</span><span class="scilabdefault">,</span> <span class="scilabnumber">300</span><span class="scilabdefault">,</span> <span class="scilabstring">"</span><span class="scilabstring">CpuTime</span><span class="scilabstring">"</span><span class="scilabdefault">,</span> <span class="scilabnumber">100</span><span class="scilabopenclose">)</span><span class="scilabdefault">;</span> <span class="scilabcomment">//and minimize 0.5*x</span><span class="scilabcomment">'</span><span class="scilabcomment">*H*x + f</span><span class="scilabcomment">'</span><span class="scilabcomment">*x with</span> <span class="scilabid">f</span><span class="scilaboperator">=</span><span class="scilabopenclose">[</span><span class="scilabnumber">1</span><span class="scilabdefault">;</span> <span class="scilabnumber">2</span><span class="scilabdefault">;</span> <span class="scilabnumber">3</span><span class="scilabdefault">;</span> <span class="scilabnumber">4</span><span class="scilabdefault">;</span> <span class="scilabnumber">5</span><span class="scilabdefault">;</span> <span class="scilabnumber">6</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> <span class="scilabid">H</span><span class="scilaboperator">=</span><a class="scilabcommand" href="scilab://eye">eye</a><span class="scilabopenclose">(</span><span class="scilabnumber">6</span><span class="scilabdefault">,</span><span class="scilabnumber">6</span><span class="scilabopenclose">)</span><span class="scilabdefault">;</span> -<span class="scilabopenclose">[</span><span class="scilabid">xopt</span><span class="scilabdefault">,</span><span class="scilabid">fopt</span><span class="scilabdefault">,</span><span class="scilabid">exitflag</span><span class="scilabdefault">,</span><span class="scilabid">output</span><span class="scilabdefault">,</span><span class="scilabid">lambda</span><span class="scilabopenclose">]</span><span class="scilaboperator">=</span><span class="scilabid">qpipoptmat</span><span class="scilabopenclose">(</span><span class="scilabid">H</span><span class="scilabdefault">,</span><span class="scilabid">f</span><span class="scilabdefault">,</span><span class="scilabid">A</span><span class="scilabdefault">,</span><span class="scilabid">b</span><span class="scilabdefault">,</span><span class="scilabid">Aeq</span><span class="scilabdefault">,</span><span class="scilabid">beq</span><span class="scilabdefault">,</span><span class="scilabid">lb</span><span class="scilabdefault">,</span><span class="scilabid">ub</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabid">param</span><span class="scilabopenclose">)</span></pre></td><td valign="top"><a href="scilab://scilab.execexample/"><img src="ScilabExecute.png" border="0"/></a></td><td valign="top"><a href="scilab://scilab.editexample/"><img src="ScilabEdit.png" border="0"/></a></td><td></td></tr></table></div></div> +<span class="scilabopenclose">[</span><span class="scilabid">xopt</span><span class="scilabdefault">,</span><span class="scilabid">fopt</span><span class="scilabdefault">,</span><span class="scilabid">exitflag</span><span class="scilabdefault">,</span><span class="scilabid">output</span><span class="scilabdefault">,</span><span class="scilabid">lambda</span><span class="scilabopenclose">]</span><span class="scilaboperator">=</span><span class="scilabid">qpipoptmat</span><span class="scilabopenclose">(</span><span class="scilabid">H</span><span class="scilabdefault">,</span><span class="scilabid">f</span><span class="scilabdefault">,</span><span class="scilabid">A</span><span class="scilabdefault">,</span><span class="scilabid">b</span><span class="scilabdefault">,</span><span class="scilabid">Aeq</span><span class="scilabdefault">,</span><span class="scilabid">beq</span><span class="scilabdefault">,</span><span class="scilabid">lb</span><span class="scilabdefault">,</span><span class="scilabid">ub</span><span class="scilabdefault">,</span><span class="scilabid">x0</span><span class="scilabdefault">,</span><span class="scilabid">param</span><span class="scilabopenclose">)</span></pre></td><td valign="top"><a href="scilab://scilab.execexample/"><img src="ScilabExecute.png" border="0"/></a></td><td valign="top"><a href="scilab://scilab.editexample/"><img src="ScilabEdit.png" border="0"/></a></td><td></td></tr></table></div></div> <div class="refsection"><h3 class="title">Authors</h3> <ul class="itemizedlist"><li class="member">Keyur Joshi, Saikiran, Iswarya, Harpreet Singh</li></ul></div> diff --git a/help/en_US/scilab_en_US_help/symphony.html b/help/en_US/scilab_en_US_help/symphony.html index b81bbb0..e374a30 100644 --- a/help/en_US/scilab_en_US_help/symphony.html +++ b/help/en_US/scilab_en_US_help/symphony.html @@ -70,19 +70,18 @@ <dt><span class="term">fopt :</span> <dd><p class="para">a double, the function value at x.</p></dd></dt> <dt><span class="term">status :</span> - <dd><p class="para">status flag from symphony. 227 is optimal, 228 is Time limit exceeded, 230 is iteration limit exceeded.</p></dd></dt> + <dd><p class="para">status flag returned from symphony. 227 is optimal, 228 is Time limit exceeded, 230 is iteration limit exceeded.</p></dd></dt> <dt><span class="term">output :</span> <dd><p class="para">The output data structure contains detailed information about the optimization process. This version only contains number of iterations</p></dd></dt></dl></div> <div class="refsection"><h3 class="title">Description</h3> - <p class="para">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</p> + <p class="para">Search the minimum or maximum of a constrained mixed integer linear programming optimization problem specified by :</p> <p class="para"><span><img src='./_LaTeX_symphony.xml_1.png' style='position:relative;top:41px;width:292px;height:90px'/></span></p> <p class="para">The routine calls SYMPHONY written in C by gateway files for the actual computation.</p> <p class="para"></p></div> <div class="refsection"><h3 class="title">Examples</h3> - <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">//A basic case :</span> + <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">//Reference: Westerberg, Carl-Henrik, Bengt Bjorklund, and Eskil Hultman. </span><span class="scilabcomment">"</span><span class="scilabcomment">An application of mixed integer programming in a Swedish steel mill.</span><span class="scilabcomment">"</span><span class="scilabcomment"> Interfaces 7, no. 2 (1977): 39-43.</span> <span class="scilabcomment">// Objective function</span> <span class="scilabid">c</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">350</span><span class="scilaboperator">*</span><span class="scilabnumber">5</span><span class="scilabdefault">,</span><span class="scilabnumber">330</span><span class="scilaboperator">*</span><span class="scilabnumber">3</span><span class="scilabdefault">,</span><span class="scilabnumber">310</span><span class="scilaboperator">*</span><span class="scilabnumber">4</span><span class="scilabdefault">,</span><span class="scilabnumber">280</span><span class="scilaboperator">*</span><span class="scilabnumber">6</span><span class="scilabdefault">,</span><span class="scilabnumber">500</span><span class="scilabdefault">,</span><span class="scilabnumber">450</span><span class="scilabdefault">,</span><span class="scilabnumber">400</span><span class="scilabdefault">,</span><span class="scilabnumber">100</span><span class="scilabopenclose">]</span><span class="scilaboperator">'</span><span class="scilabdefault">;</span> <span class="scilabcomment">// Lower Bound of variable</span> diff --git a/help/en_US/scilab_en_US_help/symphonymat.html b/help/en_US/scilab_en_US_help/symphonymat.html index fc60daf..203f2d4 100644 --- a/help/en_US/scilab_en_US_help/symphonymat.html +++ b/help/en_US/scilab_en_US_help/symphonymat.html @@ -67,19 +67,19 @@ <dt><span class="term">fopt :</span> <dd><p class="para">a double, the function value at x</p></dd></dt> <dt><span class="term">status :</span> - <dd><p class="para">status flag from symphony. 227 is optimal, 228 is Time limit exceeded, 230 is iteration limit exceeded.</p></dd></dt> + <dd><p class="para">status flag returned from symphony. 227 is optimal, 228 is Time limit exceeded, 230 is iteration limit exceeded.</p></dd></dt> <dt><span class="term">output :</span> <dd><p class="para">The output data structure contains detailed information about the optimization process. This version only contains number of iterations.</p></dd></dt></dl></div> <div class="refsection"><h3 class="title">Description</h3> - <p class="para">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</p> + <p class="para">Search the minimum or maximum of a constrained mixed integer linear programming optimization problem specified by :</p> <p class="para"><span><img src='./_LaTeX_symphonymat.xml_1.png' style='position:relative;top:51px;width:212px;height:110px'/></span></p> <p class="para">The routine calls SYMPHONY written in C by gateway files for the actual computation.</p> <p class="para"></p></div> <div class="refsection"><h3 class="title">Examples</h3> <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">// Objective function</span> +<span class="scilabcomment">// Reference: Westerberg, Carl-Henrik, Bengt Bjorklund, and Eskil Hultman. </span><span class="scilabcomment">"</span><span class="scilabcomment">An application of mixed integer programming in a Swedish steel mill.</span><span class="scilabcomment">"</span><span class="scilabcomment"> Interfaces 7, no. 2 (1977): 39-43.</span> <span class="scilabid">c</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">350</span><span class="scilaboperator">*</span><span class="scilabnumber">5</span><span class="scilabdefault">,</span><span class="scilabnumber">330</span><span class="scilaboperator">*</span><span class="scilabnumber">3</span><span class="scilabdefault">,</span><span class="scilabnumber">310</span><span class="scilaboperator">*</span><span class="scilabnumber">4</span><span class="scilabdefault">,</span><span class="scilabnumber">280</span><span class="scilaboperator">*</span><span class="scilabnumber">6</span><span class="scilabdefault">,</span><span class="scilabnumber">500</span><span class="scilabdefault">,</span><span class="scilabnumber">450</span><span class="scilabdefault">,</span><span class="scilabnumber">400</span><span class="scilabdefault">,</span><span class="scilabnumber">100</span><span class="scilabopenclose">]</span><span class="scilaboperator">'</span><span class="scilabdefault">;</span> <span class="scilabcomment">// Lower Bound of variable</span> <span class="scilabid">lb</span> <span class="scilaboperator">=</span> <a class="scilabmacro" href="scilab://repmat">repmat</a><span class="scilabopenclose">(</span><span class="scilabnumber">0</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabnumber">8</span><span class="scilabopenclose">)</span><span class="scilabdefault">;</span> diff --git a/help/en_US/symphony.xml b/help/en_US/symphony.xml index c0caa8e..da156ce 100644 --- a/help/en_US/symphony.xml +++ b/help/en_US/symphony.xml @@ -62,7 +62,7 @@ <varlistentry><term>fopt :</term> <listitem><para> a double, the function value at x.</para></listitem></varlistentry> <varlistentry><term>status :</term> - <listitem><para> status flag from symphony. 227 is optimal, 228 is Time limit exceeded, 230 is iteration limit exceeded.</para></listitem></varlistentry> + <listitem><para> status flag returned from symphony. 227 is optimal, 228 is Time limit exceeded, 230 is iteration limit exceeded.</para></listitem></varlistentry> <varlistentry><term>output :</term> <listitem><para> The output data structure contains detailed information about the optimization process. This version only contains number of iterations</para></listitem></varlistentry> </variablelist> @@ -72,7 +72,6 @@ <title>Description</title> <para> 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 </para> <para> <latex> @@ -95,7 +94,7 @@ The routine calls SYMPHONY written in C by gateway files for the actual computat <refsection> <title>Examples</title> <programlisting role="example"><![CDATA[ -//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 diff --git a/help/en_US/symphonymat.xml b/help/en_US/symphonymat.xml index cf95807..68ec072 100644 --- a/help/en_US/symphonymat.xml +++ b/help/en_US/symphonymat.xml @@ -59,7 +59,7 @@ <varlistentry><term>fopt :</term> <listitem><para> a double, the function value at x</para></listitem></varlistentry> <varlistentry><term>status :</term> - <listitem><para> status flag from symphony. 227 is optimal, 228 is Time limit exceeded, 230 is iteration limit exceeded.</para></listitem></varlistentry> + <listitem><para> status flag returned from symphony. 227 is optimal, 228 is Time limit exceeded, 230 is iteration limit exceeded.</para></listitem></varlistentry> <varlistentry><term>output :</term> <listitem><para> The output data structure contains detailed information about the optimization process. This version only contains number of iterations.</para></listitem></varlistentry> </variablelist> @@ -69,7 +69,6 @@ <title>Description</title> <para> 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 </para> <para> <latex> @@ -94,6 +93,7 @@ The routine calls SYMPHONY written in C by gateway files for the actual computat <title>Examples</title> <programlisting role="example"><![CDATA[ // 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); diff --git a/jar/scilab_en_US_help.jar b/jar/scilab_en_US_help.jar Binary files differindex 204eacb..4e1dc60 100644 --- a/jar/scilab_en_US_help.jar +++ b/jar/scilab_en_US_help.jar 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) diff --git a/sci_gateway/cpp/.sci_QuadNLP.cpp.swp b/sci_gateway/cpp/.sci_QuadNLP.cpp.swp Binary files differnew file mode 100644 index 0000000..764077c --- /dev/null +++ b/sci_gateway/cpp/.sci_QuadNLP.cpp.swp diff --git a/sci_gateway/cpp/QuadNLP.hpp b/sci_gateway/cpp/QuadNLP.hpp index ec40195..4020913 100644 --- a/sci_gateway/cpp/QuadNLP.hpp +++ b/sci_gateway/cpp/QuadNLP.hpp @@ -1,14 +1,13 @@ -/* - * Quadratic Programming Toolbox for Scilab using IPOPT library - * Authors : - Sai Kiran - Keyur Joshi - Iswarya - - - * Optimizing (minimizing) the quadratic objective function having any number of variables and linear constraints. - * -*/ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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, Sai Kiran, Keyur Joshi, Iswarya +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in #ifndef __QuadNLP_HPP__ #define __QuadNLP_HPP__ diff --git a/sci_gateway/cpp/builder_gateway_cpp.sce b/sci_gateway/cpp/builder_gateway_cpp.sce index 225edd8..6e4adf7 100644 --- a/sci_gateway/cpp/builder_gateway_cpp.sce +++ b/sci_gateway/cpp/builder_gateway_cpp.sce @@ -1,13 +1,13 @@ // Copyright (C) 2015 - IIT Bombay - FOSSEE // -// Author: Keyur Joshi, Sai Kiran, Iswarya and 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 mode(-1) lines(0) diff --git a/sci_gateway/cpp/globals.cpp b/sci_gateway/cpp/globals.cpp index 4b5d99c..92767bc 100644 --- a/sci_gateway/cpp/globals.cpp +++ b/sci_gateway/cpp/globals.cpp @@ -1,9 +1,14 @@ -/* - * Implementation Symphony Tool Box for Scilab - * globals.cpp - * contains definitions of global variables and functions - * By Keyur Joshi and Sai Kiran - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi and Sai Kiran +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include <symphony.h> #include <sciprint.h> diff --git a/sci_gateway/cpp/libsymphonytools.c b/sci_gateway/cpp/libsymphonytools.c deleted file mode 100644 index 1007284..0000000 --- a/sci_gateway/cpp/libsymphonytools.c +++ /dev/null @@ -1,144 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif -#include <mex.h> -#include <sci_gateway.h> -#include <api_scilab.h> -#include <MALLOC.h> -static int direct_gateway(char *fname,void F(void)) { F();return 0;}; -extern Gatefunc sci_sym_open; -extern Gatefunc sci_sym_close; -extern Gatefunc sci_sym_isEnvActive; -extern Gatefunc sci_sym_set_defaults; -extern Gatefunc sci_sym_set_int_param; -extern Gatefunc sci_sym_get_int_param; -extern Gatefunc sci_sym_set_dbl_param; -extern Gatefunc sci_sym_get_dbl_param; -extern Gatefunc sci_sym_set_str_param; -extern Gatefunc sci_sym_get_str_param; -extern Gatefunc sci_sym_getInfinity; -extern Gatefunc sci_sym_loadProblemBasic; -extern Gatefunc sci_sym_loadProblem; -extern Gatefunc sci_sym_load_mps; -extern Gatefunc sci_sym_get_num_int; -extern Gatefunc sci_sym_get_num_int; -extern Gatefunc sci_sym_get_num_int; -extern Gatefunc sci_sym_isContinuous; -extern Gatefunc sci_sym_isBinary; -extern Gatefunc sci_sym_isInteger; -extern Gatefunc sci_sym_set_continuous; -extern Gatefunc sci_sym_set_integer; -extern Gatefunc sci_sym_get_dbl_arr; -extern Gatefunc sci_sym_get_dbl_arr; -extern Gatefunc sci_sym_setVarBound; -extern Gatefunc sci_sym_setVarBound; -extern Gatefunc sci_sym_get_dbl_arr; -extern Gatefunc sci_sym_setObjCoeff; -extern Gatefunc sci_sym_getObjSense; -extern Gatefunc sci_sym_setObjSense; -extern Gatefunc sci_sym_get_dbl_arr; -extern Gatefunc sci_sym_get_dbl_arr; -extern Gatefunc sci_sym_get_dbl_arr; -extern Gatefunc sci_sym_get_dbl_arr; -extern Gatefunc sci_sym_setConstrBound; -extern Gatefunc sci_sym_setConstrBound; -extern Gatefunc sci_sym_setConstrType; -extern Gatefunc sci_sym_get_matrix; -extern Gatefunc sci_sym_get_row_sense; -extern Gatefunc sci_sym_addConstr; -extern Gatefunc sci_sym_addVar; -extern Gatefunc sci_sym_delete_cols; -extern Gatefunc sci_sym_delete_rows; -extern Gatefunc sci_sym_getPrimalBound; -extern Gatefunc sci_sym_setPrimalBound; -extern Gatefunc sci_sym_setColSoln; -extern Gatefunc sci_sym_solve; -extern Gatefunc sci_sym_get_status; -extern Gatefunc sci_sym_get_solver_status; -extern Gatefunc sci_sym_get_solver_status; -extern Gatefunc sci_sym_get_solver_status; -extern Gatefunc sci_sym_get_solver_status; -extern Gatefunc sci_sym_get_solver_status; -extern Gatefunc sci_sym_get_solver_status; -extern Gatefunc sci_sym_getVarSoln; -extern Gatefunc sci_sym_getObjVal; -extern Gatefunc sci_sym_get_iteration_count; -extern Gatefunc sci_sym_getRowActivity; -static GenericTable Tab[]={ - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_open,"sym_open"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_close,"sym_close"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_isEnvActive,"sym_isEnvActive"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_set_defaults,"sym_resetParams"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_set_int_param,"sym_setIntParam"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_int_param,"sym_getIntParam"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_set_dbl_param,"sym_setDblParam"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_param,"sym_getDblParam"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_set_str_param,"sym_setStrParam"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_str_param,"sym_getStrParam"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_getInfinity,"sym_getInfinity"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_loadProblemBasic,"sym_loadProblemBasic"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_loadProblem,"sym_loadProblem"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_load_mps,"sym_loadMPS"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_num_int,"sym_getNumConstr"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_num_int,"sym_getNumVar"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_num_int,"sym_getNumElements"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_isContinuous,"sym_isContinuous"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_isBinary,"sym_isBinary"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_isInteger,"sym_isInteger"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_set_continuous,"sym_setContinuous"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_set_integer,"sym_setInteger"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_arr,"sym_getVarLower"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_arr,"sym_getVarUpper"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setVarBound,"sym_setVarLower"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setVarBound,"sym_setVarUpper"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_arr,"sym_getObjCoeff"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setObjCoeff,"sym_setObjCoeff"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_getObjSense,"sym_getObjSense"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setObjSense,"sym_setObjSense"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_arr,"sym_getRhs"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_arr,"sym_getConstrRange"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_arr,"sym_getConstrLower"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_dbl_arr,"sym_getConstrUpper"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setConstrBound,"sym_setConstrLower"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setConstrBound,"sym_setConstrUpper"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setConstrType,"sym_setConstrType"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_matrix,"sym_getMatrix"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_row_sense,"sym_getConstrSense"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_addConstr,"sym_addConstr"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_addVar,"sym_addVar"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_delete_cols,"sym_deleteVars"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_delete_rows,"sym_deleteConstrs"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_getPrimalBound,"sym_getPrimalBound"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setPrimalBound,"sym_setPrimalBound"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_setColSoln,"sym_setVarSoln"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_solve,"sym_solve"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_status,"sym_getStatus"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_solver_status,"sym_isOptimal"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_solver_status,"sym_isInfeasible"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_solver_status,"sym_isAbandoned"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_solver_status,"sym_isIterLimitReached"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_solver_status,"sym_isTimeLimitReached"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_solver_status,"sym_isTargetGapAchieved"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_getVarSoln,"sym_getVarSoln"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_getObjVal,"sym_getObjVal"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_get_iteration_count,"sym_getIterCount"}, - {(Myinterfun)sci_gateway_without_putlhsvar,sci_sym_getRowActivity,"sym_getConstrActivity"}, -}; - -int C2F(libsymphonytools)() -{ - Rhs = Max(0, Rhs); - if (*(Tab[Fin-1].f) != NULL) - { - if(pvApiCtx == NULL) - { - pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx)); - } - pvApiCtx->pstName = (char*)Tab[Fin-1].name; - (*(Tab[Fin-1].f))(Tab[Fin-1].name,Tab[Fin-1].F); - } - return 0; -} -#ifdef __cplusplus -} -#endif diff --git a/sci_gateway/cpp/libsymphonytools.so b/sci_gateway/cpp/libsymphonytools.so Binary files differdeleted file mode 100755 index 31e63b1..0000000 --- a/sci_gateway/cpp/libsymphonytools.so +++ /dev/null diff --git a/sci_gateway/cpp/sci_QuadNLP.cpp b/sci_gateway/cpp/sci_QuadNLP.cpp index 50e8109..b1a0e04 100644 --- a/sci_gateway/cpp/sci_QuadNLP.cpp +++ b/sci_gateway/cpp/sci_QuadNLP.cpp @@ -1,10 +1,13 @@ -/* - * Quadratic Programming Toolbox for Scilab using IPOPT library - * Authors : - Sai Kiran - Keyur Joshi - Iswarya - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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, Sai Kiran, Keyur Joshi, Iswarya +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in #include "QuadNLP.hpp" #include "IpIpoptData.hpp" diff --git a/sci_gateway/cpp/sci_iofunc.cpp b/sci_gateway/cpp/sci_iofunc.cpp index 04b5639..e92c318 100644 --- a/sci_gateway/cpp/sci_iofunc.cpp +++ b/sci_gateway/cpp/sci_iofunc.cpp @@ -1,6 +1,14 @@ -// Symphony Toolbox for Scilab -// (Definition of) Functions for input and output from Scilab -// By Keyur Joshi +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi, Harpreet Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include "api_scilab.h" #include "Scierror.h" diff --git a/sci_gateway/cpp/sci_iofunc.hpp b/sci_gateway/cpp/sci_iofunc.hpp index 3833777..fc379f4 100644 --- a/sci_gateway/cpp/sci_iofunc.hpp +++ b/sci_gateway/cpp/sci_iofunc.hpp @@ -1,6 +1,13 @@ -// Symphony Toolbox for Scilab -// (Declaration of) Functions for input and output from Scilab -// By Keyur Joshi +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi, Harpreet Singh +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in #ifndef SCI_IOFUNCHEADER #define SCI_IOFUNCHEADER diff --git a/sci_gateway/cpp/sci_ipopt.cpp b/sci_gateway/cpp/sci_ipopt.cpp index 7094615..cbb71df 100644 --- a/sci_gateway/cpp/sci_ipopt.cpp +++ b/sci_gateway/cpp/sci_ipopt.cpp @@ -1,11 +1,13 @@ -/* - * Quadratic Programming Toolbox for Scilab using IPOPT library - * Authors : - Sai Kiran - Keyur Joshi - Iswarya - Harpreet Singh - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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, Sai Kiran, Keyur Joshi, Iswarya +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in #include "sci_iofunc.hpp" #include "IpIpoptApplication.hpp" diff --git a/sci_gateway/cpp/sci_solver_status_query_functions.cpp b/sci_gateway/cpp/sci_solver_status_query_functions.cpp index eb64bd1..2927717 100644 --- a/sci_gateway/cpp/sci_solver_status_query_functions.cpp +++ b/sci_gateway/cpp/sci_solver_status_query_functions.cpp @@ -1,9 +1,13 @@ -/* - * Implementation of Symphony Tool Box for Scilab - * solver_status_query_functions.cpp - * contains Solver Status Query Functions (7 functions) - * Author: Sai Kiran - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Sai Kiran +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in #include <symphony.h> #include <sci_iofunc.hpp> diff --git a/sci_gateway/cpp/sci_sym_addrowcol.cpp b/sci_gateway/cpp/sci_sym_addrowcol.cpp index 4e1d76e..7c852f9 100644 --- a/sci_gateway/cpp/sci_sym_addrowcol.cpp +++ b/sci_gateway/cpp/sci_sym_addrowcol.cpp @@ -1,8 +1,14 @@ -/* - * Symphony Toolbox - * Functions to add a new row or column - * By Keyur Joshi - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include "symphony.h" #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sci_sym_getinfinity.cpp b/sci_gateway/cpp/sci_sym_getinfinity.cpp index c7fe243..20937d0 100644 --- a/sci_gateway/cpp/sci_sym_getinfinity.cpp +++ b/sci_gateway/cpp/sci_sym_getinfinity.cpp @@ -1,8 +1,14 @@ -/* - * Symphony Toolbox - * Provides the Symphony infinity value - * By Keyur Joshi - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include "symphony.h" #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sci_sym_getobjsense.cpp b/sci_gateway/cpp/sci_sym_getobjsense.cpp index 3df325c..23b9291 100644 --- a/sci_gateway/cpp/sci_sym_getobjsense.cpp +++ b/sci_gateway/cpp/sci_sym_getobjsense.cpp @@ -1,8 +1,14 @@ -/* - * Symphony Toolbox - * <Description> - * <Author(s)> - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Sai Kiran, Keyur Joshi, Iswarya +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include "symphony.h" #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sci_sym_getrowact.cpp b/sci_gateway/cpp/sci_sym_getrowact.cpp index ebfd9ff..63b9e15 100644 --- a/sci_gateway/cpp/sci_sym_getrowact.cpp +++ b/sci_gateway/cpp/sci_sym_getrowact.cpp @@ -1,8 +1,14 @@ -/* - * Symphony Toolbox - * Function to get the row activity after solving - * By Keyur Joshi - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include "symphony.h" #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sci_sym_isenvactive.cpp b/sci_gateway/cpp/sci_sym_isenvactive.cpp index 96d5976..a0e3f55 100644 --- a/sci_gateway/cpp/sci_sym_isenvactive.cpp +++ b/sci_gateway/cpp/sci_sym_isenvactive.cpp @@ -1,8 +1,14 @@ -/* - * Symphony Toolbox - * Check if Symphony environment is active - * Made by Keyur Joshi - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include "symphony.h" #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sci_sym_load_mps.cpp b/sci_gateway/cpp/sci_sym_load_mps.cpp index 7f000fb..7c87b8b 100644 --- a/sci_gateway/cpp/sci_sym_load_mps.cpp +++ b/sci_gateway/cpp/sci_sym_load_mps.cpp @@ -1,9 +1,14 @@ -/* - * Implementation Symphony Tool Box for Scilab - * template.cpp - * contains function for loading .mps file to symphony - * By Iswarya - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Iswarya +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include <symphony.h> #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sci_sym_loadproblem.cpp b/sci_gateway/cpp/sci_sym_loadproblem.cpp index b732eeb..5294082 100644 --- a/sci_gateway/cpp/sci_sym_loadproblem.cpp +++ b/sci_gateway/cpp/sci_sym_loadproblem.cpp @@ -1,8 +1,15 @@ -/* - * Symphony Toolbox - * Explicit problem loaders - * Made by Keyur Joshi - */ + +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include "symphony.h" #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sci_sym_openclose.cpp b/sci_gateway/cpp/sci_sym_openclose.cpp index 4bab3e1..f77a98b 100644 --- a/sci_gateway/cpp/sci_sym_openclose.cpp +++ b/sci_gateway/cpp/sci_sym_openclose.cpp @@ -1,8 +1,14 @@ -/* - * Symphony Tool Box for Scilab - * contains functions that opens and closes the symphony environment - * By Keyur Joshi, Iswarya - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi, Iswarya +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include <symphony.h> #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sci_sym_primalbound.cpp b/sci_gateway/cpp/sci_sym_primalbound.cpp index 7e79d87..d5b4d3f 100644 --- a/sci_gateway/cpp/sci_sym_primalbound.cpp +++ b/sci_gateway/cpp/sci_sym_primalbound.cpp @@ -1,8 +1,14 @@ -/* - * Symphony Toolbox - * Functions for getting/setting the primal bound - * By Keyur Joshi - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include "symphony.h" #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sci_sym_remove.cpp b/sci_gateway/cpp/sci_sym_remove.cpp index be9c72b..0289064 100644 --- a/sci_gateway/cpp/sci_sym_remove.cpp +++ b/sci_gateway/cpp/sci_sym_remove.cpp @@ -1,9 +1,14 @@ -/* - * Implementation Symphony Tool Box for Scilab - * set_sym_remove.cpp - * contains function for removing columns and rows - * By Iswarya - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Iswarya +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include <symphony.h> extern sym_environment* global_sym_env;//defined in globals.cpp diff --git a/sci_gateway/cpp/sci_sym_rowmod.cpp b/sci_gateway/cpp/sci_sym_rowmod.cpp index ec966d0..3819d4e 100644 --- a/sci_gateway/cpp/sci_sym_rowmod.cpp +++ b/sci_gateway/cpp/sci_sym_rowmod.cpp @@ -1,8 +1,14 @@ -/* - * Symphony Toolbox - * Functions for modifying constraints - * By Keyur Joshi - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include "symphony.h" #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sci_sym_set_indices.cpp b/sci_gateway/cpp/sci_sym_set_indices.cpp index 6b8a35a..4e1577d 100644 --- a/sci_gateway/cpp/sci_sym_set_indices.cpp +++ b/sci_gateway/cpp/sci_sym_set_indices.cpp @@ -1,9 +1,14 @@ -/* - * Implementation Symphony Tool Box for Scilab - * sci_sym_set_indices.cpp - * contains functions for setting index variables as continuous and integer values - * By Iswarya - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Iswarya +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include <symphony.h> #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sci_sym_set_variables.cpp b/sci_gateway/cpp/sci_sym_set_variables.cpp index 384de6f..9368d69 100644 --- a/sci_gateway/cpp/sci_sym_set_variables.cpp +++ b/sci_gateway/cpp/sci_sym_set_variables.cpp @@ -1,9 +1,14 @@ -/* - * Implementation Symphony Tool Box for Scilab - * set_variables.cpp - * contains function for setting environment variables to their default and userdefined values in symphony - * By Iswarya - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Iswarya +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include <symphony.h> extern sym_environment* global_sym_env;//defined in globals.cpp diff --git a/sci_gateway/cpp/sci_sym_setcolsoln.cpp b/sci_gateway/cpp/sci_sym_setcolsoln.cpp index ca43779..aff6b4f 100644 --- a/sci_gateway/cpp/sci_sym_setcolsoln.cpp +++ b/sci_gateway/cpp/sci_sym_setcolsoln.cpp @@ -1,8 +1,14 @@ -/* - * Symphony Toolbox - * Function to set the solution to a known one - * By Keyur Joshi - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include "symphony.h" #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sci_sym_setobj.cpp b/sci_gateway/cpp/sci_sym_setobj.cpp index 3a4691a..571f752 100644 --- a/sci_gateway/cpp/sci_sym_setobj.cpp +++ b/sci_gateway/cpp/sci_sym_setobj.cpp @@ -1,8 +1,13 @@ -/* - * Symphony Toolbox - * Functions for setting the coefficients of the objective and the sense (minimization/maximization) - * By Keyur Joshi - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in #include "symphony.h" #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sci_sym_solution.cpp b/sci_gateway/cpp/sci_sym_solution.cpp index dff3b60..a918ac4 100644 --- a/sci_gateway/cpp/sci_sym_solution.cpp +++ b/sci_gateway/cpp/sci_sym_solution.cpp @@ -1,8 +1,14 @@ -/* - * Symphony Toolbox - * Provides the solution after the problem is solved - * By Keyur Joshi - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include "symphony.h" #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sci_sym_solve.cpp b/sci_gateway/cpp/sci_sym_solve.cpp index 4abb268..a0af480 100644 --- a/sci_gateway/cpp/sci_sym_solve.cpp +++ b/sci_gateway/cpp/sci_sym_solve.cpp @@ -1,8 +1,13 @@ -/* - * Implementation Symphony Tool Box for Scilab - * Contains sym_solve function - * Author : Sai Kiran - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Sai Kiran +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in #include <symphony.h> #include <sci_iofunc.hpp> diff --git a/sci_gateway/cpp/sci_sym_varbounds.cpp b/sci_gateway/cpp/sci_sym_varbounds.cpp index e0fa6ab..b650111 100644 --- a/sci_gateway/cpp/sci_sym_varbounds.cpp +++ b/sci_gateway/cpp/sci_sym_varbounds.cpp @@ -1,8 +1,14 @@ -/* - * Symphony Toolbox - * Functions for setting the upper and lower bounds of the variables - * By Keyur Joshi - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include "symphony.h" #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sci_vartype.cpp b/sci_gateway/cpp/sci_vartype.cpp index e6656a7..cc75735 100644 --- a/sci_gateway/cpp/sci_vartype.cpp +++ b/sci_gateway/cpp/sci_vartype.cpp @@ -1,8 +1,14 @@ -/* - * Symphony Toolbox - * Provides information about variables: is it continuous/integer/boolean? - * By Keyur Joshi - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Keyur Joshi +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + #include "symphony.h" #include "sci_iofunc.hpp" diff --git a/sci_gateway/cpp/sym_data_query_functions.cpp b/sci_gateway/cpp/sym_data_query_functions.cpp index 9f38094..ea9fe1b 100644 --- a/sci_gateway/cpp/sym_data_query_functions.cpp +++ b/sci_gateway/cpp/sym_data_query_functions.cpp @@ -1,9 +1,13 @@ -/* - * Implementation Symphony Tool Box for Scilab - * sym_data_query_functions.cpp - * contains Data Query Functions( 13 functions) - * Author: Sai Kiran - */ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// 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: Sai Kiran +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in #include <symphony.h> #include <sci_iofunc.hpp> diff --git a/sci_gateway/cpp/template.cpp b/sci_gateway/cpp/template.cpp deleted file mode 100644 index a835fc3..0000000 --- a/sci_gateway/cpp/template.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Symphony Toolbox - * <Description> - * <Author(s)> - */ -#include "symphony.h" -#include "sci_iofunc.hpp" - -extern sym_environment* global_sym_env; //defined in globals.cpp - -extern "C" { -#include "api_scilab.h" -#include "Scierror.h" -#include "sciprint.h" -#include "BOOL.h" -#include <localization.h> - -int sci_template(char *fname){ - - //error management variable - SciErr sciErr; - int iRet; - - //data declarations - - //ensure that environment is active - if(global_sym_env==NULL){ - sciprint("Error: Symphony environment not initialized. Please run 'sym_open()' first.\n"); - return 1; - } - - //code to check arguments and get them - CheckInputArgument(pvApiCtx, , ) ; - CheckOutputArgument(pvApiCtx, , ) ; - - //code to process input - - //code to give output - - return 0; -} - -} diff --git a/tests/general_tests/lsqlin/lsqlin_A1.sce b/tests/general_tests/lsqlin/lsqlin_A1.sce index ba9b5be..1c2128b 100644 --- a/tests/general_tests/lsqlin/lsqlin_A1.sce +++ b/tests/general_tests/lsqlin/lsqlin_A1.sce @@ -1,23 +1,17 @@ // Check for elements in A -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 - 0.1987 0.1988 0.4450 0.4186 0 - 0.6037 0.0152 0.9318 0.8462 0]; -b = [0.5251 - 0.2026 - 0.6721]; +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +A = [10 -2 0; + -2 10 0]; +b = [4 + -4]; //Error -//lsqlin: The number of columns in A must be the same as the number of elements of d +//lsqlin: The number of columns in A must be the same as the number of columns in C //at line 213 of function lsqlin called by : //[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b) diff --git a/tests/general_tests/lsqlin/lsqlin_Aeq1.sce b/tests/general_tests/lsqlin/lsqlin_Aeq1.sce index 458cbb0..f574e9d 100644 --- a/tests/general_tests/lsqlin/lsqlin_Aeq1.sce +++ b/tests/general_tests/lsqlin/lsqlin_Aeq1.sce @@ -1,23 +1,18 @@ // Check for elements in Aeq -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]; -Aeq = [0.2027 0.2721 0.7467 0.4659 0 - 0.1987 0.1988 0.4450 0.4186 0 - 0.6037 0.0152 0.9318 0.8462 0]; -beq = [0.5251 - 0.2026 - 0.6721]; + C = [2 0; + -1 1; + 0 2] + d = [1 + 0 + -1]; + Aeq = [10 -2 0; + -2 10 0]; + beq = [4 + -4]; + //Error -//lsqlin: The number of columns in Aeq must be the same as the number of elements of d +//lsqlin: The number of columns in Aeq must be the same as the number of columns in C //at line 219 of function lsqlin called by : //[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,[],[],Aeq,beq) diff --git a/tests/general_tests/lsqlin/lsqlin_C1.sce b/tests/general_tests/lsqlin/lsqlin_C1.sce index 55fe976..6da1d49 100644 --- a/tests/general_tests/lsqlin/lsqlin_C1.sce +++ b/tests/general_tests/lsqlin/lsqlin_C1.sce @@ -1,21 +1,13 @@ // Check for elements in C and d -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 - 0.2536]; -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]; +A = [10 -2; + -2 10]; +b = [4 + -4]; //Error //lsqlin: The number of rows in C must be equal the number of elements of d diff --git a/tests/general_tests/lsqlin/lsqlin_b1.sce b/tests/general_tests/lsqlin/lsqlin_b1.sce index 49b6dec..fb01b79 100644 --- a/tests/general_tests/lsqlin/lsqlin_b1.sce +++ b/tests/general_tests/lsqlin/lsqlin_b1.sce @@ -1,18 +1,13 @@ // Check for elements in b -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 = [-%inf -%inf -%inf]; +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +A = [10 -2; + -2 10]; +b = [-%inf -%inf]; //Error //lsqlin: Value of b can not be negative infinity diff --git a/tests/general_tests/lsqlin/lsqlin_beq1.sce b/tests/general_tests/lsqlin/lsqlin_beq1.sce index b71486e..38056c0 100644 --- a/tests/general_tests/lsqlin/lsqlin_beq1.sce +++ b/tests/general_tests/lsqlin/lsqlin_beq1.sce @@ -1,18 +1,13 @@ // Check for elements in beq -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]; -Aeq = [0.2027 0.2721 0.7467 0.4659 - 0.1987 0.1988 0.4450 0.4186 - 0.6037 0.0152 0.9318 0.8462]; -beq = [-%inf -%inf -%inf]; +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +Aeq = [10 -2; + -2 10]; +beq = [-%inf -%inf]; //Error //lsqlin: Value of beq can not be negative infinity diff --git a/tests/general_tests/lsqlin/lsqlin_infeasible1.sce b/tests/general_tests/lsqlin/lsqlin_infeasible1.sce index a66dd0f..9509309 100644 --- a/tests/general_tests/lsqlin/lsqlin_infeasible1.sce +++ b/tests/general_tests/lsqlin/lsqlin_infeasible1.sce @@ -1,15 +1,11 @@ // Check for the infeasible problem -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]; -Aeq = [-1 0 0 0; 0 -1 0 0; 1 1 0 0 ]; +C = [2 0 0; + -1 1 0; + 0 2 0] +d = [1 + 0 + -1]; +Aeq = [-1 0 0; 0 -1 0; 1 1 0 ]; beq = [-6 -6 11]; //Converged to a point of local infeasibility. @@ -27,17 +23,14 @@ beq = [-6 -6 11]; // 5 // residual = // -// 0.0578 -// 0.3528 -// 0.8131 -// 0.0098 -// 0.1388 +// 1. +// 0. +// - 1. // resnorm = // -// 0.8083018 +// 2. // xopt = // // [] - [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,[],[],Aeq,beq) diff --git a/tests/general_tests/lsqlin/lsqlin_input1.sce b/tests/general_tests/lsqlin/lsqlin_input1.sce index 7521f61..5b97670 100644 --- a/tests/general_tests/lsqlin/lsqlin_input1.sce +++ b/tests/general_tests/lsqlin/lsqlin_input1.sce @@ -1,21 +1,14 @@ // Check for the input arguments -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]; //Error //lsqlin: Unexpected number of input arguments : 2 provided while should be in the set of [4 6 8 9 10] //at line 99 of function lsqlin called by : diff --git a/tests/general_tests/lsqlin/lsqlin_input2.sce b/tests/general_tests/lsqlin/lsqlin_input2.sce index 9826583..dbfe187 100644 --- a/tests/general_tests/lsqlin/lsqlin_input2.sce +++ b/tests/general_tests/lsqlin/lsqlin_input2.sce @@ -1,20 +1,14 @@ // Check for the input arguments -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]; //Error //lsqlin: Unexpected number of input arguments : 14 provided while should be in the set of [4 6 8 9 10] diff --git a/tests/general_tests/lsqlin/lsqlin_logical1.sce b/tests/general_tests/lsqlin/lsqlin_logical1.sce index bc0dc06..959cc7c 100644 --- a/tests/general_tests/lsqlin/lsqlin_logical1.sce +++ b/tests/general_tests/lsqlin/lsqlin_logical1.sce @@ -1,51 +1,41 @@ -// Check for elements in A -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]; +// An example with inequality constraints +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +A = [10 -2; + -2 10]; +b = [4 + -4]; -// Output +//Output //Optimal Solution Found. // lambda = // -// lower: [0,0,0,0] -// upper: [0,0,0,0] +// lower: [0,0] +// upper: [0,0] // eqlin: [0x0 constant] -// ineqlin: [8.697D-11,0.0925859,0.1118582] +// ineqlin: [0.0000422,0.0000089] // output = // -// Iterations: 7 +// Iterations: 13 // exitflag = // // 0 // residual = // -// 0.0126031 -// 0.0208054 -// 0.1295085 -// 0.0057397 -// - 0.0137246 +// 0.3335021 +// 0.6666002 +// - 0.3332976 // resnorm = // -// 0.0175855 +// 0.6666667 // xopt = // -// 0.1298639 -// - 0.5756958 -// 0.4251033 -// 0.2438436 +// 0.3332490 +// - 0.3333512 [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b) diff --git a/tests/general_tests/lsqlin/lsqlin_maxiter.sce b/tests/general_tests/lsqlin/lsqlin_maxiter.sce new file mode 100644 index 0000000..036cf39 --- /dev/null +++ b/tests/general_tests/lsqlin/lsqlin_maxiter.sce @@ -0,0 +1,42 @@ +// Check for maxiter +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +A = [10 -2; + -2 10]; +b = [4 + -4]; +options = list("MaxIter",1); +// Output +//Maximum Number of Iterations Exceeded. Output may not be optimal. +// lambda = +// +// lower: [0x0 constant] +// upper: [0x0 constant] +// eqlin: [0x0 constant] +// ineqlin: [0x0 constant] +// output = +// +// Iterations: 1 +// exitflag = +// +// 1 +// residual = +// +// 1.0243179 +// 0.3941271 +// - 0.1874278 +// resnorm = +// +// 1.2396926 +// xopt = +// +// - 0.0121590 +// - 0.4062861 + +[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,[],[],[],[],[],options) + + diff --git a/tests/general_tests/lsqlin/lsqlin_param1.sce b/tests/general_tests/lsqlin/lsqlin_param1.sce index a9d24bc..65aff86 100644 --- a/tests/general_tests/lsqlin/lsqlin_param1.sce +++ b/tests/general_tests/lsqlin/lsqlin_param1.sce @@ -1,20 +1,14 @@ // Check for the param to be a list -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]; param = 0; //Error diff --git a/tests/general_tests/lsqlin/lsqlin_param2.sce b/tests/general_tests/lsqlin/lsqlin_param2.sce index bb7cffa..f780759 100644 --- a/tests/general_tests/lsqlin/lsqlin_param2.sce +++ b/tests/general_tests/lsqlin/lsqlin_param2.sce @@ -1,20 +1,14 @@ // Check for the param to be even in number -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]; param = list("MaxIter"); //Error diff --git a/tests/general_tests/lsqlin/lsqlin_param3.sce b/tests/general_tests/lsqlin/lsqlin_param3.sce index 60e960d..283c6e2 100644 --- a/tests/general_tests/lsqlin/lsqlin_param3.sce +++ b/tests/general_tests/lsqlin/lsqlin_param3.sce @@ -1,20 +1,14 @@ // Check for the param to be even in number -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]; param = list("Iter",300); //Error diff --git a/tests/general_tests/lsqlin/lsqlin_x01.sce b/tests/general_tests/lsqlin/lsqlin_x01.sce index 3b0f6f9..d014443 100644 --- a/tests/general_tests/lsqlin/lsqlin_x01.sce +++ b/tests/general_tests/lsqlin/lsqlin_x01.sce @@ -1,20 +1,14 @@ -// Check for elements in A -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]; +// Test for intial guess +C = [2 0; + -1 1; + 0 2] +d = [1 + 0 + -1]; +A = [10 -2; + -2 10]; +b = [4 + -4]; x0 = [0 0 0]; //WARNING: lsqlin: Ignoring initial guess of variables as it is not equal to the number of variables @@ -22,32 +16,28 @@ x0 = [0 0 0]; //Optimal Solution Found. // lambda = // -// lower: [0,0,0,0] -// upper: [0,0,0,0] +// lower: [0,0] +// upper: [0,0] // eqlin: [0x0 constant] -// ineqlin: [8.697D-11,0.0925859,0.1118582] +// ineqlin: [0.0000422,0.0000089] // output = // -// Iterations: 7 +// Iterations: 13 // exitflag = // // 0 // residual = // -// 0.0126031 -// 0.0208054 -// 0.1295085 -// 0.0057397 -// - 0.0137246 +// 0.3335021 +// 0.6666002 +// - 0.3332976 // resnorm = // -// 0.0175855 +// 0.6666667 // xopt = // -// 0.1298639 -// - 0.5756958 -// 0.4251033 -// 0.2438436 +// 0.3332490 +// - 0.3333512 [xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,[],[],[],[],x0) diff --git a/tests/general_tests/lsqlin/lsqlin_zeros.sce b/tests/general_tests/lsqlin/lsqlin_zeros.sce new file mode 100644 index 0000000..2695ff1 --- /dev/null +++ b/tests/general_tests/lsqlin/lsqlin_zeros.sce @@ -0,0 +1,32 @@ +// Check for all zeros +C = [0]; +d = [0]; +A = [0]; +b = [0]; +// Output +//Optimal Solution Found. +// lambda = +// +// lower: 0 +// upper: 0 +// eqlin: [0x0 constant] +// ineqlin: 0.999901 +// output = +// +// Iterations: 2 +// exitflag = +// +// 0 +// residual = +// +// 0. +// resnorm = +// +// 0. +// xopt = +// +// 0. + +[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b) + + diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_C.sce b/tests/general_tests/lsqnonneg/lsqnonneg_C.sce index f792559..90f5b43 100644 --- a/tests/general_tests/lsqnonneg/lsqnonneg_C.sce +++ b/tests/general_tests/lsqnonneg/lsqnonneg_C.sce @@ -1,15 +1,13 @@ // Check for the size of C and d -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 - 0.2356]; +C = [1 1 1; + 1 1 0; + 0 1 1; + 1 0 0; + 0 0 1] +d = [89; + 67; + 53; + 35] // Error //lsqlin: The number of rows in C must be equal the number of elements of d diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_input1.sce b/tests/general_tests/lsqnonneg/lsqnonneg_input1.sce index eb0aafc..db1e461 100644 --- a/tests/general_tests/lsqnonneg/lsqnonneg_input1.sce +++ b/tests/general_tests/lsqnonneg/lsqnonneg_input1.sce @@ -1,14 +1,14 @@ // Check for the input arguments -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] // Error //lsqlin: Unexpected number of input arguments : 1 provided while should be in the set of [2 3] diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_input2.sce b/tests/general_tests/lsqnonneg/lsqnonneg_input2.sce index 2d2e557..9da3f66 100644 --- a/tests/general_tests/lsqnonneg/lsqnonneg_input2.sce +++ b/tests/general_tests/lsqnonneg/lsqnonneg_input2.sce @@ -1,14 +1,14 @@ // Check for the input arguments -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] param = list(); x0 = [0 0]; diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_logical.sce b/tests/general_tests/lsqnonneg/lsqnonneg_logical.sce index 15106f0..5f59f8c 100644 --- a/tests/general_tests/lsqnonneg/lsqnonneg_logical.sce +++ b/tests/general_tests/lsqnonneg/lsqnonneg_logical.sce @@ -1,40 +1,42 @@ // An example with C and d as input -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] //Output //Optimal Solution Found. // lambda = // -// lower: [0.1506118,1.441D-11] -// upper: [0,0] +// lower: [5.131D-09,5.546D-09,8.739D-09] +// upper: [0,0,0] // output = // -// Iterations: 5 +// Iterations: 7 // exitflag = // // 0 // residual = // -// 0.6598971 -// - 0.3118739 -// - 0.3580375 -// 0.4129595 +// 0.75 +// - 0.625 +// - 0.125 +// - 0.125 +// - 0.625 // resnorm = // -// 0.8314560 +// 1.375 // xopt = // -// 0. -// 0.6929344 +// 35.125 +// 32.5 +// 20.625 [xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d) diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_maxiter.sce b/tests/general_tests/lsqnonneg/lsqnonneg_maxiter.sce new file mode 100644 index 0000000..fa61c73 --- /dev/null +++ b/tests/general_tests/lsqnonneg/lsqnonneg_maxiter.sce @@ -0,0 +1,42 @@ +// Check for maxiter +C = [1 1 1; + 1 1 0; + 0 1 1; + 1 0 0; + 0 0 1] +d = [89; + 67; + 53; + 35; + 20] +options = list("MaxIter",1) +//Output +//Maximum Number of Iterations Exceeded. Output may not be optimal. +// lambda = +// +// lower: [0x0 constant] +// upper: [0x0 constant] +// output = +// +// Iterations: 1 +// exitflag = +// +// 1 +// residual = +// +// 83.449663 +// 63.182327 +// 49.319768 +// 33.129895 +// 18.267336 +// resnorm = +// +// 14819.578 +// xopt = +// +// 1.8701046 +// 1.9475681 +// 1.7326638 + +[xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d,options) + diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_param1.sce b/tests/general_tests/lsqnonneg/lsqnonneg_param1.sce index d91f4b1..9809964 100644 --- a/tests/general_tests/lsqnonneg/lsqnonneg_param1.sce +++ b/tests/general_tests/lsqnonneg/lsqnonneg_param1.sce @@ -1,14 +1,14 @@ // Check for the parameters to be a list -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] param = 0; diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_param2.sce b/tests/general_tests/lsqnonneg/lsqnonneg_param2.sce index 557a836..9cbaa72 100644 --- a/tests/general_tests/lsqnonneg/lsqnonneg_param2.sce +++ b/tests/general_tests/lsqnonneg/lsqnonneg_param2.sce @@ -1,14 +1,14 @@ // Check for the size of parameters -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] param = list("MaxIter"); diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_zeros.sce b/tests/general_tests/lsqnonneg/lsqnonneg_zeros.sce new file mode 100644 index 0000000..e454f42 --- /dev/null +++ b/tests/general_tests/lsqnonneg/lsqnonneg_zeros.sce @@ -0,0 +1,28 @@ +// Check for all zeros as input +C = [0]; +d = [0]; + +//Output +//Optimal Solution Found. +// lambda = +// +// lower: 6.400D-11 +// upper: 0 +// output = +// +// Iterations: 3 +// exitflag = +// +// 0 +// residual = +// +// 0. +// resnorm = +// +// 0. +// xopt = +// +// 0.9124275 + +[xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d) + diff --git a/tests/general_tests/qpipopt/qpipopt_logical_2.sce b/tests/general_tests/qpipopt/qpipopt_logical_2.sce index a61e416..7a75ebe 100644 --- a/tests/general_tests/qpipopt/qpipopt_logical_2.sce +++ b/tests/general_tests/qpipopt/qpipopt_logical_2.sce @@ -1,4 +1,3 @@ - // A simple example without constraints A= []; conLB=[]; diff --git a/tests/general_tests/qpipopt/qpipopt_maxiter.sce b/tests/general_tests/qpipopt/qpipopt_maxiter.sce new file mode 100644 index 0000000..5851630 --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_maxiter.sce @@ -0,0 +1,46 @@ +//Find x in R^6 such that: +// A simple example with constraints +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", 1); + +//Output +//Maximum Number of Iterations Exceeded. Output may not be optimal. +// lambda = +// +// lower: [0x0 constant] +// upper: [0x0 constant] +// constraint: [0x0 constant] +// output = +// +// Iterations: 1 +// exitflag = +// +// 1 +// fopt = +// +// - 9.9784864 +// xopt = +// +// 0.9103357 +// - 0.1104630 +// 0.0476471 +// - 2.0070896 +// 0.2116560 +// - 1.1624291 + +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0,param) + + diff --git a/tests/general_tests/qpipopt/qpipopt_zeros.sce b/tests/general_tests/qpipopt/qpipopt_zeros.sce new file mode 100644 index 0000000..9604c4d --- /dev/null +++ b/tests/general_tests/qpipopt/qpipopt_zeros.sce @@ -0,0 +1,42 @@ + +// A simple example without constraints and all values to zero +A= []; +conLB=[]; +conUB = []; +lb=[]; +ub=[]; +f=[0]'; +H =[0]; +nbVar = 1; +nbCon = 0; + + +//Output +// +//Optimal Solution Found. + +// lower: 0 +// upper: 0 +// constraint: [0x0 constant] +// +// lambda +// +// Iterations: 0 +// +// output +// +// 0 +// +// exitflag +// +// 0. +// +// fopt +// +// 0. +// +// xopt + +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB) + + diff --git a/tests/general_tests/qpipoptmat/qpipoptmat_logical2.sce b/tests/general_tests/qpipoptmat/qpipoptmat_logical2.sce index 9f11d1d..e316253 100644 --- a/tests/general_tests/qpipoptmat/qpipoptmat_logical2.sce +++ b/tests/general_tests/qpipoptmat/qpipoptmat_logical2.sce @@ -11,7 +11,7 @@ b = [-1; 2.5]; lb=[-1000; -10000; 0; -1000; -1000; -1000]; ub=[10000; 100; 1.5; 100; 100; 1000]; param = list("MaxIter", 300, "CpuTime",100); -//and minimize 0.5*x'*Q*x + p'*x with +//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); diff --git a/tests/general_tests/qpipoptmat/qpipoptmat_maxiter.sce b/tests/general_tests/qpipoptmat/qpipoptmat_maxiter.sce new file mode 100644 index 0000000..5e4b0e5 --- /dev/null +++ b/tests/general_tests/qpipoptmat/qpipoptmat_maxiter.sce @@ -0,0 +1,44 @@ +//Find x in R^6 such that: +// A simple example with constraints + +Aeq= [1,-1,1,0,3,1; +-1,0,-3,-4,5,6; +2,5,3,0,1,0]; +beq=[1; 2; 3]; +A= [0,1,0,1,2,-1; +-1,0,2,1,1,0]; +b = [-1; 2.5]; +lb=[-1000; -10000; 0; -1000; -1000; -1000]; +ub=[10000; 100; 1.5; 100; 100; 1000]; +param = list("MaxIter", 1); +//and minimize 0.5*x'*H*x + f'*x with +f=[1; 2; 3; 4; 5; 6]; H=eye(6,6); + +//Output +// +//Maximum Number of Iterations Exceeded. Output may not be optimal. +// lambda = +// +// lower: [0x0 constant] +// upper: [0x0 constant] +// eqlin: [0x0 constant] +// ineqlin: [0x0 constant] +// output = +// +// Iterations: 1 +// exitflag = +// +// 1 +// fopt = +// +// - 9.9784864 +// xopt = +// +// 0.9103357 +// - 0.1104630 +// 0.0476471 +// - 2.0070896 +// 0.2116560 +// - 1.1624291 +[xopt,fopt,exitflag,output,lambda]=qpipoptmat(H,f,A,b,Aeq,beq,lb,ub,[],param) + diff --git a/tests/general_tests/qpipoptmat/qpipoptmat_zeros.sce b/tests/general_tests/qpipoptmat/qpipoptmat_zeros.sce new file mode 100644 index 0000000..ee9cfc9 --- /dev/null +++ b/tests/general_tests/qpipoptmat/qpipoptmat_zeros.sce @@ -0,0 +1,35 @@ +// A simple example without constraints + +f=[0]'; +H =[0]; + +//Output +// +//Optimal Solution Found. +// +// lower: 0 +// upper: 0 +// eqlin: [0x0 constant] +// ineqlin: [0x0 constant] +// +// lambda +// +// Iterations: 0 +// +// output +// +// 0 +// +// exitflag +// +// 0. +// +// fopt +// +// 0. +// +// xopt + + +[xopt,fopt,exitflag,output,lambda]=qpipoptmat(H,f); + diff --git a/tests/general_tests/symphony/symphony_logical2.sce b/tests/general_tests/symphony/symphony_logical2.sce index 5d0989f..9f34cc0 100644 --- a/tests/general_tests/symphony/symphony_logical2.sce +++ b/tests/general_tests/symphony/symphony_logical2.sce @@ -12,9 +12,9 @@ ub = repmat(%inf,3,1); // Constraint Matrix A = [3,2,5; - 2,1,1; - 1,1,3; - 5,2,4] + 2,1,1; + 1,1,3; + 5,2,4] // Lower Bound of constrains conlb = repmat(-%inf,4,1) diff --git a/tests/general_tests/symphony/symphony_zeros.sce b/tests/general_tests/symphony/symphony_zeros.sce new file mode 100644 index 0000000..a6615f6 --- /dev/null +++ b/tests/general_tests/symphony/symphony_zeros.sce @@ -0,0 +1,46 @@ +// Check for size of Objective Coefficient +// A basic case : + +// Objective function +c = [0 0 0]'; + +// Lower Bound of variable +lb = []; + +// Upper Bound of variables +ub = []; + +// Constraint Matrix +A = [] + +// Lower Bound of constrains +conlb = [] + +// Upper Bound of constrains +conub = [] + +// Row Matrix for telling symphony that the is integer or not +isInt = [repmat(%f,1,3)]; + +// Output +//Problem loaded into environment. +//Note: There is no limit on time. +//An optimal solution has been found. +// output = +// +// Iterations: 1 +// status = +// +// 227. +// f = +// +// 0. +// x = +// +// 0. +// 0. +// 0. + +// Calling Symphony +[x,f,status,output] = symphony(3,0,c,isInt,lb,ub,A,conlb,conub,-1) + diff --git a/thirdparty/linux/include/coin/.IpIpoptCalculatedQuantities.hpp.swp b/thirdparty/linux/include/coin/.IpIpoptCalculatedQuantities.hpp.swp Binary files differnew file mode 100644 index 0000000..3e69b30 --- /dev/null +++ b/thirdparty/linux/include/coin/.IpIpoptCalculatedQuantities.hpp.swp |