Skip to content

Commit fdb348c

Browse files
committed
Adds NEH & bruteforcesolve methods to main app
1 parent b67f47e commit fdb348c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

app.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,30 @@ def solve():
108108
mimetype="application/json",
109109
)
110110
return response
111+
elif pfsp_algorithm == "neh":
112+
seq, jobs, opt_makespan = problem_inst.neh_heuristic()
113+
fig = jobs_to_gantt_fig(jobs, num_machines, num_jobs)
114+
graph_json = ganttfig_to_json(fig)
115+
resp = json.dumps(
116+
{"graph": graph_json, "optim_makespan": opt_makespan, "opt_seq": seq})
117+
response = app.response_class(
118+
response=resp,
119+
status=200,
120+
mimetype="application/json",
121+
)
122+
return response
123+
elif pfsp_algorithm == "bruteforce":
124+
seq, jobs, opt_makespan = problem_inst.brute_force_exact()
125+
fig = jobs_to_gantt_fig(jobs, num_machines, num_jobs)
126+
graph_json = ganttfig_to_json(fig)
127+
resp = json.dumps(
128+
{"graph": graph_json, "optim_makespan": opt_makespan, "opt_seq": seq})
129+
response = app.response_class(
130+
response=resp,
131+
status=200,
132+
mimetype="application/json",
133+
)
134+
return response
111135

112136

113137
@app.route('/random', methods=["POST"])

0 commit comments

Comments
 (0)