# Modeling and Simulation of Sky Survey
## 4 Design of the Model Solving Algorithm
### Overall Arrangement Algorithm  
The scheduling process is time-based, and since the time periods that cannot be observed have been eliminated in advance, the time periods for this part of the optimization schedule are those in which all the sky areas can be observed. A greedy algorithm is used to determine the observation sequence with a fixed optimization time interval. Specifically, the greedy algorithm is used to select the sequence of observed sky areas. The one with the highest factor weight is selected for priority observation. Algorithm 4 details the completion of the planning process, and the corresponding process is shown in Figure 2.  
```
1:INPUT\(A=\{Eph,Sun,Moon\}\);
2:OUTPUT\(\;\)Inefficient observation time period \(Low\);
3:for\(i=1\) to \(Days\)do
4:\(//\) Days: Total time of the sky survey;
5:\(Number(i)=0\); // Initialize count variable;
6:for\(j=1\) to \(DaySecond\)by Interval do
7:\(//\) DaySecond: 86,400 s;
8: Calculate the angles \(\alpha\) and \(\beta\) by using Equations (5) and (6). 9:if\(\alpha\geq\epsilon_{1}\) & \(\beta\geq\epsilon_{2}\)then
10:\(Number(i)=1\); // Calculating Visibility;
11:endif
12:endfor
13:\(Efficient(i)=\frac{Interval\times Number(i)}{DaySecond}//\) Calculate the daily observation efficiency;
14:if Efficient(i) \(\leq\tau_{1}\)then
15:\(Low(i)=1\); // Record inefficient time period;
16:endif
17:endfor
18:return\(Low\)
```  
**Algorithm 2** Difficulty Statistics  
```
1:INPUT\(A=\{Eph,Sun,Moon\}\); \(S=\{s_{j},j=1,2,\ldots,M\}\);
2:OUTPUT\(\;\)Difficult to observe sky areas \(DifSky\); Sky area weights \(v\). 3:for\(i=St\) to \(Et\)by Interval do
4:\(//\) Interval: Minimum time interval;
5:if\(i\in Oc\)then
6: Continue;
7:else
8:for\(j=1\) to M do
9:\(\delta=\theta(Eph_{i},s_{j})\) by Equations (5) and (6) //Sky area for zenith angle observation;
10:if\(\delta\leq\Delta\)then
11: Calculate the angles \(\alpha\) and \(\beta\) by using Equations (5) and (6). 12:if\(\alpha\geq\epsilon_{1}\) & \(\beta\geq\epsilon_{2}\)then
13:\(//\)Record the location of the sky area: \(PosVisible\in[1,2,\ldots,M]\);
14:\(SkyArea(PosVisible)=SkyArea(PosVisible)+1\);
15:else
16: Continue;
17:endif
18:endif
19:endfor
20:endif//Calculate the observation frequency of the sky zone;
21:endfor
22:\(Frequency(j)=\frac{SkyArea(j)}{\sum_{i=1}^{M}SkyArea(j)}\);
23:\(v(j)=\frac{1}{Frequency(j)}\); //Calculate sky area weights;
24:if\(Frequency(j)\leq\tau_{2}\)then
25:\(DifSky(j)=1\); // Recording difficult observation areas;
26:endif
27:return\(DifSky,v\)
```  
**Algorithm 3** The Algorithm 3  
```
1:INPUT\(A=\{Eph,Sun,Moon\}\); \(S=\{s_{j},j=1,2,\ldots,M\}\);
2:OUTPUT\(\;\)Difficult to observe sky areas \(DifSky\); Sky area weights \(v\). 3:for\(i=St\) to \(Et\)by Interval do
4:\(//\) Interval: Minimum time interval;
5:if\(i\in Oc\)then
6: Continue;
7:else
8:for\(j=1\) to M do
9:\(\delta=\theta(Eph_{i},s_{j})\) by Equations (5) and (6) //Sky area for zenith angle observation;
10:if\(\delta\leq\Delta\)then
11: Calculate the angles \(\alpha\) and \(\beta\) by using Equations (5) and (6). 12:if\(\alpha\geq\epsilon_{1}\) & \(\beta\geq\epsilon_{2}\)then
13:\(//\)Record the location of the sky area: \(PosVisible\in[1,2,\ldots,M]\);
14:\(SkyArea(PosVisible)=SkyArea(PosVisible)+1\);
15:else
16: Continue;
17:endif
18:endif
19:endfor
20:endif//Calculate the observation frequency of the sky zone;
21:endfor
22:\(Frequency(j)=\frac{SkyArea(j)}{\sum_{i=1}^{M}SkyArea(j)}\);
23:\(v(j)=\frac{1}{Frequency(j)}\); //Calculate sky area weights;
24:if\(Frequency(j)\leq\tau_{2}\)then
25:\(DifSky(j)=1\); // Recording difficult observation areas;
26:endif
27:return\(DifSky,v\)
```  
**Algorithm 4** The Algorithm 4  
```
1:INPUT\(A=\{Eph,Sun,Moon\}\); \(S=\{s_{j},j=1,2,\ldots,M\}\);
2:OUTPUT\(\;\)Difficult to observe sky areas \(DifSky\); Sky area weights \(v\).