^{1}

^{*}

^{1}

Objective:
To improve the teaching quality of water resources optimization teaching and train students to master advanced and quick methods or techniques to solve the problems of integer programming of engineering projects. **Method: **This paper introduces LINGO software to solve integer programming problems in integer programming teaching, and explains the entire process with the example. **Results: **Through the construction of the example model and the use of LINGO software, it shows that
:
the LINGO software programming language is clear
;
the solution to the programming problem is simple
;
the solution speed is fast
;
and the accuracy is high. **Conclusion: **LINGO software can solve complex integer programming models more easily and quickly. It has a wide range of applications and has a strong application value.

Water resources are the basic resources for the survival and development of human society. However, with the rapid development of economy and society, water resources are facing the serious shortage, especially for the northwest and north China. So, it is necessary to optimize the allocation of water resources to achieve efficient water resources use. Optimal allocation of water resources refers to the science of conducting limited and different forms of water resources assignment through engineering and non-engineering measures in a specific basin or region with effective, fair and sustainable principles (Gan et al., 2000) .

The optimal allocation of water resources requires reasonable and effective water resources allocation to maximize the comprehensive benefits. So, it is necessary to use operational research knowledge to make reasonable allocation calculations. In general water resources planning models, the decision variables are usually specified as non-negative real numbers. However, all or part of the decision variables are integers in some actual works, like the deployment of personnel and equipment, the selection of investment projects, the development order of projects, etc. Therefore, the planning problem in which decision variables (partially or completely) are integers is called integer programming (IP).

After long-term development, integer programming has caused complexity in the solution process due to its special integer constraints or 0 - 1 constraints. The branch and bound method, the cut plane method and the hidden enumeration method in traditional mathematical theory cannot meet the requirements of high efficiency, accuracy and fastness in the field of water resources optimization configuration. At the same time, these methods are more suitable for integer linear programming problems. However, it is more difficult to solve the integer programming problem with nonlinear constrained or objective functions. At present, a variety of new algorithms and optimization software are introduced into the field of water resources optimization configuration to solve complex mathematical models. Wu et al. (1992) used FORTRAN language to carry out the programming of hidden enumeration method, and solved the problem of reclaimed water reuse. Zhou (1988) used FORTRAN language to program the branch and bound method, and solved the problem of mine water supply and drainage; Zhong (2005) and Huang (2009) used MATLAB to design the genetic algorithm, and solved the problem of the field planning of the sewage treatment plant and the optimization of the rural water supply scale in the plain area; Li et al. (2007) and Gao (2007) used Visual Basic 6.0 software to carry out the programming of branch and bound method, and solved a series of problems in pump selection and the construction of rural drinking water safety project and water resources optimization in Binzhou City. Lovelady et al. (2009) used the Global Solver of the software LINGO to solve problem of integration of eco-industrial parks for managing water resources. Atilhan et al. (2012) used the software LINGO to solve problem of the optimization of macroscopic water desalination and distribution networks in Qatar. Singh et al. (2013) allocated available land and water resources in order to maximize net annual returns using the LINGO software.

At present, these methods are trying to use the computer to solve the problem quickly. Although the solving problems of water resources optimization configuration were solved in some cases, the following problems still exist: 1) programming is complicated, especially for integer constraint processing; 2) algorithm tends to be complicated, and now many methods are solved by introducing modern optimization algorithms, such as genetic algorithms, which brings uncertainty to the calculation results; 3) there are still some problems with the integer programming problem for solving nonlinear constraint or objective function.

This paper introduces LINGO software, a useful tool for solving planning problems. LINGO is a software for building and solving optimization models. It is convenient, fast and efficient in solving planning problem. At first, it can mainly solve linear programming problems and quadratic programming problems. With version update, currently LINGO can also solve the nonlinear programming problem (Schrage, 1999, 2006) . With its high-quality and efficient solving ability and strong pertinence, LINGO has become an important tool for solving optimization problems at present. At the same time, LINGO uses a common modeling language, which can be used to program optimization problems. There are certain built-in functions that allow users to use them during modeling. Because their language structure is relatively simple and intuitive, it can be used less command statement to describe complex mathematical models. It also provides an interface with other data files, which can easily solve the model, implement input and output of data, and analyze related problems.

Usually, the use of LINGO software to solve the optimization problem mainly includes two major steps: first, the corresponding mathematical model was established based on the actual problem analysis; second, the LINGO program codes were written based on the established mathematical model, and the result was solved by computer using its built-in algorithm.

Based on the above problems, firstly, this paper introduces LINGO software, which was usually used in the field of solving planning problems, into the water resources optimization integer programming teaching. Next, this paper studies the feasibility of its application by examples, and clarifies the scalability of its application. Finally, we think the LINGO software could improve students’ practical ability to solve complex engineering problems.

The integer linear programming model is mainly composed of an objective function, several restrictions and integer constraints of decision variables. The model structure is shown in Equation (1).

opt Z = c 1 x 1 + c 2 x 2 + ⋯ + c n x n s .t . { a 11 x 1 + a 12 x 2 + ⋯ + a 1 n x n ≤ ( = , ≥ ) b 1 ⋮ a m 1 x 1 + a m 2 x 2 + ⋯ + a m n x n ≤ ( = , ≥ ) b m x 1 , x , 2 ⋯ , x n ≥ 0 x 1 , x , 2 ⋯ , x n aretheinteger (1)

The mathematical model of integer programming established by Equation (1) generally has the following characteristics: 1) it has all the features of the linear programming model; 2) if the decision variables in the model are not all integers, it is called Mixed Integer (MIP); 3) if the decision variables in the model are integers, it is called pure IP planning (Pure IP, PIP) or all integer programming (All IP, AIP); 4) if the value of the decision variable in the model is {0, 1}, it is called 0-1 planning and assignment problem is a more special 0 - 1 planning.

Some programming objective functions or constraints of some integer programming models are not all linear functions or all are not linear functions, but some or all of the decision variables are integers. This kind of planning problem is also called integer programming, as shown in Equation (2).

min f ( x ) s .t . { h j ( x ) = 0 j = 1 , 2 , ⋯ , m g k ( x ) ≥ 0 k = 1 , 2 , ⋯ , p x 1 , x , 2 ⋯ , x n ≥ 0 x 1 , x , 2 ⋯ , x n aretheinteger (2)

LINGO software provides a number of simple built-in functions to efficiently and conveniently solve the integer constraints and 0 - 1 constraints in the above integer programming. For example, @bin(x) function, where x is 0 or 1; @gin(x) function, which limits x to an integer; @bnd(L, x, U) function, limits L ≤ x ≤ U; @free(x) function, the default setting of the lower bound of the variable is 0, that is, x can take any real number.

This example is taken from the relevant data in Fang et al. (2003) . Somewhere in northern Xuhuai, China, it is located in the semi-humid warm temperate climate zone. The average annual precipitation is about 800 mm and the interannual variation of precipitation is large. The surface runoff in the flood season accounts for more than 80% runoff of the whole year. There is a reservoir with a capacity of 4.72 × 10^{8} m^{3} as the main water supply project, and a pumping station system with a pumping capacity of 8.00 × 10^{8} m^{3}・a^{−1}. With the development of the local economy and economy, the demand for water is increasing year by year, and the contradiction between supply and demand is prominent. To solve this problem, the local government plans to build a batch of water supply projects during the 25-year construction planning period. It mainly includes: Project 1 raises the normal water storage level of the reservoir, improves the design standard of the reservoir, and increases its water demand capacity; Project 2 repairs and expands the pumping station system to enhance the water diversion capacity; Project 3 opens a water diversion line for cross-border water diversion; Project 4 builts groundwater exploitation facilities and rationally exploit and utilize groundwater resources. The relevant data is shown in ^{8} m^{3}. In the calculation, it is assumed that there is no other limit on the water supply capacity and construction funds during the construction process, and the cash discount rate is 10%. According to this, the appropriate engineering construction sequence is selected to minimize the cost.

The construction period of the project is 25 years, and 4 projects are constructed within this period. It is assumed that the construction period is divided into four construction periods, and only one project is allowed to be completed during each construction period. Therefore, the requested variable is x_{ij}, indicating the state of the i-th project in the j-th construction period.

{ x i j = 1 , indicates that the i -th project was built during the j -th period ， x i j = 0 , indicates that the i -th project does not build during the j -th period ， i , j = 1 , 2 , 3 , 4 (3)

where ∑ i = 1 4 x i j = 1 , j = 1 , 2 , 3 , 4 .

Create an integer programming objective function with the least cost goal:

min P t = ∑ i = 1 4 C i ⋅ x i 1 + [ ∑ j = 2 4 ( ∑ i = 1 4 C i ⋅ x i j ) ( 1 + r ) − T ] (4)

where P_{t} is the total amount of cash posted; C_{i} is the construction fund for the i-th project; r is the cash discount rate, which is 10%.

{ T 1 = ∑ i = 1 4 t i ⋅ x i 1 T 2 = ∑ i = 1 4 t i ⋅ x i 2 T 3 = ∑ i = 1 4 t i ⋅ x i 3 (5)

where t_{i} is the time required for the engineering capacity of the i-th project to meet the water supply needs.

Number | Project scale/100 million m³ | Construction cost/100 million yuan | Engineering capacity to meet the demand for water supply/Year |
---|---|---|---|

1 | 1.28 | 0.65 | 2.68 |

2 | 5.50 | 1.05 | 11.58 |

3 | 4.00 | 1.60 | 8.42 |

4 | 1.00 | 0.40 | 2.11 |

1) Constraints of engineering capacity increases water supply

The engineering capability of the first two stages is required to be at least 5.00 × 10^{8} m^{3}, thus,

∑ i = 1 4 M i ⋅ ( x i 1 + x i 2 ) ≥ 5 (6)

where M_{i} is the engineering capacity of i-th project.

2) Constraints of water supply demand time

Require the first two phases to complete the project to meet the water demand requirement of not less than 10 years, thus,

∑ i = 1 4 t i ⋅ ( x i 1 + x i 2 ) ≥ 10 (7)

where t_{i} is the water supply demand time of i-th project.

3) Constraints of project construction

Because only one project can be built in each construction period, at the same time, each project can only be built once, thus,

{ ∑ i = 1 4 x i j = 1 , j = 1 , 2 , 3 , 4. ∑ j = 1 4 x i j = 1 , j = 1 , 2 , 3 , 4. x i j isequalto1or0; i = 1 , 2 , 3 , 4 ; j = 1 , 2 , 3 , 4. ∑ j = 1 4 ∑ j = 1 4 x i j = 4 (8)

According to formulas (4) to (8), the whole model for constructing the problem is shown in Equation (9).

min P t = ∑ i = 1 4 C i ⋅ x i 1 + [ ∑ j = 2 4 ( ∑ i = 1 4 C i ⋅ x i j ) ( 1 + r ) − T ] { ∑ i = 1 4 M i ⋅ ( x i 1 + x i 2 ) ≥ 5 ∑ i = 1 4 t i ⋅ ( x i 1 + x i 2 ) ≥ 10 ∑ i = 1 4 x i j = 1 , j = 1 , 2 , 3 , 4. ∑ j = 1 4 x i j = 1 , j = 1 , 2 , 3 , 4. x i j isequalto1or0; i = 1 , 2 , 3 , 4 ; j = 1 , 2 , 3 , 4. ∑ j = 1 4 ∑ j = 1 4 x i j = 4 (9)

The built-in integer programming model is programmed in the LINGO software. The LINGO code is shown in

From the program result, x_{21} = 1, x_{42} = 1, x_{13} = 1, x_{34} = 1 and the rest decision variables are 0. Therefore, the implementation order of the plan is Project 2, Project 4, Project 1, and Project 3. The minimum discounted construction cost is 1.69 × 1.0^{4} million yuan. According to the order of calculation results, the water supply growth demand can be satisfied for 25 years.

The LINGO code | The calculation results |
---|---|

model: sets: P/P1..P4/:price;! Construction cost; T/T1..T4/:time;! Engineering capacity to meet the demand for water supply; C/C1..C4/:capacity;! Engineering capacity; links(P,T):x; endsets min=@sum(P(i):price(i)*x(i,1))+ @sum(P(i):price(i)*x(i,2))*(1+0.10)^(-@sum(T(i):time(i)*x(i,1)))+ @sum(P(i):price(i)*x(i,3))*(1+0.10)^(-@sum(T(i):time(i)*(x(i,1)+x(i,2))))+ @sum(P(i):price(i)*x(i,4))*(1+0.10)^(-@sum(T(i):time(i)*(x(i,1)+x(i,2)+x(i,3))));!Objective function; @sum(T(i):time(i)*(x(i,1)+x(i,2)))>=10;! Constraints of water supply demand time; @sum(C(i):capacity(i)*(x(i,1)+x(i,2)))>=5;! Constraints of engineering capacity increases water supply; @for(P(j):@sum(C(i):x(i,j))=1); @for(P(i):@sum(C(j):x(i,j))=1); @sum(P(j):@sum(C(i):x(i,j)))=4;! Constraints of project construction; @for(P(j):@for(C(i):@bin(x(i,j))));!0-1 constraints; data: price=6400 10500 16000 4000; time=2.68 11.58 8.42 2.11; capacity=1.28 5.50 4.00 1.00; enddata end | Local optimal solution found. Objective value: 16923.85 Objective bound: 16923.85 Infeasibilities: 0.000000 Extended solver steps: 11 Total solver iterations: 448 Elapsed runtime seconds: 0.10 Model Class: PINLP Total variables: 16 Nonlinear variables: 16 Integer variables: 16 Total constraints: 12 Nonlinear constraints: 1 Total nonzeros: 80 Nonlinear nonzeros: 16 Variable Value Reduced Cost PRICE(P1) 6400.000 0.000000 PRICE(P2) 10500.00 0.000000 PRICE(P3) 16000.00 0.000000 PRICE(P4) 4000.000 0.000000 TIME(T1) 2.680000 0.000000 TIME(T2) 11.58000 0.000000 TIME(T3) 8.420000 0.000000 TIME(T4) 2.110000 0.000000 CAPACITY(C1) 1.280000 0.000000 CAPACITY(C2) 5.500000 0.000000 CAPACITY(C3) 4.000000 0.000000 CAPACITY(C4) 1.000000 0.000000 X(P1, T1) 0.000000 0.000000 X(P1, T2) 0.000000 1224.752 X(P1, T3) 1.000000 0.000000 X(P1, T4) 0.000000 0.000000 X(P2, T1) 1.000000 390.2178 X(P2, T2) 0.000000 0.000000 X(P2, T3) 0.000000 0.000000 X(P2, T4) 0.000000 2600.677 X(P3, T1) 0.000000 5320.812 X(P3, T2) 0.000000 855.1000 X(P3, T3) 0.000000 0.000000 X(P3, T4) 1.000000 1252.020 X(P4, T1) 0.000000 0.000000 X(P4, T2) 1.000000 2756.736 X(P4, T3) 0.000000 1582.681 X(P4, T4) 0.000000 1546.801 |

In Fang & Jiang (2003) , the genetic algorithm was used to solve the model. The population size was 40 and the update algebra was N = 160. According to experience, the crossover probability was 0.8 and the mutation probability was 0.02. The whole calculation process was carried out by using the FORTRAN language programming program. The results are consistent with the results of this paper, that is, the optimal construction order is Project 2, Project 4, Project 1, and Project 3, and the minimum discount construction cost is 1.69 × 10^{4} million.

Compared with genetic algorithm in study Fang et al., the result of LINGO software is consistent and solving speed of LINGO is more quickly. This shows that LINGO software has obvious advantages in solving planning problems, and has a wide application space in solving water resources optimization problems.

Compared with other software to solve integer programming problems, due to some efficient built-in functions, especially @bin and @gin functions, you can directly constrain the decision variables to 0 - 1 or integers, which makes programming difficulty of LINGO software reduce and effectively improve the accuracy and reliability of the calculation. At the same time, LINGO software can also solve nonlinear programming problems, which makes it more widely used, especially for integer programming problems.

This paper uses LINGO to solve the example, which shows that LINGO can greatly reduce the complexity of the problem-solving process and avoid the difficulty of programming caused by introducing complex algorithms. At the same time, the LINGO programming language is more concise than other software. For simple cases, the program code is no different from the mathematical model. For relatively complex cases, the “set” can be used to program the model in a concise manner. LINGO software can play a larger and more effective role in the integer programming problem of water resources optimization configuration. Although the data volume of this example is small and the planning model is relatively simple, it has highlighted the advantages of LINGO software. For complex water resources optimization configuration planning model, LINGO’s advantages will be more obvious. Students could use the advanced software to solve the complex water resources optimization integer programming model based on the traditional integer programming solution. It is beneficial to cultivate college students’ innovative thinking and innovative consciousness.

Beijing co-construction project special funding and Famous Teachers Cultivation Planning for Teaching of North China Electric Power University (the Fourth Period).

The authors declare no conflicts of interest regarding the publication of this paper.

Men, B. H., & Yin, S. Y. (2018). Application of LINGO in Water Resources Optimization Teaching Based on Integer Programming. Creative Education, 9, 2516-2524. https://doi.org/10.4236/ce.2018.915190