summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorHarpreet2015-09-01 02:57:49 +0530
committerHarpreet2015-09-01 02:57:49 +0530
commitd8e0fa36cb1bd4e00307792008aca1d56043b15a (patch)
tree20256a873f0ccbd7d5bb4a18cab41dc9c83ddaac /macros
parentb9490a903ae42debe53a96b224d508974c86db6e (diff)
downloadFOSSEE-Optimization-toolbox-d8e0fa36cb1bd4e00307792008aca1d56043b15a.tar.gz
FOSSEE-Optimization-toolbox-d8e0fa36cb1bd4e00307792008aca1d56043b15a.tar.bz2
FOSSEE-Optimization-toolbox-d8e0fa36cb1bd4e00307792008aca1d56043b15a.zip
Help and Symphony equivalent to intlinprog
Diffstat (limited to 'macros')
-rw-r--r--macros/setOptions.binbin4100 -> 3164 bytes
-rw-r--r--macros/setOptions.sci3
-rw-r--r--macros/symphony.binbin18644 -> 42700 bytes
-rw-r--r--macros/symphony.sci157
-rw-r--r--macros/symphony_call.binbin3488 -> 3592 bytes
-rw-r--r--macros/symphony_mat.binbin16464 -> 45256 bytes
-rw-r--r--macros/symphony_mat.sci176
7 files changed, 269 insertions, 67 deletions
diff --git a/macros/setOptions.bin b/macros/setOptions.bin
index f591286..c0bb197 100644
--- a/macros/setOptions.bin
+++ b/macros/setOptions.bin
Binary files differ
diff --git a/macros/setOptions.sci b/macros/setOptions.sci
index 9d1be61..4fe4ac1 100644
--- a/macros/setOptions.sci
+++ b/macros/setOptions.sci
@@ -14,9 +14,6 @@ function setOptions(varagin)
options = varagin(1);
nbOpt = size(options,2);
-
-
-
value = strtod(options)
if (nbOpt~=0) then
diff --git a/macros/symphony.bin b/macros/symphony.bin
index d096d76..3d3d03a 100644
--- a/macros/symphony.bin
+++ b/macros/symphony.bin
Binary files differ
diff --git a/macros/symphony.sci b/macros/symphony.sci
index 9b74898..01c93e1 100644
--- a/macros/symphony.sci
+++ b/macros/symphony.sci
@@ -10,54 +10,154 @@
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
function [xopt,fopt,iter] = symphony (varargin)
-
// Solves a mixed integer linear programming constrained optimization problem.
//
// Calling Sequence
- //
// xopt = symphony(nbVar,nbCon,objCoef,isInt,LB,UB,conMatrix,conLB,conUB)
// xopt = symphony(nbVar,nbCon,objCoef,isInt,LB,UB,conMatrix,conLB,conUB,objSense)
// xopt = symphony(nbVar,nbCon,objCoef,isInt,LB,UB,conMatrix,conLB,conUB,objSense,options)
// [xopt,fopt,iter] = 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
-
- // xopt = a 1xn matrix of doubles, the computed solution of the optimization problem
- // fopt = a 1x1 matrix of doubles, the function value at x
- // iter = a 1x1 matrix of doubles, contains the number od iterations done by symphony
+ // 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
+ // iter : a 1x1 matrix of doubles, contains the number od iterations done by symphony
//
// 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}
- // \mbox{min}_{x}
- // & & f(x) \\
- // & \text{subject to}
- // & & conLB \geq C(x) \leq conUB \\
- // & & & lb \geq x \leq ub \\
+ // &\mbox{min}_{x}
+ // & f(x) \\
+ // & \text{subject to} & conLB \geq C(x) \leq conUB \\
+ // & & lb \geq x \leq ub \\
// \end{eqnarray}
// </latex>
//
//
- //
- //
- //
-
-
+ //
+ // Examples
+ // //A basic case :
+ // // 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
+ // 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;
+ // 5*0.03,3*0.03,4*0.04,6*0.04,0.06,0.07,0.08,0.09;]
+ // // Lower Bound of constrains
+ // conlb = [ 25; 1.25; 1.25]
+ // // Upper Bound of constrains
+ // conub = [ 25; 1.25; 1.25]
+ // // Row Matrix for telling symphony that the is integer or not
+ // isInt = [repmat(%t,1,4) repmat(%f,1,4)];
+ // xopt = [1 1 0 1 7.25 0 0.25 3.5]
+ // fopt = [8495]
+ // // Calling Symphony
+ // [x,f,iter] = symphony(8,3,c,isInt,lb,ub,conMatrix,conlb,conub,1);
+ // 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)
+ // p = [ 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
+ // 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 ..
+ // 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 ;
+ // ];
+ // nbCon = size(conMatrix,1)
+ // nbVar = size(conMatrix,2)
+ // // Lower Bound of variables
+ // lb = repmat(0,1,nbVar)
+ // // Upper Bound of variables
+ // ub = repmat(1,1,nbVar)
+ // // Row Matrix for telling symphony that the is integer or not
+ // isInt = repmat(%t,1,nbVar)
+ // // Lower Bound of constrains
+ // conLB=repmat(0,nbCon,1);
+ // // Upper Bound of constraints
+ // conUB=[11927 13727 11551 13056 13460 ]';
+ // options = ["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,iter]= symphony(nbVar,nbCon,p,isInt,lb,ub,conMatrix,conLB,conUB,-1,options)
+ //
+ // Authors
+ // Keyur Joshi, Saikiran, Iswarya, Harpreet Singh
+
//To check the number of input and output argument
[lhs , rhs] = argn();
@@ -123,3 +223,4 @@ function [xopt,fopt,iter] = symphony (varargin)
[xopt,fopt,iter] = symphony_call(nbVar,nbCon,objCoef,isInt,LB,UB,conMatrix,conLB,conUB,objSense,options);
endfunction
+
diff --git a/macros/symphony_call.bin b/macros/symphony_call.bin
index 27d7f4a..49ff7cb 100644
--- a/macros/symphony_call.bin
+++ b/macros/symphony_call.bin
Binary files differ
diff --git a/macros/symphony_mat.bin b/macros/symphony_mat.bin
index fdaf7e6..21ebf8c 100644
--- a/macros/symphony_mat.bin
+++ b/macros/symphony_mat.bin
Binary files differ
diff --git a/macros/symphony_mat.sci b/macros/symphony_mat.sci
index 377fe90..a0fa895 100644
--- a/macros/symphony_mat.sci
+++ b/macros/symphony_mat.sci
@@ -10,8 +10,6 @@
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
function [xopt,fopt,iter] = symphony_mat (varargin)
-
-
// Solves a mixed integer linear programming constrained optimization problem.
//
// Calling Sequence
@@ -22,36 +20,135 @@ function [xopt,fopt,iter] = symphony_mat (varargin)
// [xopt,fopt,iter] = symphony_mat( ... )
//
// Parameters
- // f = a nx1 matrix of doubles,
- // intcon =
- // A =
- // b =
- // Aeq =
- // beq =
- // lb =
- // ub =
- // options =
- //
- // xopt = a 1xn matrix of doubles, the computed solution of the optimization problem
- // fopt = a 1x1 matrix of doubles, the function value at x
- // iter = a 1x1 matrix of doubles, contains the number od iterations done by symphony
+ // 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
+ // 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
+ // beq : Linear equality constraint vector, specified as a vector of doubles. beq represents the constant vector in the constraints Aeq*x = beq. beq has length Meq, where Aeq is Meq-by-N.
+ // lb : Lower bounds, specified as a vector or array of doubles. lb represents the lower bounds elementwise in lb ≤ x ≤ ub.
+ // ub : Upper bounds, specified as a vector or array of doubles. ub represents the upper bounds elementwise in lb ≤ x ≤ ub.
+ // 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
+ // iter : a 1x1 matrix of doubles, contains the number od iterations done by symphony
//
// 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}
- // \mbox{min}_{x}
- // & & f(x) \\
- // & \text{subject to}
- // & & conLB \geq C(x) \leq conUB \\
- // & & & lb \geq x \leq ub \\
+ // \begin{eqnarray}
+ // \mbox{min}_{x} & f(x) \\
+ // \mbox{subject to} & c(x) \leq 0 \\
+ // & c_{eq}(x) = 0 \\
+ // & Ax \leq b \\
+ // & A_{eq} x = b_{eq} \\
+ // & lb \leq x \leq ub
// \end{eqnarray}
- // </latex>
+ // </latex>
+ //
+ // 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,iter] = symphony_mat(c,intcon,[],[],Aeq,beq,lb,ub);
+ //
+ // 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)
+ // objCoef = -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
+ // 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 ..
+ // 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(objCoef,2)
+ // 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 = []
+ // for i = 1:nbVar
+ // intcon = [intcon i];
+ // end
+ // // 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,iter] = symphony_mat(objCoef,intcon,conMatrix,conUB,[],[],lb,ub);
+ //
+ // Authors
+ // Keyur Joshi, Saikiran, Iswarya, Harpreet Singh
+
-
//To check the number of input and output argument
[lhs , rhs] = argn();
@@ -67,7 +164,7 @@ function [xopt,fopt,iter] = symphony_mat (varargin)
A = varargin(3)
b = varargin(4)
- nbVar = size(f,2);
+ nbVar = size(objCoef,2);
nbCon = size(A,1);
if ( rhs<4 ) then
@@ -77,18 +174,20 @@ function [xopt,fopt,iter] = symphony_mat (varargin)
Aeq = varargin(5);
beq = varargin(6);
- //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
+ 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
- //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
if ( rhs<6 ) then
@@ -130,6 +229,11 @@ function [xopt,fopt,iter] = symphony_mat (varargin)
conLB = [repmat(-%inf,1,size(A,1)), beq]';
conUB = [b,beq]' ;
+ isInt = repmat(%f,1,nbVar);
+ for i=1:size(intcon,2)
+ isInt(intcon(i)) = %t
+ end
+
objSense = 1;
[xopt,fopt,iter] = symphony_call(nbVar,nbCon,objCoef,isInt,lb,ub,conMatrix,conLB,conUB,objSense,options);