**Appendix: the GAMS sample code**

#### \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

#### **Defining Route i and Shift j**

Sets i Routes /1 ∗ 93/ This sets routes from route 1 to route 93. j Time periods /1 ∗ 4/; Sets shifts from shift 1 to shift 4. **Sample Demand distribution per route per shift** Table d(i, j) demand distribution on route *i* on time shift *j*


Solve eq using lp minimizing Z;

*DOI: http://dx.doi.org/10.5772/intechopen.93629*

*Linear Programming Optimization Techniques for Addis Ababa Public Bus Transport*

display X.l; display Y.l; **\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***

**Author details**

**155**

Eshetie Berhan\* and Daniel Kitaw

provided the original work is properly cited.

Addis Ababa University, Addis Ababa Institute of Technology, School of

© 2020 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/ by/3.0), which permits unrestricted use, distribution, and reproduction in any medium,

Mechanical and Industrial Engineering, Addis Ababa, Ethiopia

\*Address all correspondence to: berhan.eshetie@gmail.com

**Trip Proportion (Pi)** 12 34 1 7 12 8 3 2 47 52 3 47 52 . .... . .... . .... 92 8 5 2 93 5 9 6 2 /1 7 2 12 3 8 4 3/ *P(i) demand proportion of route i from all routes /* 1 0.014 2 0.012 3 0.040 . . . . . . 92 0.012 93 0.009/; **Decision Variables** *X(ij) Number of Bus type-I for route i during shift j Y (ij) Number of Bus type-II for route i during shift j; Variable Z; For the objective function* **Model Equation** *obj.. Z=e=sum((i,j), X(i,j))+ sum((i,j), Y(i,j)); const1.. sum((i,j), X(i,j))\*60 + sum((i,j), Y(i,j))\*90 =g= sum((i,j),d(i,j)); const2.. sum((i,j), X(i,j))=l= sum((i,j),T(i,j))\*600; const3.. sum((i,j), Y(i,j))=l= sum((i,j),T(i,j))\*90; const4.. sum((i,j), X(i,j))+ sum((i,j), Y(i,j)) =g= sum(j, M(j)); const5.. sum((i,j), X(i,j))+ sum((i,j), Y(i,j))=l=sum((i,j),T(i,j))\*690;* Since bus type-II has greater capacity, priority is given so that demand is to be served by the available capacity of Y for that route to reduce number of buses required and if it is beyond the available number of Y for that route then the rest is to be served by the available number of X. Thus, based on this assumption the following equation sets the lower bound to values of X and Y, if not since it is minimization it starts from zero and can't display the appropriate mix of X and Y. *Y.lo(i, j)\$[(d(i, j)/90)* ≤ *(T(i, j) \* P(i) \* 90)] = d(i, j)/90; lower bound for Y Y.lo(i, j)\$[(d(i, j)/90)* ≥ *(P(i) \* T(i, j) \* 90)] = P(i) \*T(i, j) \* 90; X.lo(i, j)\$[(d(i, j)/90)* ≥ *(P(i) \* T(i, j) \* 90)] = (d(i, j)/60) (P(i) \* T(i, j) \* 90); \*lower bound for X\* X.lo(i, j)\$[((d(i, j)/60)(P(i)\*T(i, j)\*90))* ≥ *(P(i)\*T(i, j)\*600)] = (P(i)\*T(i, j)\* 600);*

Thus from this, the assignment of bus type X depends on the assignment of Y and X is

assigned for a given route if the expected demand during that time period is beyond

the capacity and availability of bus type Y Model eq / All / ;

*Linear Programming Optimization Techniques for Addis Ababa Public Bus Transport DOI: http://dx.doi.org/10.5772/intechopen.93629*

Solve eq using lp minimizing Z; display X.l; display Y.l; **\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***

*P(i) demand proportion of route i from all routes /*

*Concepts, Applications and Emerging Opportunities in Industrial Engineering*

*X(ij) Number of Bus type-I for route i during shift j Y (ij) Number of Bus type-II for route i during shift j;*

*obj.. Z=e=sum((i,j), X(i,j))+ sum((i,j), Y(i,j));*

the capacity and availability of bus type Y

*const2.. sum((i,j), X(i,j))=l= sum((i,j),T(i,j))\*600; const3.. sum((i,j), Y(i,j))=l= sum((i,j),T(i,j))\*90;*

*const4.. sum((i,j), X(i,j))+ sum((i,j), Y(i,j)) =g= sum(j, M(j)); const5.. sum((i,j), X(i,j))+ sum((i,j), Y(i,j))=l=sum((i,j),T(i,j))\*690;*

*Y.lo(i, j)\$[(d(i, j)/90)* ≥ *(P(i) \* T(i, j) \* 90)] = P(i) \*T(i, j) \* 90;*

*const1.. sum((i,j), X(i,j))\*60 + sum((i,j), Y(i,j))\*90 =g= sum((i,j),d(i,j));*

Since bus type-II has greater capacity, priority is given so that demand is to be served by the available capacity of Y for that route to reduce number of buses required and if it is beyond the available number of Y for that route then the rest is to be served by the available number of X. Thus, based on this assumption the following equation sets the lower bound to values of X and Y, if not since it is minimization it starts from zero and can't display the appropriate mix of X and Y. *Y.lo(i, j)\$[(d(i, j)/90)* ≤ *(T(i, j) \* P(i) \* 90)] = d(i, j)/90; lower bound for Y*

*X.lo(i, j)\$[(d(i, j)/90)* ≥ *(P(i) \* T(i, j) \* 90)] = (d(i, j)/60) (P(i) \* T(i, j) \* 90);*

*X.lo(i, j)\$[((d(i, j)/60)(P(i)\*T(i, j)\*90))* ≥ *(P(i)\*T(i, j)\*600)] = (P(i)\*T(i, j)\**

Thus from this, the assignment of bus type X depends on the assignment of Y

assigned for a given route if the expected demand during that time period is

*Variable Z; For the objective function*

1 0.014 2 0.012 3 0.040 . . . . . . 92 0.012 93 0.009/;

**Decision Variables**

**Model Equation**

*\*lower bound for X\**

Model eq / All / ;

*600);*

and X is

beyond

**154**
