Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/FabianeloV/Metodo-simplex/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through cloning the repository, starting both services on your machine, and sending your first optimization request to the API — all in about five minutes. By the end you will have the interactive frontend running at http://localhost:5173 and the REST API serving at http://localhost:8000.

Prerequisites

Before you begin, make sure the following are installed on your machine:
  • Python 3.11+ — required by the FastAPI backend and its numerical dependencies (NumPy, SymPy).
  • Node.js 18+ and npm — required to install and run the React frontend.
Check your versions with python --version, node --version, and npm --version before proceeding.

Backend Setup

1

Clone the repository

git clone https://github.com/FabianeloV/Metodo-simplex.git
cd Metodo-simplex
2

Create and activate a virtual environment

A virtual environment keeps the project’s Python dependencies isolated from your system installation.
cd backend
python -m venv .venv
source .venv/bin/activate
3

Install Python dependencies

pip install -r requirements.txt
This installs the exact pinned versions used in development:
PackageVersion
fastapi0.115.0
uvicorn[standard]0.30.6
pydantic2.9.2
numpy2.1.1
sympy1.13.3
python-dotenv1.0.1
httpx0.27.2
4

Configure environment variables

Copy the example environment file and adjust values as needed:
cp .env.example .env
The default .env.example contains:
.env
# FastAPI server configuration
APP_HOST=0.0.0.0
APP_PORT=8000
APP_RELOAD=true

# CORS origins (comma-separated)
CORS_ORIGINS=http://localhost:5173,http://localhost:3000
CORS_ORIGINS must include the URL where the frontend runs. The default value already covers Vite’s default dev-server port (5173).
5

Start the development server

uvicorn app.main:app --reload --port 8000
The API is now reachable at http://localhost:8000. Interactive documentation is available at two URLs:
  • Swagger UIhttp://localhost:8000/docs
  • ReDochttp://localhost:8000/redoc

Frontend Setup

Open a new terminal and navigate back to the project root before running these steps.
1

Move into the frontend directory and install dependencies

cd frontend
npm install
2

Configure the API base URL

cp .env.example .env
The example file ships with a single variable:
.env
# FastAPI backend URL (no trailing slash)
VITE_API_URL=http://localhost:8000/api/v1
All environment variables consumed by Vite must be prefixed with VITE_. The frontend’s HTTP service reads VITE_API_URL at build time via import.meta.env.VITE_API_URL.
3

Start the Vite development server

npm run dev
Open http://localhost:5173 in your browser to access the interactive solver UI.

Your First API Call

With the backend running, send a POST request to solve a three-variable linear programming problem. The example below maximizes the objective function Z = 3x₁ + 2x₂ + 5x₃ subject to three resource constraints:
curl -X POST http://localhost:8000/api/v1/simplex/solve \
  -H "Content-Type: application/json" \
  -d '{
    "objective":    [3, 2, 5],
    "goal":         "max",
    "constraints": [
      { "coefficients": [1, 0, 1], "inequality": "<=", "rhs": 430 },
      { "coefficients": [0, 1, 1], "inequality": "<=", "rhs": 460 },
      { "coefficients": [1, 1, 0], "inequality": "<=", "rhs": 420 }
    ]
  }'

Expected Response

{
  "status":          "optimal",
  "objective_value": 1350.0,
  "variables":       { "x1": 0.0, "x2": 100.0, "x3": 230.0 },
  "iterations":      3,
  "tableau_headers": ["Basic", "Z", "x1", "x2", "x3", "s1", "s2", "s3", "RHS"],
  "tableau_rows":    [ "..." ],
  "message":         "Optimal solution found after 3 iteration(s)."
}
The response includes:
FieldDescription
statusSolution status: optimal, unbounded, or infeasible
objective_valueThe value of the objective function at the optimal point
variablesMap of decision variable names to their optimal values
iterationsNumber of pivot steps performed
tableau_headersColumn labels for the final simplex tableau
tableau_rowsRow data for the final simplex tableau
messageHuman-readable summary of the solver result
You can explore and test all eight solver endpoints interactively through the Swagger UI at http://localhost:8000/docs. Each endpoint includes schema documentation and a built-in “Try it out” form.

Health Check

Each solver router exposes a lightweight health endpoint. Verify the backend is up with:
curl http://localhost:8000/api/v1/simplex/health
A 200 OK response confirms the service is running and the route is registered correctly.

Next Steps

  • Read the API Reference for full schema documentation on all eight solvers.
  • Visit Methods for algorithm explanations and more request/response examples.
  • See Architecture for the component structure and deployment guide.

Build docs developers (and LLMs) love