fixed of lineopt_heuristic.py
This commit is contained in:
@@ -214,16 +214,14 @@ def line_optimizer_heuristic(component_data, machine_number):
|
|||||||
for _, data in component_data.iterrows():
|
for _, data in component_data.iterrows():
|
||||||
nozzle = data['nz']
|
nozzle = data['nz']
|
||||||
nozzle_points[nozzle] += data['points']
|
nozzle_points[nozzle] += data['points']
|
||||||
total_points += data['point']
|
total_points += data['points']
|
||||||
|
|
||||||
# first step: generate the initial solution with equalized workload
|
# first step: generate the initial solution with equalized workload
|
||||||
assignment_result = [[0 for _ in range(component_number)] for _ in range(machine_number)]
|
assignment_result = [[0 for _ in range(component_number)] for _ in range(machine_number)]
|
||||||
assignment_points = [0 for _ in range(machine_number)]
|
assignment_points = [0 for _ in range(machine_number)]
|
||||||
average_points = total_points // machine_number
|
average_points = total_points // machine_number
|
||||||
|
weighted_points = list(map(lambda row: row[1]['points'] + 1e-5 * nozzle_points[row[1]['nz']],
|
||||||
weighted_points = list(
|
component_data.iterrows()))
|
||||||
map(lambda _, data: data['points'] + 1e-5 * nozzle_points[data['nz']], component_data.iterrows()))
|
|
||||||
|
|
||||||
# for part_index in np.argsort(weighted_points)[::-1]:
|
# for part_index in np.argsort(weighted_points)[::-1]:
|
||||||
for part_index in np.argsort(weighted_points)[::-1]:
|
for part_index in np.argsort(weighted_points)[::-1]:
|
||||||
if (total_points := component_data.iloc[part_index]['points']) == 0: # total placements for each component type
|
if (total_points := component_data.iloc[part_index]['points']) == 0: # total placements for each component type
|
||||||
|
|||||||
Reference in New Issue
Block a user