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.

All request and response bodies in the Simplex Optimizer API are defined as Pydantic v2 models in backend/app/models/schemas.py. Pydantic validates every incoming payload automatically—type mismatches or out-of-range values produce a 422 Unprocessable Entity before the solver is ever called. The sections below document every schema grouped by functional area, with field types, constraints, and default values noted inline.

Shared Types

These schemas appear across multiple solver endpoints and are referenced by both request and response models.

Constraint

Represents a single linear constraint used by the Simplex, binary integer, and pure integer solvers.
coefficients
list[float]
required
Left-hand-side coefficients for each decision variable. Must contain between 2 and 5 elements, and the length must match the number of elements in the corresponding request’s objective array.
inequality
string
required
The constraint direction. Accepted literals: "<=", ">=", "=".
rhs
float
required
Right-hand-side value of the constraint.
Example Constraint
{
  "coefficients": [2.0, 1.0],
  "inequality": "<=",
  "rhs": 14.0
}

TableauRow

A single row of a Simplex tableau snapshot, carrying the name of the basic variable in that row and the full row of numeric values (including objective row coefficients and the RHS).
basic_variable
string
required
The label of the basic variable occupying this row (e.g. "x1", "s2", "Z").
values
list[float]
required
All numeric entries for this tableau row, left to right, including the RHS column.

IterationTableau

A complete snapshot of the Simplex tableau at one pivot step, returned as part of SimplexResponse.iteration_tableaux.
iteration
int
required
Zero-based iteration index. Iteration 0 is the initial tableau before any pivots.
entering
string | null
Label of the variable entering the basis at this step. null on the final (optimal) tableau.
leaving
string | null
Label of the variable leaving the basis at this step. null on the final tableau.
tableau_headers
list[string]
required
Column header labels for the tableau (e.g. ["x1", "x2", "s1", "s2", "RHS"]).
tableau_rows
list[TableauRow]
required
All rows of the tableau at this iteration, including the objective row.

Graphical LP Types

These schemas are embedded in SimplexResponse.graphical when the LP has exactly two decision variables, and they power the front-end constraint/feasible-region chart.

GraphPoint

A single 2-D coordinate.
x
float
required
Horizontal axis value.
y
float
required
Vertical axis value.

GraphLine

One constraint or objective line in the graphical LP plot, in the form ax + by = c.
a
float
required
Coefficient of the first variable (x-axis).
b
float
required
Coefficient of the second variable (y-axis).
c
float
required
RHS constant of the line equation.
points
list[GraphPoint]
required
Two endpoints used to draw the line segment across the chart bounds.
label
string | null
Human-readable label for the line (e.g. "C1", "Objective"). null when no label is set.
inequality
string | null
Direction of the half-plane: "<=", ">=", or "=". null for the objective line.

GraphBounds

Axis extents for the graphical LP chart.
x_min
float
required
Minimum x-axis value.
x_max
float
required
Maximum x-axis value.
y_min
float
required
Minimum y-axis value.
y_max
float
required
Maximum y-axis value.

GraphicalData

The complete graphical payload embedded in a two-variable SimplexResponse.
status
string
required
Solution status: "optimal", "unbounded", or "infeasible".
bounds
GraphBounds
required
Chart axis extents.
constraints
list[GraphLine]
required
One GraphLine entry per constraint, in the same order as the request.
feasible_polygon
list[GraphPoint] | null
Ordered vertices that form the boundary of the feasible region. null when the problem is infeasible or unbounded.
vertices
list[GraphPoint]
required
All corner points of the feasible region, including those not evaluated by the objective.
objective_line
GraphLine | null
The objective function drawn at the optimal value. null when the problem is not optimal.
optimal_point
GraphPoint | null
The optimal solution point. null when no optimal solution exists.
objective_value
float | null
Objective function value at the optimal point. null when not optimal.
goal
string
required
The optimization direction: "max" or "min".

Branch & Bound Node Types

These schemas describe individual nodes in the Branch & Bound enumeration tree returned by the binary and pure integer programming solvers.

BBNode

