Skip to content

Commit

Permalink
changes before meeting
Browse files Browse the repository at this point in the history
  • Loading branch information
rbs333 committed May 7, 2019
1 parent 908edb3 commit 6a959ac
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions myapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,31 @@ class CustomFlask(Flask):
@cross_origin(supports_credentials=True)
def Sbfl():
input_data = request.get_json(force=True)

# Intialize instance of s_bfl class which contains
# Gurobipy optimization logic
my_s_bfl = s_bfl()
# use class input method to load data in instance
my_s_bfl.input(input_data, sysnum = 2)
# run the Gurobi model
my_s_bfl.solve()
print(my_s_bfl.optimization_result)

# create response dictionary that will be converted to
# JSON and returned to frontend as response payload
response_dict = dict()
response_dict['op_response'] = my_s_bfl.optimization_result

# run simulation with result of optimization and orginal
# user created data
my_sim.new_input(input_data,my_s_bfl.optimization_result)
my_sim.main()

# store result
response_dict['sim_response'] = my_sim.sim_results
response = jsonify(response_dict)

# send to frontend
return response

@app.errorhandler(404)
Expand Down

0 comments on commit 6a959ac

Please sign in to comment.