# Multi-UAV Mission Allocation under Constraint
## 3 Solution Based on Lingo Software  
Lingo software supplies a built-in modeling language that provides more than a dozen internal functions. It allows decision variables to be integers and is convenient and flexible. Lingo software is convenient to exchange data with Excel, database, and other software. The strong interactive nature of Lingo software allows us to open Lingo for simulation via MATLAB and presents the results directly in Excel and MATLAB diagrams. To solve the mathematical model more quickly and efficiently, we reduce the dimension of the decision variable \(x_{ijk}\) without changing the model. The pseudo-code of Lingo is presented in Algorithm 1. The main steps of the proposed method based on Lingo are shown in Figure 2.  
Step 1. Set up the UAV and reconnaissance mission areas. Then set up a set of links between reconnaissance areas, which is the LINK. The UAV contains attributes \(v\), \(w\), \(T\!f\), and \(T\!r\). The point contains attributes \(t\), \(c\), \(R(t)\), \(S\), \(T\), and \(W\). The LINK contains the attributes \(d_{ij}\) and \(x_{ij}\). Step 2. Define \(x_{ij}\) and \(t_{i}\) as decision variables. \(x_{ij}\) is a [0, 1] variable and \(t_{i}\) is a positive variable. Step 3. Set an objective function so that the optimization result will maximize the reconnaissance reward under the constraint. Step 4. Establish the constraints of the entire model. In Algorithm 1, u(i) indicates the time when the UAV performing the \(i\)-area mission leaves the target area \(i\). h(i) indicates the reconnaissance time when the UAV performing the \(i\)-area mission leaves the target area \(i\). \(f_{ij}\) is the time required for the UAV to fly from the target area \(i\) to the target area \(j\). Decision variable \(x_{ij}\) is generated after the \(x_{ijk}\) dimension reduction process in the improved model. By using the characteristics of the Lingo language to make \(x_{ij}\) get the same result as the \(x_{ijk}\) solution. To show a simple example, if there is 1 base and 5 areas to be reconnoitered, x13=1, x15=1, x21=1, x32=1, x46=1, x54=1, x61=1 can be got and the rest are 0. Then from x13=1, x15=1, it can be known that there are two UAV taking off from the base, UAV1 goes to the target area 3, and UAV2 goes to the target area 5. From x32=1, x21=1 we obtained that UAV1 continues to go to target area 2 from target  
Figure 2: The flow chart of the proposed method based on Lingo. area 3 and then returns to the base. Similarly, it can be known that UAV2 moves from target area 5 to target area 6, then goes to target area 4 and returns to the base. ```
Input: The information of UAV and reconnaissance area Output: The optimal allocation plan and program details
1. Create collections and corresponding properties, initialize parameters
2. set the decision variables \(x_{ij}\) and \(t_{i}\)
3. set the objective function
4. for each target k = 1,2,3,...,26, including base
5. constrain all u(k) less than the maximum flight time
6. constrain all h(k) less than the maximum reconnaissance time
7. compute u(k), h(k)
8. define u(k) as the number between intervals (t(k), Tfmax)
9. define h(k) as the number between intervals (t(k), Tfmax)
10. for each i, i#me#k#and#i#ne#1
11. u(k)>=u(i)+t(k)+ft(i,k)-Tfmax+Tfmax*(x(k,i)+x(i,k))-x(k,i)*(t(k)+ft(i,k)+t(i))
12. h(k)>=h(i)+t(k)-Tfmax+Trmax*(x(k,i)+x(i,k))-x(k,i)*(t(k)+t(i))
13. u(k)<=Tfmax-(Tfmax-t(k)-ft(1,k))*(x(1,k))
14. u(k)>=t(k)+@sum((t(i)+ft(i,k))*(x(i, k)),where i greater or equal to 1
15. h(k)<=Tfmax-(Tfmax-t(k))*(x(1, k))
16. h(k)>=t(k)+@sum((t(i)*x(i, k)), where I greater or equal to 1
17. end for
18. time window constraint
19. define h(k)-t(k) as the number between intervals (a(k), b(k))
20. if x(k, j)=1,
21. h(k)+ft(k, j)+W(j)=h(j)-t(j)
22. W(j)=max(0,a(j)-(h(i)+ft(i, j)))
23. end if
24. @sum(x(i, j)*ft(j))+W(j)+ft(j, 0)<=Tfmax
25. compute x(i, j)=1 in the optimal allocation scheme
26. for any k, x(k, k)=0
27. end for
28. for each i, i#ne#k#and#(i#eq#1#forfu(i)+t(k)+ft(i, k)#le#Tfmaxforfufh(i)+t(k)#le#
29.