Computational_Mathematics_L.../main.py

37 lines
984 B
Python
Raw Normal View History

2023-12-20 00:52:58 +04:00
import numpy as np
import pandas as pd
from simplexImp import SimplexMethod
from flask import Flask, render_template, request, redirect, send_file
app = Flask(__name__)
@app.route('/')
def index():
table = np.array([
[1, 3, 18],
[2, 1, 16],
[0, 1, 5],
[3, 0, 21],
[-2, -3, 0]
])
simplex = SimplexMethod(table)
start_table = simplex.return_table()
simplex.solve()
end_table = simplex.return_table()
solution = simplex.return_result(table.shape[1] - 1)
return render_template("index.html",
start_table=pd.DataFrame(start_table).to_html(
classes='table table-dark table-bordered table-hover'),
end_table=pd.DataFrame(end_table).to_html(
classes='table table-dark table-bordered table-hover'),
solution=solution)
if __name__ == '__main__':
app.run(debug=True)