A single node in the binary Branch & Bound tree (BinaryResponse.nodes).
node_id
int
required
Unique integer identifier for this node, assigned in exploration order (root = 0).
parent_id
int | null
node_id of the parent node. null for the root node.
depth
int
required
Depth of this node in the tree (root = 0).
fixed_vars
dict[string, int]
required
Variables fixed to binary values at this node. Keys are variable names (e.g. "x1"), values are 0 or 1.
lp_value
float | null
Optimal LP relaxation objective value at this node. null if the LP relaxation was infeasible.
lp_vars
dict[string, float] | null
LP relaxation variable values at this node. null if infeasible.
status
string
required
Node disposition string, e.g. "explored", "pruned_infeasible", "pruned_bound", "integer_feasible".
branched_on
string | null
Variable name that was branched on to create this node’s children. null for leaf nodes.
edge_label
string | null
Label for the edge connecting this node to its parent in a tree visualization (e.g. "x2 = 0"). null for the root.

IntegerNode

A single node in the pure integer Branch & Bound tree (IntegerResponse.nodes). Similar to BBNode but uses continuous lower/upper bounds rather than fixed binary assignments, and records the branching direction.
node_id
int
required
Unique node identifier in exploration order.
parent_id
int | null
Parent node ID. null for the root.
depth
int
required
Tree depth of this node (root = 0).
lower_bounds
dict[string, float]
required
Current lower bounds for each decision variable at this node.
upper_bounds
dict[string, float]
required
Current upper bounds for each decision variable at this node.
lp_value
float | null
LP relaxation objective at this node. null if infeasible.
lp_vars
dict[string, float] | null
LP relaxation variable values. null if infeasible.
status
string
required
Node status string (same vocabulary as BBNode.status).
branched_on
string | null
Variable branched on to produce children. null for leaf nodes.
branch_direction
string | null
Which side of the branch this node represents: "down" (floor bound tightened) or "up" (ceiling bound tightened). null for the root.
edge_label
string | null
Human-readable edge label for tree visualization (e.g. "x1 ≤ 3"). null for the root.

Nonlinear Optimization Types

These schemas appear in the gradient descent, graphical multivariable, and KKT solver responses.

CriticalPointSchema

A classified critical point returned by the graphical multivariable solver (GraphicalMultivarResponse.critical_points).
point
list[float]
required
Coordinate vector of the critical point, with one entry per variable (length matches variables).
value
float
required
Objective function value at this critical point.
nature
string
required
Classification of the critical point. One of: "min", "max", "saddle", "degenerate".
Example CriticalPointSchema
{
  "point": [1.0, 2.0],
  "value": -3.5,
  "nature": "min"
}

SurfaceData

A 2-D grid of function values for a two-variable function, used by the front-end to render a Plotly surface chart (GraphicalMultivarResponse.surface).
x
list[float]
required
Sorted x-axis sample values (grid columns).
y
list[float]
required
Sorted y-axis sample values (grid rows).
z
list[list[float | null]]
required
2-D matrix of function values. z[i][j] is f(x[j], y[i]). Individual entries may be null where the expression is undefined (e.g. division by zero, domain error).
The z array is row-major: the outer list indexes over y values and the inner list indexes over x values, matching Plotly’s expected layout for go.Surface.

VolumeData

A flat list of sample points and function values for a three-variable function, used by the front-end to render a Plotly volume or scatter3d chart (GraphicalMultivarResponse.volume).
x
list[float]
required
x-coordinate for each sample point.
y
list[float]
required
y-coordinate for each sample point.
z
list[float]
required
z-coordinate for each sample point.
value
list[float | null]
required
Function value f(x, y, z) at each sample point. Entries are null where the expression is undefined.

KKTCase

One explored combination of active inequality constraints in the KKT solver (KKTResponse.cases). The solver enumerates every subset of inequality constraints that could be simultaneously active, attempts to solve the resulting KKT system, and records the outcome here.
case_id
int
required
Sequential index of this case (zero-based), assigned in enumeration order.
active_indices
list[int]
required
Indices (into KKTRequest.constraints) of the inequality constraints assumed active (binding) in this case. Equality constraints are always active.
status
string
required
Outcome of solving the KKT system for this case. One of:
  • "valid" — a KKT point was found, primal and dual feasibility hold.
  • "dual_infeasible" — the multiplier signs violate dual feasibility (not a true optimum for the given goal).
  • "primal_infeasible" — the solution violates at least one constraint.
  • "no_convergence" — the Newton solver did not converge within the iteration limit.
