Skip to content

Commit 5fd05fd

Browse files
committed
Adds code to handle simulated-annealing method
1 parent f1b51e5 commit 5fd05fd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

app.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,25 @@ def solve():
205205
)
206206
return response
207207

208+
elif pfsp_algorithm == "simulated-annealing":
209+
seq, jobs, opt_makespan, t_t = problem_inst.simulated_annealing()
210+
fig = jobs_to_gantt_fig(jobs, num_machines, num_jobs)
211+
graph_json = ganttfig_to_json(fig)
212+
if float(t_t) * 1000 > 1000.0:
213+
time_ts = t_t
214+
time_typ = "seconds"
215+
else:
216+
time_ts = float(t_t * 1000)
217+
time_typ = "msecs"
218+
resp = json.dumps(
219+
{"graph": graph_json, "optim_makespan": opt_makespan, "opt_seq": seq, "t_time": time_ts, "tt": time_typ})
220+
response = app.response_class(
221+
response=resp,
222+
status=200,
223+
mimetype="application/json",
224+
)
225+
return response
226+
208227

209228
@app.route('/random', methods=["POST"])
210229
def random():

0 commit comments

Comments
 (0)