diff options
author | Harpreet | 2015-12-29 00:38:48 +0530 |
---|---|---|
committer | Harpreet | 2015-12-29 00:38:48 +0530 |
commit | eb9ca1191c94059cd7adcf69805906c809fe9712 (patch) | |
tree | f98e728341812b8a0eb46aa4159b062a22225f05 /demos | |
parent | 0eee95dfb1edec6ce52ec3065a3adb1bf169c9f9 (diff) | |
download | FOSSEE-Optimization-toolbox-eb9ca1191c94059cd7adcf69805906c809fe9712.tar.gz FOSSEE-Optimization-toolbox-eb9ca1191c94059cd7adcf69805906c809fe9712.tar.bz2 FOSSEE-Optimization-toolbox-eb9ca1191c94059cd7adcf69805906c809fe9712.zip |
Bugs fixed 4
Diffstat (limited to 'demos')
-rw-r--r-- | demos/lsqlin.dem.sce | 2 | ||||
-rw-r--r-- | demos/qpipopt.dem.sce | 16 | ||||
-rw-r--r-- | demos/symphony.dem.sce | 22 | ||||
-rw-r--r-- | demos/symphonymat.dem.sce | 8 |
4 files changed, 24 insertions, 24 deletions
diff --git a/demos/lsqlin.dem.sce b/demos/lsqlin.dem.sce index fb4bad9..0b81630 100644 --- a/demos/lsqlin.dem.sce +++ b/demos/lsqlin.dem.sce @@ -24,7 +24,7 @@ b = [0.5251 // Press ENTER to continue halt() // Press return to continue -//A basic example for equality, inequality and bounds +//A basic example for equality, inequality constraints and variable bounds C = [0.9501 0.7620 0.6153 0.4057 0.2311 0.4564 0.7919 0.9354 0.6068 0.0185 0.9218 0.9169 diff --git a/demos/qpipopt.dem.sce b/demos/qpipopt.dem.sce index 41b8314..8e405e1 100644 --- a/demos/qpipopt.dem.sce +++ b/demos/qpipopt.dem.sce @@ -4,7 +4,7 @@ mode(1) // //Find x in R^6 such that: -conMatrix= [1,-1,1,0,3,1; +A= [1,-1,1,0,3,1; -1,0,-3,-4,5,6; 2,5,3,0,1,0 0,1,0,1,2,-1; @@ -13,13 +13,13 @@ conLB=[1;2;3;-%inf;-%inf]; conUB = [1;2;3;-1;2.5]; lb=[-1000;-10000; 0; -1000; -1000; -1000]; ub=[10000; 100; 1.5; 100; 100; 1000]; -//and minimize 0.5*x'*Q*x + p'*x with -p=[1; 2; 3; 4; 5; 6]; Q=eye(6,6); +//and minimize 0.5*x'⋅H⋅x + f'⋅x with +f=[1; 2; 3; 4; 5; 6]; H=eye(6,6); nbVar = 6; nbCon = 5; x0 = repmat(0,nbVar,1); param = list("MaxIter", 300, "CpuTime", 100); -[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB,x0,param) +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0,param) // Press ENTER to continue halt() // Press return to continue @@ -30,14 +30,14 @@ halt() // Press return to continue // –x1 + 2x2 ≤ 2 // 2x1 + x2 ≤ 3 // 0 ≤ x1, 0 ≤ x2. -Q = [1 -1; -1 2]; -p = [-2; -6]; -conMatrix = [1 1; -1 2; 2 1]; +H = [1 -1; -1 2]; +f = [-2; -6]; +A = [1 1; -1 2; 2 1]; conUB = [2; 2; 3]; conLB = [-%inf; -%inf; -%inf]; lb = [0; 0]; ub = [%inf; %inf]; nbVar = 2; nbCon = 3; -[xopt,fopt,exitflag,output,lambda] = qpipopt(nbVar,nbCon,Q,p,lb,ub,conMatrix,conLB,conUB) +[xopt,fopt,exitflag,output,lambda] = qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB) //========= E N D === O F === D E M O =========// diff --git a/demos/symphony.dem.sce b/demos/symphony.dem.sce index 9dcf6d7..67886a3 100644 --- a/demos/symphony.dem.sce +++ b/demos/symphony.dem.sce @@ -5,25 +5,25 @@ mode(1) //A basic case : // Objective function -objCoef = [350*5,330*3,310*4,280*6,500,450,400,100]'; +c = [350*5,330*3,310*4,280*6,500,450,400,100]'; // Lower Bound of variable lb = repmat(0,8,1); // Upper Bound of variables ub = [repmat(1,4,1);repmat(%inf,4,1)]; // Constraint Matrix -conMatrix = [5,3,4,6,1,1,1,1; +A = [5,3,4,6,1,1,1,1; 5*0.05,3*0.04,4*0.05,6*0.03,0.08,0.07,0.06,0.03; 5*0.03,3*0.03,4*0.04,6*0.04,0.06,0.07,0.08,0.09;] -// Lower Bound of constrains +// Lower Bound of constraints conlb = [ 25; 1.25; 1.25] -// Upper Bound of constrains +// Upper Bound of constraints conub = [ 25; 1.25; 1.25] // Row Matrix for telling symphony that the is integer or not isInt = [repmat(%t,1,4) repmat(%f,1,4)]; xopt = [1 1 0 1 7.25 0 0.25 3.5] fopt = [8495] // Calling Symphony -[x,f,status,output] = symphony(8,3,c,isInt,lb,ub,conMatrix,conlb,conub,1) +[x,f,status,output] = symphony(8,3,c,isInt,lb,ub,A,conlb,conub,1) // Press ENTER to continue halt() // Press return to continue @@ -37,7 +37,7 @@ halt() // Press return to continue // 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 .. +c = [ 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 .. @@ -45,7 +45,7 @@ p = [ 504 803 667 1103 834 585 811 856 690 832 846 813 868 793 .. 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 = [ +A = [ //Constraint 1 42 41 523 215 819 551 69 193 582 375 367 478 162 898 .. 550 553 298 577 493 183 260 224 852 394 958 282 402 604 .. @@ -87,15 +87,15 @@ conMatrix = [ 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) +nbCon = size(A,1) +nbVar = size(A,2) // Lower Bound of variables lb = repmat(0,nbVar,1) // Upper Bound of variables 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 +// Lower Bound of constraints conLB=repmat(0,nbCon,1); // Upper Bound of constraints conUB=[11927 13727 11551 13056 13460 ]'; @@ -108,5 +108,5 @@ 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 .. // Optimal value fopt = [ 24381 ] // Calling Symphony -[x,f,status,output] = symphony(nbVar,nbCon,p,isInt,lb,ub,conMatrix,conLB,conUB,-1,options); +[x,f,status,output] = symphony(nbVar,nbCon,c,isInt,lb,ub,A,conLB,conUB,-1,options); //========= E N D === O F === D E M O =========// diff --git a/demos/symphonymat.dem.sce b/demos/symphonymat.dem.sce index bc0f67a..a5e19ac 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 @@ -30,7 +30,7 @@ halt() // Press return to continue // st sum{j=1,...,n} r(i,j)x(j) <= b(i) i=1,...,m // x(j)=0 or 1 // The function to be maximize i.e. P(j) -C = -1*[ 504 803 667 1103 834 585 811 856 690 832 846 813 868 793 .. +c = -1*[ 504 803 667 1103 834 585 811 856 690 832 846 813 868 793 .. 825 1002 860 615 540 797 616 660 707 866 647 746 1006 608 .. 877 900 573 788 484 853 942 630 591 630 640 1169 932 1034 .. 957 798 669 625 467 1051 552 717 654 388 559 555 1104 783 .. @@ -79,7 +79,7 @@ A = [ //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,1) +nbVar = size(c,1) b=[11927 13727 11551 13056 13460 ]; // Lower Bound of variables lb = repmat(0,1,nbVar) @@ -99,5 +99,5 @@ 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 .. // Optimal value fopt = [ 24381 ] // Calling Symphony -[x,f,status,output] = symphonymat(C,intcon,A,b,[],[],lb,ub,options); +[x,f,status,output] = symphonymat(c,intcon,A,b,[],[],lb,ub,options); //========= E N D === O F === D E M O =========// |