point
list[float] | null
Decision variable values at the KKT point. null when status is not "valid".
lambdas
dict[string, float] | null
Lagrange multipliers for equality constraints, keyed by constraint index string. null when no equality constraints are active or when the system did not converge.
mus
dict[string, float] | null
KKT multipliers for inequality constraints, keyed by constraint index string. null when no inequality constraints are active.
objective_value
float | null
Objective function value at this KKT point. null when a valid point was not found.
note
string
required
A plain-language description of why this case was accepted or rejected (e.g. "Dual infeasible: mu[0] < 0").
Example KKTCase (valid)
{
  "case_id": 2,
  "active_indices": [0, 2],
  "status": "valid",
  "point": [3.0, 1.5],
  "lambdas": {},
  "mus": { "0": 4.2, "2": 0.0 },
  "objective_value": 18.75,
  "note": "KKT conditions satisfied"
}
Example KKTCase (dual infeasible)
{
  "case_id": 5,
  "active_indices": [1],
  "status": "dual_infeasible",
  "point": null,
  "lambdas": null,
  "mus": { "1": -1.3 },
  "objective_value": null,
  "note": "Dual infeasible: mu[1] < 0"
}

Single-Variable Iteration Types

These schemas appear as list items inside the iterations array of the bisection and Newton-Raphson solver responses.

BisectionIteration

One step of the derivative-bisection algorithm, returned in BisectionResponse.iterations.
iteration
int
required
One-based iteration counter.
a
float
required
Left endpoint of the search interval at the start of this iteration.
b
float
required
Right endpoint of the search interval at the start of this iteration.
midpoint
float
required
Midpoint m = (a + b) / 2 evaluated in this step.
f_mid
float
required
Objective function value f(m) at the midpoint.
df_mid
float
required
First derivative value f′(m) at the midpoint. The bisection is applied to f′, so the interval is updated based on the sign of this value.
interval_width
float
required
Current interval width |b − a|. Convergence is declared when this falls below the requested tolerance.
Example BisectionIteration
{
  "iteration": 3,
  "a": 1.0,
  "b": 1.5,
  "midpoint": 1.25,
  "f_mid": -0.234,
  "df_mid": 0.012,
  "interval_width": 0.5
}

NewtonIteration

One step of the Newton-Raphson method applied to f′(x) = 0, returned in NewtonResponse.iterations.
iteration
int
required
One-based iteration counter.
x_n
float
required
Current iterate xₙ.
f_xn
float
required
Objective function value f(xₙ).
df_xn
float
required
First derivative f′(xₙ). The update step zeros this quantity.
d2f_xn
float
required
Second derivative f″(xₙ). Used as the denominator in the Newton update: xₙ₊₁ = xₙ − f′(xₙ) / f″(xₙ).
x_next
float
required
Next iterate xₙ₊₁ after applying the Newton step.
step
float
required
Signed step size xₙ₊₁ − xₙ. Convergence is declared when |step| falls below the requested tolerance.
Example NewtonIteration
{
  "iteration": 2,
  "x_n": 1.1,
  "f_xn": 0.331,
  "df_xn": 0.062,
  "d2f_xn": 2.2,
  "x_next": 1.0718,
  "step": -0.0282
}

Multivariable Iteration Types

GradientIteration

One step of the gradient descent or ascent algorithm, returned in GradientResponse.iterations.
iteration
int
required
One-based iteration counter.
point
list[float]
required
Current iterate vector xₙ, with one entry per variable (length matches variables).
gradient
list[float]
required
Gradient vector ∇f(xₙ) evaluated at the current point. Each entry is the partial derivative with respect to the corresponding variable.
gradient_norm
float
required
Euclidean norm ‖∇f(xₙ)‖₂. Convergence is declared when this falls below the requested tolerance.
f_value
float
required
Objective function value f(xₙ) at the current point.
Example GradientIteration
{
  "iteration": 5,
  "point": [0.82, 1.64],
  "gradient": [0.008, -0.003],
  "gradient_norm": 0.00854,
  "f_value": 3.712
}

Build docs developers (and LLMs) love