diff options
25 files changed, 442 insertions, 235 deletions
diff --git a/demos/symphony.dem.sce b/demos/symphony.dem.sce index 627c857..c17c14d 100644 --- a/demos/symphony.dem.sce +++ b/demos/symphony.dem.sce @@ -5,11 +5,11 @@ mode(1) //A basic case : // Objective function -c = [350*5,330*3,310*4,280*6,500,450,400,100] +c = [350*5,330*3,310*4,280*6,500,450,400,100]'; // Lower Bound of variable -lb = repmat(0,1,8); +lb = repmat(0,8,1); // Upper Bound of variables -ub = [repmat(1,1,4) repmat(%inf,1,4)]; +ub = [repmat(1,4,1);repmat(%inf,4,1)]; // Constraint Matrix conMatrix = [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; @@ -42,7 +42,7 @@ p = [ 504 803 667 1103 834 585 811 856 690 832 846 813 868 793 .. 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] +1162 653 814 625 599 476 767 954 906 904 649 873 565 853 1008 632]'; //Constraint Matrix conMatrix = [ //Constraint 1 @@ -89,9 +89,9 @@ conMatrix = [ nbCon = size(conMatrix,1) nbVar = size(conMatrix,2) // Lower Bound of variables -lb = repmat(0,1,nbVar) +lb = repmat(0,nbVar,1) // Upper Bound of variables -ub = repmat(1,1,nbVar) +ub = repmat(1,nbVar,1) // Row Matrix for telling symphony that the is integer or not isInt = repmat(%t,1,nbVar) // Lower Bound of constrains diff --git a/demos/symphonymat.dem.sce b/demos/symphonymat.dem.sce index 441eb51..f069d38 100644 --- a/demos/symphonymat.dem.sce +++ b/demos/symphonymat.dem.sce @@ -4,7 +4,7 @@ mode(1) // // Objective function -c = [350*5,330*3,310*4,280*6,500,450,400,100] +c = [350*5,330*3,310*4,280*6,500,450,400,100]' // Lower Bound of variable lb = repmat(0,1,8); // Upper Bound of variables @@ -35,8 +35,9 @@ objCoef = -1*[ 504 803 667 1103 834 585 811 856 690 832 846 813 868 793 .. 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 +1162 653 814 625 599 476 767 954 906 904 649 873 565 853 1008 632]'; +//Constraint Matrix + conMatrix = [ //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 .. @@ -78,14 +79,14 @@ conMatrix = [ //Constraint 1 483 336 765 637 981 980 202 35 594 689 602 76 767 693 .. 893 160 785 311 417 748 375 362 617 553 474 915 457 261 350 635 ; ]; -nbVar = size(objCoef,2) +nbVar = size(objCoef,1) conUB=[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 = [] +intcon = []; for i = 1:nbVar intcon = [intcon i]; end diff --git a/help/en_US/qpipopt.xml b/help/en_US/qpipopt.xml index aecbe40..2edd0ec 100644 --- a/help/en_US/qpipopt.xml +++ b/help/en_US/qpipopt.xml @@ -36,31 +36,31 @@ <title>Parameters</title> <variablelist> <varlistentry><term>nbVar :</term> - <listitem><para> a 1 x 1 matrix of doubles, number of variables</para></listitem></varlistentry> + <listitem><para> a double, number of variables</para></listitem></varlistentry> <varlistentry><term>nbCon :</term> - <listitem><para> a 1 x 1 matrix of doubles, number of constraints</para></listitem></varlistentry> + <listitem><para> a double, number of constraints</para></listitem></varlistentry> <varlistentry><term>Q :</term> - <listitem><para> a n x n symmetric matrix of doubles, where n is number of variables, represents coefficients of quadratic in the quadratic problem.</para></listitem></varlistentry> + <listitem><para> a symmetric matrix of doubles, represents coefficients of quadratic in the quadratic problem.</para></listitem></varlistentry> <varlistentry><term>p :</term> - <listitem><para> a n x 1 matrix of doubles, where n is number of variables, represents coefficients of linear in the quadratic problem</para></listitem></varlistentry> + <listitem><para> a vector of doubles, represents coefficients of linear in the quadratic problem</para></listitem></varlistentry> <varlistentry><term>LB :</term> - <listitem><para> a n x 1 matrix of doubles, where n is number of variables, contains lower bounds of the variables.</para></listitem></varlistentry> + <listitem><para> a vector of doubles, contains lower bounds of the variables.</para></listitem></varlistentry> <varlistentry><term>UB :</term> - <listitem><para> a n x 1 matrix of doubles, where n is number of variables, contains upper bounds of the variables.</para></listitem></varlistentry> + <listitem><para> a vector of doubles, where n is number of variables, contains upper bounds of the variables.</para></listitem></varlistentry> <varlistentry><term>conMatrix :</term> - <listitem><para> a m x n matrix of doubles, where n is number of variables and m is number of constraints, contains matrix representing the constraint matrix</para></listitem></varlistentry> + <listitem><para> a matrix of doubles, contains matrix representing the constraint matrix</para></listitem></varlistentry> <varlistentry><term>conLB :</term> - <listitem><para> a m x 1 matrix of doubles, where m is number of constraints, contains lower bounds of the constraints.</para></listitem></varlistentry> + <listitem><para> a vector of doubles, contains lower bounds of the constraints.</para></listitem></varlistentry> <varlistentry><term>conUB :</term> - <listitem><para> a m x 1 matrix of doubles, where m is number of constraints, contains upper bounds of the constraints.</para></listitem></varlistentry> + <listitem><para> a vector of doubles, contains upper bounds of the constraints.</para></listitem></varlistentry> <varlistentry><term>x0 :</term> - <listitem><para> a m x 1 matrix of doubles, where m is number of constraints, contains initial guess of variables.</para></listitem></varlistentry> + <listitem><para> a vector of doubles, contains initial guess of variables.</para></listitem></varlistentry> <varlistentry><term>param :</term> <listitem><para> a list containing the the parameters to be set.</para></listitem></varlistentry> <varlistentry><term>xopt :</term> - <listitem><para> a 1xn matrix of doubles, the computed solution of the optimization problem.</para></listitem></varlistentry> + <listitem><para> a vector of doubles, the computed solution of the optimization problem.</para></listitem></varlistentry> <varlistentry><term>fopt :</term> - <listitem><para> a 1x1 matrix of doubles, the function value at x.</para></listitem></varlistentry> + <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.</para></listitem></varlistentry> <varlistentry><term>output :</term> diff --git a/help/en_US/qpipoptmat.xml b/help/en_US/qpipoptmat.xml index eb8e737..3c9e6a4 100644 --- a/help/en_US/qpipoptmat.xml +++ b/help/en_US/qpipoptmat.xml @@ -39,29 +39,29 @@ <title>Parameters</title> <variablelist> <varlistentry><term>H :</term> - <listitem><para> a n x n matrix of doubles, where n is number of variables, represents coefficients of quadratic in the quadratic problem.</para></listitem></varlistentry> + <listitem><para> a vector of doubles, where n is number of variables, represents coefficients of quadratic in the quadratic problem.</para></listitem></varlistentry> <varlistentry><term>f :</term> - <listitem><para> a n x 1 matrix of doubles, where n is number of variables, represents coefficients of linear in the quadratic problem</para></listitem></varlistentry> + <listitem><para> a vector of doubles, where n is number of variables, represents coefficients of linear in the quadratic problem</para></listitem></varlistentry> <varlistentry><term>A :</term> - <listitem><para> a m x n matrix of doubles, represents the linear coefficients in the inequality constraints</para></listitem></varlistentry> + <listitem><para> a vector of doubles, represents the linear coefficients in the inequality constraints</para></listitem></varlistentry> <varlistentry><term>b :</term> - <listitem><para> a column vector of doubles, represents the linear coefficients in the inequality constraints</para></listitem></varlistentry> + <listitem><para> a vector of doubles, represents the linear coefficients in the inequality constraints</para></listitem></varlistentry> <varlistentry><term>Aeq :</term> - <listitem><para> a meq x n matrix of doubles, represents the linear coefficients in the equality constraints</para></listitem></varlistentry> + <listitem><para> a matrix of doubles, represents the linear coefficients in the equality constraints</para></listitem></varlistentry> <varlistentry><term>beq :</term> <listitem><para> a vector of doubles, represents the linear coefficients in the equality constraints</para></listitem></varlistentry> <varlistentry><term>LB :</term> - <listitem><para> a n x 1 matrix of doubles, where n is number of variables, contains lower bounds of the variables.</para></listitem></varlistentry> + <listitem><para> a vector of doubles, where n is number of variables, contains lower bounds of the variables.</para></listitem></varlistentry> <varlistentry><term>UB :</term> - <listitem><para> a n x 1 matrix of doubles, where n is number of variables, contains upper bounds of the variables.</para></listitem></varlistentry> + <listitem><para> a vector of doubles, where n is number of variables, contains upper bounds of the variables.</para></listitem></varlistentry> <varlistentry><term>x0 :</term> - <listitem><para> a m x 1 matrix of doubles, where m is number of constraints, contains initial guess of variables.</para></listitem></varlistentry> + <listitem><para> a vector of doubles, contains initial guess of variables.</para></listitem></varlistentry> <varlistentry><term>param :</term> <listitem><para> a list containing the the parameters to be set.</para></listitem></varlistentry> <varlistentry><term>xopt :</term> - <listitem><para> a nx1 matrix of doubles, the computed solution of the optimization problem.</para></listitem></varlistentry> + <listitem><para> a vector of doubles, the computed solution of the optimization problem.</para></listitem></varlistentry> <varlistentry><term>fopt :</term> - <listitem><para> a 1x1 matrix of doubles, the function value at x.</para></listitem></varlistentry> + <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.</para></listitem></varlistentry> <varlistentry><term>output :</term> @@ -113,7 +113,7 @@ x0 = repmat(0,6,1); param = list("MaxIter", 300, "CpuTime", 100); //and minimize 0.5*x'*Q*x + p'*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,[],param) clear H f A b Aeq beq lb ub; ]]></programlisting> 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 bf90ce2..02038f6 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 index 1b174ab..23181b6 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB @@ -1,2 +1,2 @@ -eџџџџџџџџџџџџџї_џџџџџџџџџџџџџџџџџџџџџї_џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџy§езџ§зџї_џ§зџuџџџџџџ§Я'\вџџџџџџџџџџџџџџџџѓ ї_§ЕџџџѓЩџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџЧџ4џџ§зџї_ќhT_e4Нs ќвџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџє
_ -C`Є7FF$рЈє
6Ј(q\tX6ТБPа$
t и `6
|*V@ЊXRЎХф
AёX{0lHтЃJ(3\/ тХЦPАГ
$2
YGеЫG
r Ч$V(&QoЁцZ№Р(0OўКЉзuџ8Љ?Ћї_Ь)[Йj_иТzяџЬ&eџкЉY;7|T0Т!аФ,ЁB(ђ*2 Uёr&(OЏЫѓ0П0ГаМйБF6/ЭtаГебђЯвлЦ]~жm*`QгІBѓjЇђЬ/џѓџџЭ/Ь/9Y.,пdъЊПџeџџЫџ7џџџ§ЕeџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџйrЬДЋЊЊdВЬЋtЂџ0Г0МЫЈПќТЬ,Тџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџи
\ No newline at end of file +eџџџџџџџџџџџџџї_џџџџџџџџџџџџџџџџџџџџџї_џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџy§езџ§зџї_џ§зџuџџџџџџ§Я'\вџџџџџџџџџџџџџџџќТ}зџmџџќђџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџќpGџќвџџџ§зџї_ќhT_e4Нs ќвџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџє
_ +C`Є7FF$рЌє
6Ј(q\tX6ТБPа$
t и `6
|*V@ЊXRЎХф
AёX{0lHтЃJ(3\/ тХЦPАГ
O$2
YGеЫG
r Ч$V(&QoЁцZ№Р(0OўКЉзuџ<Љ?Ћї_Ь)[Йj_иТzяџЬ&eџкЉY;7|T0Т!аФ,ЁB(ђ*2 Uёr&(OЏЫѓ0П0ГаМйБF6/ЭtаГеаГєЗGWG_ЦѕJЇtщМкЉќГџќТџџѓKѓЮV,пdъЊПџeџџЫџ7џџџ§ЙYџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџі\ГебюЊЉЊЫ2вќТЬ,Тѓ.Ђџѓ0Гџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ`
\ No newline at end of file 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 ac2dfed..d20c98d 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 8be86f0..e2773de 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/TMAP b/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP Binary files differindex 28f8966..7e8baef 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/_LaTeX_symphonymat.xml_1.png b/help/en_US/scilab_en_US_help/_LaTeX_symphonymat.xml_1.png Binary files differindex 07dafd6..2e81ca1 100644 --- a/help/en_US/scilab_en_US_help/_LaTeX_symphonymat.xml_1.png +++ b/help/en_US/scilab_en_US_help/_LaTeX_symphonymat.xml_1.png diff --git a/help/en_US/scilab_en_US_help/qpipopt.html b/help/en_US/scilab_en_US_help/qpipopt.html index 6659f44..b1c18ac 100644 --- a/help/en_US/scilab_en_US_help/qpipopt.html +++ b/help/en_US/scilab_en_US_help/qpipopt.html @@ -44,31 +44,31 @@ <div class="refsection"><h3 class="title">Parameters</h3> <dl><dt><span class="term">nbVar :</span> - <dd><p class="para">a 1 x 1 matrix of doubles, number of variables</p></dd></dt> + <dd><p class="para">a double, number of variables</p></dd></dt> <dt><span class="term">nbCon :</span> - <dd><p class="para">a 1 x 1 matrix of doubles, number of constraints</p></dd></dt> + <dd><p class="para">a double, number of constraints</p></dd></dt> <dt><span class="term">Q :</span> - <dd><p class="para">a n x n symmetric matrix of doubles, where n is number of variables, represents coefficients of quadratic in the quadratic problem.</p></dd></dt> + <dd><p class="para">a symmetric matrix of doubles, represents coefficients of quadratic in the quadratic problem.</p></dd></dt> <dt><span class="term">p :</span> - <dd><p class="para">a n x 1 matrix of doubles, where n is number of variables, represents coefficients of linear in the quadratic problem</p></dd></dt> + <dd><p class="para">a vector of doubles, represents coefficients of linear in the quadratic problem</p></dd></dt> <dt><span class="term">LB :</span> - <dd><p class="para">a n x 1 matrix of doubles, where n is number of variables, contains lower bounds of the variables.</p></dd></dt> + <dd><p class="para">a vector of doubles, contains lower bounds of the variables.</p></dd></dt> <dt><span class="term">UB :</span> - <dd><p class="para">a n x 1 matrix of doubles, where n is number of variables, contains upper bounds of the variables.</p></dd></dt> + <dd><p class="para">a vector of doubles, where n is number of variables, contains upper bounds of the variables.</p></dd></dt> <dt><span class="term">conMatrix :</span> - <dd><p class="para">a m x n matrix of doubles, where n is number of variables and m is number of constraints, contains matrix representing the constraint matrix</p></dd></dt> + <dd><p class="para">a matrix of doubles, contains matrix representing the constraint matrix</p></dd></dt> <dt><span class="term">conLB :</span> - <dd><p class="para">a m x 1 matrix of doubles, where m is number of constraints, contains lower bounds of the constraints.</p></dd></dt> + <dd><p class="para">a vector of doubles, contains lower bounds of the constraints.</p></dd></dt> <dt><span class="term">conUB :</span> - <dd><p class="para">a m x 1 matrix of doubles, where m is number of constraints, contains upper bounds of the constraints.</p></dd></dt> + <dd><p class="para">a vector of doubles, contains upper bounds of the constraints.</p></dd></dt> <dt><span class="term">x0 :</span> - <dd><p class="para">a m x 1 matrix of doubles, where m is number of constraints, contains initial guess of variables.</p></dd></dt> + <dd><p class="para">a vector of doubles, contains initial guess of variables.</p></dd></dt> <dt><span class="term">param :</span> <dd><p class="para">a list containing the the parameters to be set.</p></dd></dt> <dt><span class="term">xopt :</span> - <dd><p class="para">a 1xn matrix of doubles, the computed solution of the optimization problem.</p></dd></dt> + <dd><p class="para">a vector of doubles, the computed solution of the optimization problem.</p></dd></dt> <dt><span class="term">fopt :</span> - <dd><p class="para">a 1x1 matrix of doubles, the function value at x.</p></dd></dt> + <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.</p></dd></dt> <dt><span class="term">output :</span> diff --git a/help/en_US/scilab_en_US_help/qpipoptmat.html b/help/en_US/scilab_en_US_help/qpipoptmat.html index 5e7518e..a9f97aa 100644 --- a/help/en_US/scilab_en_US_help/qpipoptmat.html +++ b/help/en_US/scilab_en_US_help/qpipoptmat.html @@ -47,29 +47,29 @@ <div class="refsection"><h3 class="title">Parameters</h3> <dl><dt><span class="term">H :</span> - <dd><p class="para">a n x n matrix of doubles, where n is number of variables, represents coefficients of quadratic in the quadratic problem.</p></dd></dt> + <dd><p class="para">a vector of doubles, where n is number of variables, represents coefficients of quadratic in the quadratic problem.</p></dd></dt> <dt><span class="term">f :</span> - <dd><p class="para">a n x 1 matrix of doubles, where n is number of variables, represents coefficients of linear in the quadratic problem</p></dd></dt> + <dd><p class="para">a vector of doubles, where n is number of variables, represents coefficients of linear in the quadratic problem</p></dd></dt> <dt><span class="term">A :</span> - <dd><p class="para">a m x n matrix of doubles, represents the linear coefficients in the inequality constraints</p></dd></dt> + <dd><p class="para">a vector of doubles, represents the linear coefficients in the inequality constraints</p></dd></dt> <dt><span class="term">b :</span> - <dd><p class="para">a column vector of doubles, represents the linear coefficients in the inequality constraints</p></dd></dt> + <dd><p class="para">a vector of doubles, represents the linear coefficients in the inequality constraints</p></dd></dt> <dt><span class="term">Aeq :</span> - <dd><p class="para">a meq x n matrix of doubles, represents the linear coefficients in the equality constraints</p></dd></dt> + <dd><p class="para">a matrix of doubles, represents the linear coefficients in the equality constraints</p></dd></dt> <dt><span class="term">beq :</span> <dd><p class="para">a vector of doubles, represents the linear coefficients in the equality constraints</p></dd></dt> <dt><span class="term">LB :</span> - <dd><p class="para">a n x 1 matrix of doubles, where n is number of variables, contains lower bounds of the variables.</p></dd></dt> + <dd><p class="para">a vector of doubles, where n is number of variables, contains lower bounds of the variables.</p></dd></dt> <dt><span class="term">UB :</span> - <dd><p class="para">a n x 1 matrix of doubles, where n is number of variables, contains upper bounds of the variables.</p></dd></dt> + <dd><p class="para">a vector of doubles, where n is number of variables, contains upper bounds of the variables.</p></dd></dt> <dt><span class="term">x0 :</span> - <dd><p class="para">a m x 1 matrix of doubles, where m is number of constraints, contains initial guess of variables.</p></dd></dt> + <dd><p class="para">a vector of doubles, contains initial guess of variables.</p></dd></dt> <dt><span class="term">param :</span> <dd><p class="para">a list containing the the parameters to be set.</p></dd></dt> <dt><span class="term">xopt :</span> - <dd><p class="para">a nx1 matrix of doubles, the computed solution of the optimization problem.</p></dd></dt> + <dd><p class="para">a vector of doubles, the computed solution of the optimization problem.</p></dd></dt> <dt><span class="term">fopt :</span> - <dd><p class="para">a 1x1 matrix of doubles, the function value at x.</p></dd></dt> + <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.</p></dd></dt> <dt><span class="term">output :</span> @@ -100,7 +100,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">*Q*x + p</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><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> <span class="scilabid">clear</span> <span class="scilabid">H</span> <span class="scilabid">f</span> <span class="scilabid">A</span> <span class="scilabid">b</span> <span class="scilabid">Aeq</span> <span class="scilabid">beq</span> <span class="scilabid">lb</span> <span class="scilabid">ub</span><span class="scilabdefault">;</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> diff --git a/help/en_US/scilab_en_US_help/symphony.html b/help/en_US/scilab_en_US_help/symphony.html index a1e3eea..c5b8336 100644 --- a/help/en_US/scilab_en_US_help/symphony.html +++ b/help/en_US/scilab_en_US_help/symphony.html @@ -44,33 +44,33 @@ <div class="refsection"><h3 class="title">Parameters</h3> <dl><dt><span class="term">nbVar :</span> - <dd><p class="para">a 1 x 1 matrix of doubles, number of variables</p></dd></dt> + <dd><p class="para">a double, number of variables.</p></dd></dt> <dt><span class="term">nbCon :</span> - <dd><p class="para">a 1 x 1 matrix of doubles, number of constraints</p></dd></dt> + <dd><p class="para">a double, number of constraints.</p></dd></dt> <dt><span class="term">objCoeff :</span> - <dd><p class="para">a 1 x n matrix of doubles, where n is number of variables, contains coefficients of the variables in the objective</p></dd></dt> + <dd><p class="para">a 1 x n matrix of doubles, where n is number of variables, represents coefficients of the variables in the objective.</p></dd></dt> <dt><span class="term">isInt :</span> - <dd><p class="para">a 1 x n matrix of boolean, where n is number of variables, representing wether a variable is constrained to be an integer</p></dd></dt> + <dd><p class="para">a vector of boolean, represents wether a variable is constrained to be an integer.</p></dd></dt> <dt><span class="term">LB :</span> - <dd><p class="para">a 1 x n matrix of doubles, where n is number of variables, contains lower bounds of the variables. Bound can be negative infinity</p></dd></dt> + <dd><p class="para">a vector of doubles, represents lower bounds of the variables.</p></dd></dt> <dt><span class="term">UB :</span> - <dd><p class="para">a 1 x n matrix of doubles, where n is number of variables, contains upper bounds of the variables. Bound can be infinity</p></dd></dt> + <dd><p class="para">a vector of doubles, represents upper bounds of the variables.</p></dd></dt> <dt><span class="term">conMatrix :</span> - <dd><p class="para">a m x n matrix of doubles, where n is number of variables and m is number of constraints, contains matrix representing the constraint matrix</p></dd></dt> + <dd><p class="para">a matrix of doubles, represents matrix representing the constraint matrix.</p></dd></dt> <dt><span class="term">conLB :</span> - <dd><p class="para">a m x 1 matrix of doubles, where m is number of constraints, contains lower bounds of the constraints.</p></dd></dt> + <dd><p class="para">a vector of doubles, represents lower bounds of the constraints.</p></dd></dt> <dt><span class="term">conUB :</span> - <dd><p class="para">a m x 1 matrix of doubles, where m is number of constraints, contains upper bounds of the constraints</p></dd></dt> + <dd><p class="para">a vector of doubles, represents upper bounds of the constraints</p></dd></dt> <dt><span class="term">objSense :</span> - <dd><p class="para">The sense (maximization/minimization) of the objective. Use 1(sym_minimize ) or -1 (sym_maximize) here</p></dd></dt> + <dd><p class="para">The sense (maximization/minimization) of the objective. Use 1(sym_minimize ) or -1 (sym_maximize) here.</p></dd></dt> <dt><span class="term">options :</span> - <dd><p class="para">a 1xq marix of string, provided to set the paramters in symphony</p></dd></dt> + <dd><p class="para">a a list containing the the parameters to be set.</p></dd></dt> <dt><span class="term">xopt :</span> - <dd><p class="para">a 1xn matrix of doubles, the computed solution of the optimization problem</p></dd></dt> + <dd><p class="para">a vector of doubles, the computed solution of the optimization problem.</p></dd></dt> <dt><span class="term">fopt :</span> - <dd><p class="para">a 1x1 matrix of doubles, the function value at x</p></dd></dt> + <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</p></dd></dt> + <dd><p class="para">status flag from symphony.</p></dd></dt> <dt><span class="term">output :</span> <dd><p class="para">The output data structure contains detailed informations about the optimization process.</p></dd></dt></dl></div> @@ -84,11 +84,11 @@ find the minimum or maximum of f(x) such that</p> <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> <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="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> +<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">8</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilabdefault">;</span> <span class="scilabcomment">// Upper Bound of variables</span> -<span class="scilabid">ub</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><a class="scilabmacro" href="scilab://repmat">repmat</a><span class="scilabopenclose">(</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabnumber">4</span><span class="scilabopenclose">)</span> <a class="scilabmacro" href="scilab://repmat">repmat</a><span class="scilabopenclose">(</span><span class="scilabconstants">%inf</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabnumber">4</span><span class="scilabopenclose">)</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">ub</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><a class="scilabmacro" href="scilab://repmat">repmat</a><span class="scilabopenclose">(</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabnumber">4</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilabdefault">;</span><a class="scilabmacro" href="scilab://repmat">repmat</a><span class="scilabopenclose">(</span><span class="scilabconstants">%inf</span><span class="scilabdefault">,</span><span class="scilabnumber">4</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> <span class="scilabcomment">// Constraint Matrix</span> <span class="scilabid">conMatrix</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="scilabdefault">,</span><span class="scilabnumber">4</span><span class="scilabdefault">,</span><span class="scilabnumber">6</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabdefault">;</span> <span class="scilabnumber">5</span><span class="scilaboperator">*</span><span class="scilabnumber">0.05</span><span class="scilabdefault">,</span><span class="scilabnumber">3</span><span class="scilaboperator">*</span><span class="scilabnumber">0.04</span><span class="scilabdefault">,</span><span class="scilabnumber">4</span><span class="scilaboperator">*</span><span class="scilabnumber">0.05</span><span class="scilabdefault">,</span><span class="scilabnumber">6</span><span class="scilaboperator">*</span><span class="scilabnumber">0.03</span><span class="scilabdefault">,</span><span class="scilabnumber">0.08</span><span class="scilabdefault">,</span><span class="scilabnumber">0.07</span><span class="scilabdefault">,</span><span class="scilabnumber">0.06</span><span class="scilabdefault">,</span><span class="scilabnumber">0.03</span><span class="scilabdefault">;</span> @@ -121,7 +121,7 @@ find the minimum or maximum of f(x) such that</p> <span class="scilabnumber">957</span> <span class="scilabnumber">798</span> <span class="scilabnumber">669</span> <span class="scilabnumber">625</span> <span class="scilabnumber">467</span> <span class="scilabnumber">1051</span> <span class="scilabnumber">552</span> <span class="scilabnumber">717</span> <span class="scilabnumber">654</span> <span class="scilabnumber">388</span> <span class="scilabnumber">559</span> <span class="scilabnumber">555</span> <span class="scilabnumber">1104</span> <span class="scilabnumber">783</span> <span class="scilabspecial">..</span> <span class="scilabnumber">959</span> <span class="scilabnumber">668</span> <span class="scilabnumber">507</span> <span class="scilabnumber">855</span> <span class="scilabnumber">986</span> <span class="scilabnumber">831</span> <span class="scilabnumber">821</span> <span class="scilabnumber">825</span> <span class="scilabnumber">868</span> <span class="scilabnumber">852</span> <span class="scilabnumber">832</span> <span class="scilabnumber">828</span> <span class="scilabnumber">799</span> <span class="scilabnumber">686</span> <span class="scilabspecial">..</span> <span class="scilabnumber">510</span> <span class="scilabnumber">671</span> <span class="scilabnumber">575</span> <span class="scilabnumber">740</span> <span class="scilabnumber">510</span> <span class="scilabnumber">675</span> <span class="scilabnumber">996</span> <span class="scilabnumber">636</span> <span class="scilabnumber">826</span> <span class="scilabnumber">1022</span> <span class="scilabnumber">1140</span> <span class="scilabnumber">654</span> <span class="scilabnumber">909</span> <span class="scilabnumber">799</span> <span class="scilabspecial">..</span> -<span class="scilabnumber">1162</span> <span class="scilabnumber">653</span> <span class="scilabnumber">814</span> <span class="scilabnumber">625</span> <span class="scilabnumber">599</span> <span class="scilabnumber">476</span> <span class="scilabnumber">767</span> <span class="scilabnumber">954</span> <span class="scilabnumber">906</span> <span class="scilabnumber">904</span> <span class="scilabnumber">649</span> <span class="scilabnumber">873</span> <span class="scilabnumber">565</span> <span class="scilabnumber">853</span> <span class="scilabnumber">1008</span> <span class="scilabnumber">632</span><span class="scilabopenclose">]</span> +<span class="scilabnumber">1162</span> <span class="scilabnumber">653</span> <span class="scilabnumber">814</span> <span class="scilabnumber">625</span> <span class="scilabnumber">599</span> <span class="scilabnumber">476</span> <span class="scilabnumber">767</span> <span class="scilabnumber">954</span> <span class="scilabnumber">906</span> <span class="scilabnumber">904</span> <span class="scilabnumber">649</span> <span class="scilabnumber">873</span> <span class="scilabnumber">565</span> <span class="scilabnumber">853</span> <span class="scilabnumber">1008</span> <span class="scilabnumber">632</span><span class="scilabopenclose">]</span><span class="scilaboperator">'</span><span class="scilabdefault">;</span> <span class="scilabcomment">//Constraint Matrix</span> <span class="scilabid">conMatrix</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span> <span class="scilabcomment">//Constraint 1</span> @@ -168,9 +168,9 @@ find the minimum or maximum of f(x) such that</p> <span class="scilabid">nbCon</span> <span class="scilaboperator">=</span> <a class="scilabcommand" href="scilab://size">size</a><span class="scilabopenclose">(</span><span class="scilabid">conMatrix</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span> <span class="scilabid">nbVar</span> <span class="scilaboperator">=</span> <a class="scilabcommand" href="scilab://size">size</a><span class="scilabopenclose">(</span><span class="scilabid">conMatrix</span><span class="scilabdefault">,</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span> <span class="scilabcomment">// Lower Bound of variables</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="scilabid">nbVar</span><span class="scilabopenclose">)</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="scilabid">nbVar</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span> <span class="scilabcomment">// Upper Bound of variables</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">1</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabid">nbVar</span><span class="scilabopenclose">)</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">1</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="scilabcomment">// Row Matrix for telling symphony that the is integer or not</span> <span class="scilabid">isInt</span> <span class="scilaboperator">=</span> <a class="scilabmacro" href="scilab://repmat">repmat</a><span class="scilabopenclose">(</span><span class="scilabconstants">%t</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabid">nbVar</span><span class="scilabopenclose">)</span> <span class="scilabcomment">// Lower Bound of constrains</span> diff --git a/help/en_US/scilab_en_US_help/symphonymat.html b/help/en_US/scilab_en_US_help/symphonymat.html index 23ff2c6..8001136 100644 --- a/help/en_US/scilab_en_US_help/symphonymat.html +++ b/help/en_US/scilab_en_US_help/symphonymat.html @@ -45,9 +45,9 @@ <div class="refsection"><h3 class="title">Parameters</h3> <dl><dt><span class="term">f :</span> - <dd><p class="para">a 1xn matrix of doubles, where n is number of variables, contains coefficients of the variables in the objective</p></dd></dt> + <dd><p class="para">a vector of doubles, where n is number of variables, contains coefficients of the variables in the objective</p></dd></dt> <dt><span class="term">intcon :</span> - <dd><p class="para">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</p></dd></dt> + <dd><p class="para">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.</p></dd></dt> <dt><span class="term">A :</span> <dd><p class="para">Linear inequality constraint matrix, specified as a matrix of doubles. A represents the linear coefficients in the constraints A*x тЄ b. A has size M-by-N, where M is the number of constraints and N is number of variables</p></dd></dt> <dt><span class="term">b :</span> @@ -72,7 +72,7 @@ <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"><span><img src='./_LaTeX_symphonymat.xml_1.png' style='position:relative;top:31px;width:293px;height:70px'/></span></p> + <p class="para"><span><img src='./_LaTeX_symphonymat.xml_1.png' style='position:relative;top:40px;width:205px;height:88px'/></span></p> <p class="para">We are calling SYMPHONY written in C by gateway files for the actual computation. SYMPHONY was originally written by тTed Ralphs, тMenal Guzelsoy and тAshutosh Mahajan.</p> <p class="para"></p></div> @@ -159,7 +159,7 @@ find the minimum or maximum of f(x) such that</p> <span class="scilabcomment">// Upper Bound of variables</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">1</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabid">nbVar</span><span class="scilabopenclose">)</span> <span class="scilabcomment">// Lower Bound of constrains</span> -<span class="scilabid">intcon</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabopenclose">]</span> +<span class="scilabid">intcon</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> <span class="scilabskeyword">for</span> <span class="scilabid">i</span> <span class="scilaboperator">=</span> <span class="scilabnumber">1</span><span class="scilabspecial">:</span><span class="scilabid">nbVar</span> <span class="scilabid">intcon</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabid">intcon</span> <span class="scilabid">i</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> <span class="scilabskeyword">end</span> diff --git a/help/en_US/symphony.xml b/help/en_US/symphony.xml index c33b95c..972bfc1 100644 --- a/help/en_US/symphony.xml +++ b/help/en_US/symphony.xml @@ -36,33 +36,33 @@ <title>Parameters</title> <variablelist> <varlistentry><term>nbVar :</term> - <listitem><para> a 1 x 1 matrix of doubles, number of variables</para></listitem></varlistentry> + <listitem><para> a double, number of variables.</para></listitem></varlistentry> <varlistentry><term>nbCon :</term> - <listitem><para> a 1 x 1 matrix of doubles, number of constraints</para></listitem></varlistentry> + <listitem><para> a double, number of constraints.</para></listitem></varlistentry> <varlistentry><term>objCoeff :</term> - <listitem><para> a 1 x n matrix of doubles, where n is number of variables, contains coefficients of the variables in the objective</para></listitem></varlistentry> + <listitem><para> a 1 x n matrix of doubles, where n is number of variables, represents coefficients of the variables in the objective.</para></listitem></varlistentry> <varlistentry><term>isInt :</term> - <listitem><para> a 1 x n matrix of boolean, where n is number of variables, representing wether a variable is constrained to be an integer</para></listitem></varlistentry> + <listitem><para> a vector of boolean, represents wether a variable is constrained to be an integer.</para></listitem></varlistentry> <varlistentry><term>LB :</term> - <listitem><para> a 1 x n matrix of doubles, where n is number of variables, contains lower bounds of the variables. Bound can be negative infinity</para></listitem></varlistentry> + <listitem><para> a vector of doubles, represents lower bounds of the variables.</para></listitem></varlistentry> <varlistentry><term>UB :</term> - <listitem><para> a 1 x n matrix of doubles, where n is number of variables, contains upper bounds of the variables. Bound can be infinity</para></listitem></varlistentry> + <listitem><para> a vector of doubles, represents upper bounds of the variables.</para></listitem></varlistentry> <varlistentry><term>conMatrix :</term> - <listitem><para> a m x n matrix of doubles, where n is number of variables and m is number of constraints, contains matrix representing the constraint matrix</para></listitem></varlistentry> + <listitem><para> a matrix of doubles, represents matrix representing the constraint matrix.</para></listitem></varlistentry> <varlistentry><term>conLB :</term> - <listitem><para> a m x 1 matrix of doubles, where m is number of constraints, contains lower bounds of the constraints.</para></listitem></varlistentry> + <listitem><para> a vector of doubles, represents lower bounds of the constraints.</para></listitem></varlistentry> <varlistentry><term>conUB :</term> - <listitem><para> a m x 1 matrix of doubles, where m is number of constraints, contains upper bounds of the constraints</para></listitem></varlistentry> + <listitem><para> a vector of doubles, represents upper bounds of the constraints</para></listitem></varlistentry> <varlistentry><term>objSense :</term> - <listitem><para> The sense (maximization/minimization) of the objective. Use 1(sym_minimize ) or -1 (sym_maximize) here</para></listitem></varlistentry> + <listitem><para> The sense (maximization/minimization) of the objective. Use 1(sym_minimize ) or -1 (sym_maximize) here.</para></listitem></varlistentry> <varlistentry><term>options :</term> - <listitem><para> a 1xq marix of string, provided to set the paramters in symphony</para></listitem></varlistentry> + <listitem><para> a a list containing the the parameters to be set.</para></listitem></varlistentry> <varlistentry><term>xopt :</term> - <listitem><para> a 1xn matrix of doubles, the computed solution of the optimization problem</para></listitem></varlistentry> + <listitem><para> a vector of doubles, the computed solution of the optimization problem.</para></listitem></varlistentry> <varlistentry><term>fopt :</term> - <listitem><para> a 1x1 matrix of doubles, the function value at x</para></listitem></varlistentry> + <listitem><para> a double, the function value at x.</para></listitem></varlistentry> <varlistentry><term>status :</term> - <listitem><para> status flag from symphony</para></listitem></varlistentry> + <listitem><para> status flag from symphony.</para></listitem></varlistentry> <varlistentry><term>output :</term> <listitem><para> The output data structure contains detailed informations about the optimization process.</para></listitem></varlistentry> </variablelist> @@ -96,11 +96,11 @@ We are calling SYMPHONY written in C by gateway files for the actual computation <programlisting role="example"><![CDATA[ //A basic case : // Objective function -c = [350*5,330*3,310*4,280*6,500,450,400,100] +c = [350*5,330*3,310*4,280*6,500,450,400,100]'; // Lower Bound of variable -lb = repmat(0,1,8); +lb = repmat(0,8,1); // Upper Bound of variables -ub = [repmat(1,1,4) repmat(%inf,1,4)]; +ub = [repmat(1,4,1);repmat(%inf,4,1)]; // Constraint Matrix conMatrix = [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; @@ -138,7 +138,7 @@ p = [ 504 803 667 1103 834 585 811 856 690 832 846 813 868 793 .. 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] +1162 653 814 625 599 476 767 954 906 904 649 873 565 853 1008 632]'; //Constraint Matrix conMatrix = [ //Constraint 1 @@ -185,9 +185,9 @@ conMatrix = [ nbCon = size(conMatrix,1) nbVar = size(conMatrix,2) // Lower Bound of variables -lb = repmat(0,1,nbVar) +lb = repmat(0,nbVar,1) // Upper Bound of variables -ub = repmat(1,1,nbVar) +ub = repmat(1,nbVar,1) // Row Matrix for telling symphony that the is integer or not isInt = repmat(%t,1,nbVar) // Lower Bound of constrains diff --git a/help/en_US/symphonymat.xml b/help/en_US/symphonymat.xml index ca56363..1328167 100644 --- a/help/en_US/symphonymat.xml +++ b/help/en_US/symphonymat.xml @@ -37,9 +37,9 @@ <title>Parameters</title> <variablelist> <varlistentry><term>f :</term> - <listitem><para> a 1xn matrix of doubles, where n is number of variables, contains coefficients of the variables in the objective</para></listitem></varlistentry> + <listitem><para> a vector of doubles, where n is number of variables, contains coefficients of the variables in the objective</para></listitem></varlistentry> <varlistentry><term>intcon :</term> - <listitem><para> 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</para></listitem></varlistentry> + <listitem><para> 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.</para></listitem></varlistentry> <varlistentry><term>A :</term> <listitem><para> Linear inequality constraint matrix, specified as a matrix of doubles. A represents the linear coefficients in the constraints A*x тЄ b. A has size M-by-N, where M is the number of constraints and N is number of variables</para></listitem></varlistentry> <varlistentry><term>b :</term> @@ -74,7 +74,8 @@ find the minimum or maximum of f(x) such that \begin{eqnarray} &\mbox{min}_{x} & f(x) \\ -& \text{subject to} & conLB \leq C(x) \leq conUB \\ +& \text{subject to} & A.x \leq b \\ +& & Aeq.x \leq beq \\ & & lb \leq x \leq ub \\ \end{eqnarray} </latex> @@ -176,7 +177,7 @@ lb = repmat(0,1,nbVar) // Upper Bound of variables ub = repmat(1,1,nbVar) // Lower Bound of constrains -intcon = [] +intcon = []; for i = 1:nbVar intcon = [intcon i]; end diff --git a/jar/scilab_en_US_help.jar b/jar/scilab_en_US_help.jar Binary files differindex 2f1f947..749cb54 100644 --- a/jar/scilab_en_US_help.jar +++ b/jar/scilab_en_US_help.jar diff --git a/macros/qpipopt.bin b/macros/qpipopt.bin Binary files differindex 07db2ad..6eea1fa 100644 --- a/macros/qpipopt.bin +++ b/macros/qpipopt.bin diff --git a/macros/qpipopt.sci b/macros/qpipopt.sci index 8f3945e..5f08067 100644 --- a/macros/qpipopt.sci +++ b/macros/qpipopt.sci @@ -20,19 +20,19 @@ function [xopt,fopt,exitflag,output,lambda] = qpipopt (varargin) // [xopt,fopt,exitflag,output,lamda] = qpipopt( ... ) // // Parameters - // nbVar : a 1 x 1 matrix of doubles, number of variables - // nbCon : a 1 x 1 matrix of doubles, number of constraints - // Q : a n x n symmetric matrix of doubles, where n is number of variables, represents coefficients of quadratic in the quadratic problem. - // p : a n x 1 matrix of doubles, where n is number of variables, represents coefficients of linear in the quadratic problem - // LB : a n x 1 matrix of doubles, where n is number of variables, contains lower bounds of the variables. - // UB : a n x 1 matrix of doubles, where n is number of variables, contains upper bounds of the variables. - // conMatrix : a m x n matrix of doubles, where n is number of variables and m is number of constraints, contains matrix representing the constraint matrix - // conLB : a m x 1 matrix of doubles, where m is number of constraints, contains lower bounds of the constraints. - // conUB : a m x 1 matrix of doubles, where m is number of constraints, contains upper bounds of the constraints. - // x0 : a m x 1 matrix of doubles, where m is number of constraints, contains initial guess of variables. + // nbVar : a double, number of variables + // nbCon : a double, number of constraints + // Q : a symmetric matrix of doubles, represents coefficients of quadratic in the quadratic problem. + // p : a vector of doubles, represents coefficients of linear in the quadratic problem + // LB : a vector of doubles, contains lower bounds of the variables. + // UB : a vector of doubles, where n is number of variables, contains upper bounds of the variables. + // conMatrix : a matrix of doubles, contains matrix representing the constraint matrix + // conLB : a vector of doubles, contains lower bounds of the constraints. + // conUB : a vector of doubles, contains upper bounds of the constraints. + // x0 : a vector of doubles, contains initial guess of variables. // param : a list containing the the parameters to be set. - // xopt : a 1xn matrix of doubles, the computed solution of the optimization problem. - // fopt : a 1x1 matrix of doubles, the function value at x. + // xopt : a vector of doubles, the computed solution of the optimization problem. + // fopt : a double, the function value at x. // exitflag : Integer identifying the reason the algorithm terminated. // output : Structure containing information about the optimization. // lambda : Structure containing the Lagrange multipliers at the solution x (separated by constraint type). @@ -114,19 +114,31 @@ function [xopt,fopt,exitflag,output,lambda] = qpipopt (varargin) conLB = varargin(8); conUB = varargin(9); - + if (size(LB,2)==0) then + LB = repmat(-%inf,nbVar,1); + end + + if (size(UB,2)==0) then + UB = repmat(%inf,nbVar,1); + end + if ( rhs<10 | size(varargin(10)) ==0 ) then x0 = repmat(0,nbVar,1); else x0 = varargin(10); end - if ( rhs<11 ) then + if ( rhs<11 | size(varargin(11)) ==0 ) then param = list(); else param =varargin(11); end + if (type(param) ~= 15) then + errmsg = msprintf(gettext("%s: param should be a list "), "qpipopt"); + error(errmsg); + end + if (modulo(size(param),2)) then errmsg = msprintf(gettext("%s: Size of parameters should be even"), "qpipopt"); error(errmsg); @@ -137,6 +149,7 @@ function [xopt,fopt,exitflag,output,lambda] = qpipopt (varargin) "MaxIter" , [3000], ... "CpuTime" , [600] ... ); + for i = 1:(size(param))/2 select param(2*i-1) @@ -150,6 +163,33 @@ function [xopt,fopt,exitflag,output,lambda] = qpipopt (varargin) end end +// Check if the user gives row vector +// and Changing it to a column matrix + + if (size(p,2)== [nbVar]) then + p=p'; + end + + if (size(LB,2)== [nbVar]) then + LB = LB'; + end + + if (size(UB,2)== [nbVar]) then + UB = UB'; + end + + if (size(conUB,2)== [nbCon]) then + conUB = conUB'; + end + + if (size(conLB,2)== [nbCon]) then + conLB = conLB'; + end + + if (size(x0,2)== [nbVar]) then + x0=x0'; + end + //IPOpt wants it in row matrix form p = p'; LB = LB'; @@ -176,10 +216,17 @@ function [xopt,fopt,exitflag,output,lambda] = qpipopt (varargin) error(errmsg); end - - //Check the size of constraint which should equal to the number of variables - if ( size(conMatrix,2) ~= nbVar) then - errmsg = msprintf(gettext("%s: The size of constraints is not equal to the number of variables"), "qpipopt"); + if (nbCon) then + //Check the size of constraint which should equal to the number of variables + if ( size(conMatrix,2) ~= nbVar) then + errmsg = msprintf(gettext("%s: The size of constraints is not equal to the number of variables"), "qpipopt"); + error(errmsg); + end + end + + //Check the number of constraint + if ( size(conMatrix,1) ~= nbCon) then + errmsg = msprintf(gettext("%s: The number of constraints is not equal to the number of constraint given i.e. %d"), "qpipopt", nbCon); error(errmsg); end @@ -209,9 +256,10 @@ function [xopt,fopt,exitflag,output,lambda] = qpipopt (varargin) //Check the size of initial of variables which should equal to the number of variables if ( size(x0,2) ~= nbVar) then - errmsg = msprintf(gettext("%s: The initial guess of variables is not equal to the number of variables"), "qpipopt"); - error(errmsg); + warnmsg = msprintf(gettext("%s: Ignoring initial guess of variables as it is not equal to the number of variables"), "qpipopt"); + warning(warnmsg); end + [xopt,fopt,status,iter,Zl,Zu,lmbda] = solveqp(nbVar,nbCon,Q,p,conMatrix,conLB,conUB,LB,UB,x0,options); diff --git a/macros/qpipoptmat.bin b/macros/qpipoptmat.bin Binary files differindex 668402c..2cb90c9 100644 --- a/macros/qpipoptmat.bin +++ b/macros/qpipoptmat.bin diff --git a/macros/qpipoptmat.sci b/macros/qpipoptmat.sci index 6ae20c0..7924ba6 100644 --- a/macros/qpipoptmat.sci +++ b/macros/qpipoptmat.sci @@ -23,18 +23,18 @@ function [xopt,fopt,exitflag,output,lambda] = qpipoptmat (varargin) // [xopt,fopt,exitflag,output,lamda] = qpipoptmat( ... ) // // Parameters - // H : a n x n matrix of doubles, where n is number of variables, represents coefficients of quadratic in the quadratic problem. - // f : a n x 1 matrix of doubles, where n is number of variables, represents coefficients of linear in the quadratic problem - // A : a m x n matrix of doubles, represents the linear coefficients in the inequality constraints - // b : a column vector of doubles, represents the linear coefficients in the inequality constraints - // Aeq : a meq x n matrix of doubles, represents the linear coefficients in the equality constraints + // H : a vector of doubles, where n is number of variables, represents coefficients of quadratic in the quadratic problem. + // f : a vector of doubles, where n is number of variables, represents coefficients of linear in the quadratic problem + // A : a vector of doubles, represents the linear coefficients in the inequality constraints + // b : a vector of doubles, represents the linear coefficients in the inequality constraints + // Aeq : a matrix of doubles, represents the linear coefficients in the equality constraints // beq : a vector of doubles, represents the linear coefficients in the equality constraints - // LB : a n x 1 matrix of doubles, where n is number of variables, contains lower bounds of the variables. - // UB : a n x 1 matrix of doubles, where n is number of variables, contains upper bounds of the variables. - // x0 : a m x 1 matrix of doubles, where m is number of constraints, contains initial guess of variables. + // LB : a vector of doubles, where n is number of variables, contains lower bounds of the variables. + // UB : a vector of doubles, where n is number of variables, contains upper bounds of the variables. + // x0 : a vector of doubles, contains initial guess of variables. // param : a list containing the the parameters to be set. - // xopt : a nx1 matrix of doubles, the computed solution of the optimization problem. - // fopt : a 1x1 matrix of doubles, the function value at x. + // xopt : a vector of doubles, the computed solution of the optimization problem. + // fopt : a double, the function value at x. // exitflag : Integer identifying the reason the algorithm terminated. // output : Structure containing information about the optimization. // lambda : Structure containing the Lagrange multipliers at the solution x (separated by constraint type). @@ -108,7 +108,7 @@ function [xopt,fopt,exitflag,output,lambda] = qpipoptmat (varargin) nbVar = size(H,1); - if ( rhs<2 ) then + if ( rhs<3 ) then A = [] b = [] else @@ -116,7 +116,7 @@ function [xopt,fopt,exitflag,output,lambda] = qpipoptmat (varargin) b = varargin(4); end - if ( rhs<4 ) then + if ( rhs<5 ) then Aeq = [] beq = [] else @@ -124,7 +124,7 @@ function [xopt,fopt,exitflag,output,lambda] = qpipoptmat (varargin) beq = varargin(6); end - if ( rhs<6 ) then + if ( rhs<7 ) then LB = repmat(-%inf,nbVar,1); UB = repmat(%inf,nbVar,1); else @@ -139,24 +139,32 @@ function [xopt,fopt,exitflag,output,lambda] = qpipoptmat (varargin) x0 = varargin(9); end - if ( rhs<10 ) then + if ( rhs<10 | size(varargin(10)) ==0 ) then param = list(); else param =varargin(10); end + if (size(LB,2)==0) then + LB = repmat(-%inf,nbVar,1); + end + + if (size(UB,2)==0) then + UB = repmat(%inf,nbVar,1); + end + - if (modulo(size(param),2)) then - errmsg = msprintf(gettext("%s: Size of parameters should be even"), "qpipoptmat"); - error(errmsg); + if (type(param) ~= 15) then + errmsg = msprintf(gettext("%s: param should be a list "), "qpipopt"); + error(errmsg); end + if (modulo(size(param),2)) then errmsg = msprintf(gettext("%s: Size of parameters should be even"), "qpipoptmat"); error(errmsg); end - options = list(.. "MaxIter" , [3000], ... "CpuTime" , [600] ... @@ -178,34 +186,57 @@ function [xopt,fopt,exitflag,output,lambda] = qpipoptmat (varargin) nbConInEq = size(A,1); nbConEq = size(Aeq,1); +// Check if the user gives row vector +// and Changing it to a column matrix + + + if (size(f,2)== [nbVar]) then + f=f'; + end + + if (size(LB,2)== [nbVar]) then + LB = LB'; + end + + if (size(UB,2)== [nbVar]) then + UB = UB'; + end + + if (size(b,2)==nbConInEq) then + b = b'; + end + + if (size(beq,2)== nbConEq) then + beq = beq'; + end + + if (size(x0,2)== [nbVar]) then + x0=x0'; + end + //Checking the H matrix which needs to be a symmetric matrix - if ( H~=H') then + if ( ~isequal(H,H')) then errmsg = msprintf(gettext("%s: H is not a symmetric matrix"), "qpipoptmat"); error(errmsg); end - //Check the size of H which should equal to the number of variable - if ( size(H) ~= [nbVar nbVar]) then - errmsg = msprintf(gettext("%s: The Size of H is not equal to the number of variables"), "qpipoptmat"); - error(errmsg); - end //Check the size of f which should equal to the number of variable if ( size(f,1) ~= [nbVar]) then - errmsg = msprintf(gettext("%s: The Size of f is not equal to the number of variables"), "qpipoptmat"); + errmsg = msprintf(gettext("%s: The number of rows and columns in H must be equal the number of elements of f"), "qpipoptmat"); error(errmsg); end //Check the size of inequality constraint which should be equal to the number of variables if ( size(A,2) ~= nbVar & size(A,2) ~= 0) then - errmsg = msprintf(gettext("%s: The size of inequality constraints is not equal to the number of variables"), "qpipoptmat"); + errmsg = msprintf(gettext("%s: The number of columns in A must be the same as the number of elements of f"), "qpipoptmat"); error(errmsg); end //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 size of equality constraints is not equal to the number of variables"), "qpipoptmat"); + errmsg = msprintf(gettext("%s: The number of columns in Aeq must be the same as the number of elements of f"), "qpipoptmat"); error(errmsg); end @@ -224,20 +255,20 @@ function [xopt,fopt,exitflag,output,lambda] = qpipoptmat (varargin) //Check the size of constraints of Lower Bound which should equal to the number of constraints if ( size(b,1) ~= nbConInEq & size(b,1) ~= 0) then - errmsg = msprintf(gettext("%s: The Lower Bound of inequality constraints is not equal to the number of constraints"), "qpipoptmat"); + errmsg = msprintf(gettext("%s: The number of rows in A must be the same as the number of elementsof b"), "qpipoptmat"); error(errmsg); end //Check the size of constraints of Upper Bound which should equal to the number of constraints if ( size(beq,1) ~= nbConEq & size(beq,1) ~= 0) then - errmsg = msprintf(gettext("%s: The Upper Bound of equality constraints is not equal to the number of constraints"), "qpipoptmat"); + errmsg = msprintf(gettext("%s: The number of rows in Aeq must be the same as the number of elements of beq"), "qpipoptmat"); error(errmsg); end //Check the size of initial of variables which should equal to the number of variables if ( size(x0,1) ~= nbVar) then - errmsg = msprintf(gettext("%s: The initial guess of variables is not equal to the number of variables"), "qpipoptmat"); - error(errmsg); + warnmsg = msprintf(gettext("%s: Ignoring initial guess of variables as it is not equal to the number of variables"), "qpipopt"); + warning(warnmsg); end diff --git a/macros/symphony.bin b/macros/symphony.bin Binary files differindex d2aa822..2ef2f57 100644 --- a/macros/symphony.bin +++ b/macros/symphony.bin diff --git a/macros/symphony.sci b/macros/symphony.sci index 9677720..0f57751 100644 --- a/macros/symphony.sci +++ b/macros/symphony.sci @@ -19,20 +19,20 @@ function [xopt,fopt,status,output] = symphony (varargin) // [xopt,fopt,status,output] = symphony( ... ) // // Parameters - // nbVar : a 1 x 1 matrix of doubles, number of variables - // nbCon : a 1 x 1 matrix of doubles, number of constraints - // objCoeff : a 1 x n matrix of doubles, where n is number of variables, contains coefficients of the variables in the objective - // isInt : a 1 x n matrix of boolean, where n is number of variables, representing wether a variable is constrained to be an integer - // LB : a 1 x n matrix of doubles, where n is number of variables, contains lower bounds of the variables. Bound can be negative infinity - // UB : a 1 x n matrix of doubles, where n is number of variables, contains upper bounds of the variables. Bound can be infinity - // conMatrix : a m x n matrix of doubles, where n is number of variables and m is number of constraints, contains matrix representing the constraint matrix - // conLB : a m x 1 matrix of doubles, where m is number of constraints, contains lower bounds of the constraints. - // conUB : a m x 1 matrix of doubles, where m is number of constraints, contains upper bounds of the constraints - // objSense : The sense (maximization/minimization) of the objective. Use 1(sym_minimize ) or -1 (sym_maximize) here - // options : a 1xq marix of string, provided to set the paramters in symphony - // xopt : a 1xn matrix of doubles, the computed solution of the optimization problem - // fopt : a 1x1 matrix of doubles, the function value at x - // status : status flag from symphony + // nbVar : a double, number of variables. + // nbCon : a double, number of constraints. + // objCoeff : a 1 x n matrix of doubles, where n is number of variables, represents coefficients of the variables in the objective. + // isInt : a vector of boolean, represents wether a variable is constrained to be an integer. + // LB : a vector of doubles, represents lower bounds of the variables. + // UB : a vector of doubles, represents upper bounds of the variables. + // conMatrix : a matrix of doubles, represents matrix representing the constraint matrix. + // conLB : a vector of doubles, represents lower bounds of the constraints. + // conUB : a vector of doubles, represents upper bounds of the constraints + // objSense : The sense (maximization/minimization) of the objective. Use 1(sym_minimize ) or -1 (sym_maximize) here. + // options : a a list containing the the parameters to be set. + // xopt : a vector of doubles, the computed solution of the optimization problem. + // fopt : a double, the function value at x. + // status : status flag from symphony. // output : The output data structure contains detailed informations about the optimization process. // // Description @@ -53,11 +53,11 @@ function [xopt,fopt,status,output] = symphony (varargin) // Examples // //A basic case : // // Objective function - // c = [350*5,330*3,310*4,280*6,500,450,400,100] + // c = [350*5,330*3,310*4,280*6,500,450,400,100]'; // // Lower Bound of variable - // lb = repmat(0,1,8); + // lb = repmat(0,8,1); // // Upper Bound of variables - // ub = [repmat(1,1,4) repmat(%inf,1,4)]; + // ub = [repmat(1,4,1);repmat(%inf,4,1)]; // // Constraint Matrix // conMatrix = [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; @@ -90,7 +90,7 @@ function [xopt,fopt,status,output] = symphony (varargin) // 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] + // 1162 653 814 625 599 476 767 954 906 904 649 873 565 853 1008 632]'; // //Constraint Matrix // conMatrix = [ // //Constraint 1 @@ -137,9 +137,9 @@ function [xopt,fopt,status,output] = symphony (varargin) // nbCon = size(conMatrix,1) // nbVar = size(conMatrix,2) // // Lower Bound of variables - // lb = repmat(0,1,nbVar) + // lb = repmat(0,nbVar,1) // // Upper Bound of variables - // ub = repmat(1,1,nbVar) + // ub = repmat(1,nbVar,1) // // Row Matrix for telling symphony that the is integer or not // isInt = repmat(%t,1,nbVar) // // Lower Bound of constrains @@ -185,43 +185,103 @@ function [xopt,fopt,status,output] = symphony (varargin) objSense = varargin(10); end - if (rhs<11) then + if (rhs<11|size(varargin(11)==0)) then options = list(); else options = varargin(11); end - -//Check the size of constraint which should equal to the number of constraints - if ( size(conMatrix,1) ~= nbCon) then - errmsg = msprintf(gettext("%s: The Lower Bound is not equal to the number of variables"), "Symphony"); +// Check if the user gives row vector +// and Changing it to a column matrix + + if (size(isInt,2)== [nbVar]) then + isInt = isInt'; + end + + if (size(LB,2)== [nbVar]) then + LB = LB'; + end + + if (size(UB,2)== [nbVar]) then + UB = UB'; + end + + if (size(conLB,2)== [nbVar]) then + conLB = conLB'; + end + + if (size(conUB,2)== [nbVar]) then + conUB = conUB'; + end + + + if (size(objCoef,2)~=1) then + errmsg = msprintf(gettext("%s: Objective Coefficients should be a column matrix"), "Symphony"); + error(errmsg); + end + + if (size(objCoef,1)~=nbVar) then + errmsg = msprintf(gettext("%s: Number of variables in Objective Coefficients is not equal to number of variables given"), "Symphony"); + error(errmsg); + end + + //Check the size of isInt which should equal to the number of variables + if(size(isInt,1)~=nbVar) then + errmsg = msprintf(gettext("%s: The size of isInt is not equal to the number of variables"), "Symphony"); + error(errmsg); + end + + //Check the size of lower bound of inequality constraint which should equal to the number of constraints + if ( size(conLB,1) ~= nbCon) then + errmsg = msprintf(gettext("%s: The Lower Bound of constraint is not equal to the number of constraint"), "Symphony"); error(errmsg); end -//Check the size of Lower Bound which should equal to the number of variables - if ( size(LB,2) ~= nbVar) then - errmsg = msprintf(gettext("%s: The Lower Bound is not equal to the number of variables"), "Symphony"); + //Check the size of lower bound of inequality constraint which should equal to the number of constraints + if ( size(conUB,1) ~= nbCon) then + errmsg = msprintf(gettext("%s: The Upper Bound of constraint is not equal to the number of constraint"), "Symphony"); error(errmsg); end -//Check the size of Upper Bound which should equal to the number of variables - if ( size(UB,2) ~= nbVar) then - errmsg = msprintf(gettext("%s: The Upper Bound is not equal to the number of variables"), "Symphony"); + //Check the row of constraint which should equal to the number of constraints + if ( size(conMatrix,1) ~= nbCon) then + errmsg = msprintf(gettext("%s: The number of rows in constraint should be equal to the number of constraints"), "Symphony"); error(errmsg); end -//Check the size of constraints of Lower Bound which should equal to the number of constraints - if ( size(conLB,1) ~= nbCon) then - errmsg = msprintf(gettext("%s: The Lower Bound of constraints is not equal to the number of constraints"), "Symphony"); + //Check the column of constraint which should equal to the number of variables + if ( size(conMatrix,2) ~= nbVar) then + errmsg = msprintf(gettext("%s: The number of columns in constraint should equal to the number of variables"), "Symphony"); error(errmsg); end -//Check the size of constraints of Upper Bound which should equal to the number of constraints - if ( size(conUB,1) ~= nbCon) then - errmsg = msprintf(gettext("%s: The Upper Bound of constraints is not equal to the number of constraints"), "Symphony"); + //Check the size of Lower Bound which should equal to the number of variables + if ( size(LB,1) ~= nbVar) then + errmsg = msprintf(gettext("%s: The Lower Bound is not equal to the number of variables"), "Symphony"); error(errmsg); end + //Check the size of Upper Bound which should equal to the number of variables + if ( size(UB,1) ~= nbVar) then + errmsg = msprintf(gettext("%s: The Upper Bound is not equal to the number of variables"), "Symphony"); + error(errmsg); + end + + if (type(options) ~= 15) then + errmsg = msprintf(gettext("%s: Options should be a list "), "Symphony"); + error(errmsg); + end + + if (modulo(size(options),2)) then + errmsg = msprintf(gettext("%s: Size of parameters should be even"), "Symphony"); + error(errmsg); + end + + LB = LB'; + UB = UB'; + isInt = isInt'; + objCoef = objCoef'; + [xopt,fopt,status,output] = symphony_call(nbVar,nbCon,objCoef,isInt,LB,UB,conMatrix,conLB,conUB,objSense,options); endfunction diff --git a/macros/symphonymat.bin b/macros/symphonymat.bin Binary files differindex 5089973..01460d6 100644 --- a/macros/symphonymat.bin +++ b/macros/symphonymat.bin diff --git a/macros/symphonymat.sci b/macros/symphonymat.sci index ef70b7c..87427e1 100644 --- a/macros/symphonymat.sci +++ b/macros/symphonymat.sci @@ -20,8 +20,8 @@ function [xopt,fopt,status,iter] = symphonymat (varargin) // [xopt,fopt,status,output] = symphonymat( ... ) // // Parameters - // f : a 1xn matrix of doubles, where n is number of variables, 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 + // f : a vector of doubles, where n is number of variables, 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 doubles. A represents the linear coefficients in the constraints A*x тЄ b. A has size M-by-N, where M is the number of constraints and N is number of variables // b : Linear inequality constraint vector, specified as a vector of doubles. b represents the constant vector in the constraints A*x тЄ b. b has length M, where A is M-by-N // Aeq : Linear equality constraint matrix, specified as a matrix of doubles. Aeq represents the linear coefficients in the constraints Aeq*x = beq. Aeq has size Meq-by-N, where Meq is the number of constraints and N is number of variables @@ -41,7 +41,8 @@ function [xopt,fopt,status,iter] = symphonymat (varargin) // \begin{eqnarray} // &\mbox{min}_{x} // & f(x) \\ - // & \text{subject to} & conLB \leq C(x) \leq conUB \\ + // & \text{subject to} & A.x \leq b \\ + // & & Aeq.x \leq beq \\ // & & lb \leq x \leq ub \\ // \end{eqnarray} // </latex> @@ -50,7 +51,7 @@ function [xopt,fopt,status,iter] = symphonymat (varargin) // // Examples // // Objective function - // c = [350*5,330*3,310*4,280*6,500,450,400,100] + // c = [350*5,330*3,310*4,280*6,500,450,400,100]'; // // Lower Bound of variable // lb = repmat(0,1,8); // // Upper Bound of variables @@ -81,7 +82,7 @@ function [xopt,fopt,status,iter] = symphonymat (varargin) // 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] + // 1162 653 814 625 599 476 767 954 906 904 649 873 565 853 1008 632]'; // //Constraint Matrix // conMatrix = [ //Constraint 1 // 42 41 523 215 819 551 69 193 582 375 367 478 162 898 .. @@ -131,7 +132,7 @@ function [xopt,fopt,status,iter] = symphonymat (varargin) // // Upper Bound of variables // ub = repmat(1,1,nbVar) // // Lower Bound of constrains - // intcon = [] + // intcon = []; // for i = 1:nbVar // intcon = [intcon i]; // end @@ -164,34 +165,24 @@ function [xopt,fopt,status,iter] = symphonymat (varargin) intcon = varargin(2) A = varargin(3) b = varargin(4) - - nbVar = size(objCoef,2); - nbCon = size(A,1); - - if ( rhs<4 ) then + + if (size(objCoef,2)~=1) then + errmsg = msprintf(gettext("%s: Objective Coefficients should be a column matrix"), "Symphonymat"); + error(errmsg); + end + + + nbVar = size(objCoef,1); + + if ( rhs<5 ) then Aeq = [] beq = [] else Aeq = varargin(5); beq = varargin(6); - - if (size(Aeq,1)~=0) then - //Check the size of equality constraint which should equal to the number of inequality constraints - if ( size(Aeq,2) ~= nbVar) then - errmsg = msprintf(gettext("%s: The size of equality constraint is not equal to the number of variables"), "Symphony"); - error(errmsg); - end - - //Check the size of upper bound of inequality constraint which should equal to the number of constraints - if ( size(beq,2) ~= size(Aeq,1)) then - errmsg = msprintf(gettext("%s: The equality constraint upper bound is not equal to the number of equality constraint"), "Symphony"); - error(errmsg); - end - end - end - if ( rhs<6 ) then + if ( rhs<7 ) then lb = repmat(-%inf,1,nbVar); ub = repmat(%inf,1,nbVar); else @@ -199,36 +190,105 @@ function [xopt,fopt,status,iter] = symphonymat (varargin) ub = varargin(8); end - if (rhs<9) then + if (rhs<9|size(varargin(9))==0) then options = list(); else options = varargin(9); end - -//Check the size of lower bound of inequality constraint which should equal to the number of constraints - if ( size(b,2) ~= size(A,1)) then - errmsg = msprintf(gettext("%s: The Lower Bound of inequality constraint is not equal to the number of constraint"), "Symphony"); + nbConInEq = size(A,1); + nbConEq = size(Aeq,1); + +// Check if the user gives row vector +// and Changing it to a column matrix + + if (size(lb,2)== [nbVar]) then + lb = lb'; + end + + if (size(ub,2)== [nbVar]) then + ub = ub'; + end + + if (size(b,2)== [nbConInEq]) then + b = b'; + end + + if (size(beq,2)== [nbConEq]) then + beq = beq'; + end + + for i=1:size(intcon,2) + if(intcon(i)>nbVar) then + errmsg = msprintf(gettext("%s: The values inside intcon should not exceed total number of variable "), "Symphonymat"); + error(errmsg); + end + + if (intcon(i)<1) then + errmsg = msprintf(gettext("%s: The values inside intcon should be greater than 0 "), "Symphonymat"); + error(errmsg); + end + + if(modulo(intcon(i),1)) then + errmsg = msprintf(gettext("%s: The values inside intcon should be integer "), "Symphonymat"); + error(errmsg); + end + end + + //Check the size of inequality constraint which should equal to the number of inequality constraints + if ( size(A,2) ~= nbVar & size(A,2) ~= 0) then + errmsg = msprintf(gettext("%s: The size of inequality constraint is not equal to the number of variables"), "Symphonymat"); + error(errmsg); + end + + + //Check the size of lower bound of inequality constraint which should equal to the number of constraints + if ( size(b,1) ~= size(A,1)) then + errmsg = msprintf(gettext("%s: The Lower Bound of inequality constraint is not equal to the number of constraint"), "Symphonymat"); error(errmsg); end -//Check the size of Lower Bound which should equal to the number of variables - if ( size(lb,2) ~= nbVar) then - errmsg = msprintf(gettext("%s: The Lower Bound is not equal to the number of variables"), "Symphony"); + //Check the size of equality constraint which should equal to the number of inequality constraints + if ( size(Aeq,2) ~= nbVar & size(Aeq,2) ~= 0) then + errmsg = msprintf(gettext("%s: The size of equality constraint is not equal to the number of variables"), "Symphonymat"); + error(errmsg); + end + + //Check the size of upper bound of equality constraint which should equal to the number of constraints + if ( size(beq,1) ~= size(Aeq,1)) then + errmsg = msprintf(gettext("%s: The equality constraint upper bound is not equal to the number of equality constraint"), "Symphonymat"); + error(errmsg); + end + + //Check the size of Lower Bound which should equal to the number of variables + if ( size(lb,1) ~= nbVar) then + errmsg = msprintf(gettext("%s: The Lower Bound is not equal to the number of variables"), "Symphonymat"); error(errmsg); end -//Check the size of Upper Bound which should equal to the number of variables - if ( size(ub,2) ~= nbVar) then - errmsg = msprintf(gettext("%s: The Upper Bound is not equal to the number of variables"), "Symphony"); + //Check the size of Upper Bound which should equal to the number of variables + if ( size(ub,1) ~= nbVar) then + errmsg = msprintf(gettext("%s: The Upper Bound is not equal to the number of variables"), "Symphonymat"); error(errmsg); end + if (type(options) ~= 15) then + errmsg = msprintf(gettext("%s: Options should be a list "), "Symphonymat"); + error(errmsg); + end + + + if (modulo(size(options),2)) then + errmsg = msprintf(gettext("%s: Size of parameters should be even"), "Symphonymat"); + error(errmsg); + end + + //Changing the inputs in symphony's format conMatrix = [A;Aeq] nbCon = size(conMatrix,1); - conLB = [repmat(-%inf,1,size(A,1)), beq]'; - conUB = [b,beq]' ; + conLB = [repmat(-%inf,size(A,1),1); beq]; + conUB = [b;beq] ; isInt = repmat(%f,1,nbVar); for i=1:size(intcon,2) @@ -236,7 +296,13 @@ function [xopt,fopt,status,iter] = symphonymat (varargin) end objSense = 1; + + //Changing into row vector + lb = lb'; + ub = ub'; + objCoef = objCoef'; + [xopt,fopt,status,iter] = symphony_call(nbVar,nbCon,objCoef,isInt,lb,ub,conMatrix,conLB,conUB,objSense,options); endfunction |