Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1276c34

Browse files
Adds code for the /random route
1 parent c4fcb10 commit 1276c34

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

‎app.py‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,27 @@ def solve():
100100
return render_template("index.html", plot=random_johnson(2, 6), seq=seq, opt_makespan=optim_makespan)
101101

102102

103+
@app.route('/random', methods=["POST"])
104+
def random():
105+
if request.method == "POST":
106+
req = request.get_json()
107+
nb_machines = int(req["nb_machines"])
108+
nb_jobs = int(req["nb_jobs"])
109+
random_problem = RandomFlowshop(nb_machines, nb_jobs)
110+
data = random_problem.get_data()
111+
resp_data = ""
112+
for i in data:
113+
resp_data += " ".join(map(lambda x:str(x), i)) + "\n"
114+
115+
return resp_data.rstrip('\n')
116+
# will never reach this hahahha
117+
return "This is not intended for you to call :D"
118+
119+
120+
121+
122+
123+
103124
@app.route('/')
104125
def index():
105126
graph_json, seq, opt_makespan = random_johnson(2, 6)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /