## 3 Results
### Phase I: Defining PC On-site Assembly Optimization Principles via BIM-GA Hybrid System
#### 3.2.2 Application of Genetic Algorithm
```
#adjacency penalty  for i in range(start_index,n):  prev_component = result_uninstalled.iloc[individual[i-1]]  current_component = result_uninstalled.iloc[individual[i]]  diff = np_sqrt((current_component['x coordinate'] - prev_component['x coordinate'])**2 +  (current_component['y coordinate'] - prev_component['y coordinate'])**2 +  (current_component['z coordinate'] - prev_component['z coordinate'])**2) if i > start_index and diff > prev_diff:  penalty2 = diff/prev_diff  penalties2.append(penalty2) else:  penalty2 = 0  penalties2.append(penalty2) prev_diff  penalties2.append(penalty2) penalty_matrix.append(penalties2)
```
**Algorithm 2** Distance penalty

Regarding the assignment of penalty scores related to the third criterion, assessing the feasibility of the element installation involved considering the schedule and location information within the assembly sequence of each PC element. A penalty score of 1 was assigned when there was a time-space conflict with the initial input schedule of the RC process. To facilitate this, users are required to provide an RC process schedule, including the date and location specifics for each activity (refer to Algorithm 3 for detailed guidance). The assignment of dates to PC elements based on the assembly sequence involved setting a starting date for the sequence generation. The dates were allocated based on the daily capacity of 15 elements. If interference occurred in the RC process schedule based on the user's input date and location information, a penalty score of 1 was assigned. This process ensures efficient scheduling by preventing time-space conflicts (Algorithm 4). Ultimately, the objective is to minimize the cumulative penalty scores from these three constraints, aiming for an assembly sequence with optimal fitness, thereby reducing interference in the construction process (refer to Algorithm 5). ```
#interference penalty for i in range(start_index,n):  prev_component = result_uninstalled.iloc[individual[i-1]]  current_component = result_uninstalled.iloc[individual[i]] for rc_index in range(len(rc_activities)):  if (current_member_x == rc_x[rc_index] and  current_member_y == rc_y[rc_index]) and  current_member_z == rc_z[rc_index])and  current_date == rc_date[rc_index]):  interference_count += 1 penalty3 = interference_count  print(interference_count) penalties3.append(penalty3) penalty_matrix.append(penalties3)
```
**Algorithm 4** Assigning Data Date
```
start_date = pd.Timestamp(\"23 June 2023) installation_date = start_date + pd.Timedelta(days=installation_date_count // 15) if installation_date_count % 15 == 0 and installation_date_count!= 0:  installation_date += pd.Timedelta(days=1) current_date = installation_date.date() installation_dates[member_index] = current_date installation_date_count += 1
```
**Algorithm 5** Evaluation
```
def evaluate_fitness(individual):  penalty = calculate_total_penalty(individual) fitness = 1/(penalty) return fitness,
```

**Algorithm 6** Evaluation

#### 3.2.3 Development of Graphic User Interface (GUI)

A pivotal aspect of implementing the assembly sequence approach is the creation of an intuitive GUI that enables effective data input and result validation. Figure 7 illustrates the system framework, which includes sections for user data input, simulating results based on this input, and managing overall outcomes. Within this framework (Figure 7), users initiate the process by inputting the preferred commencement date for assembling the PC components along with the RC schedule. The selection of dates can be facilitated by using a calendar interface, visually represented in Figure 8a. The RC schedule, as depicted on the right-hand side of Figure 8b, was integrated. This schedule should encompass specific details of RC activities, including work location, dates, and other relevant details. For example, activities such as topping concrete require details regarding the number of floors, work zones, and scheduled dates.