This file summarizes the current public API surface of jgot.
GraphSpec stores a sparse reversible graph as a directed edge list.
Important fields:
num_nodesnum_edgessrcdstrevqpiout_rate
Recommended construction paths:
GraphSpec.from_undirected_weights(...)GraphSpec.from_directed_rates(...)
TimeDiscretization(num_steps: int) defines the number of time intervals.
Practical meaning:
- larger
num_stepsgives a finer path, - larger
num_stepsalso makes the problem harder and more memory-intensive.
The step size is:
h = 1 / num_steps
LogMeanOps() is the only public mean implementation in the current project.
It provides the logarithmic mean and the helper operations needed by the K
projection.
Most users should use LogMeanOps() directly.
OTConfig controls the PDHG solver and its inner subsolvers.
tau: primal step sizesigma: dual step sizerelaxation: over-relaxation factor
These are the closest thing this solver has to “learning-rate-like” parameters. They control how aggressively the outer primal-dual method moves.
Constraint:
tau * sigma < 1
max_iterscheck_every
These control how long the outer solve runs and how often convergence is checked.
cg_max_iterscg_tolcg_warm_startcg_preconditioner
These control the inner CE_h projection solve.
cg_preconditioneraccepts:"jacobi"(default)"block_jacobi"(time-block tridiagonal preconditioner)
numerics_mode"paper"(default and only supported value)
numerics_mode is kept for compatibility.
Passing "legacy" now raises:
legacy mode has been removed; use numerics_mode='paper'
newton_itersbisect_iters
These affect the fixed-iteration scalar solves used inside pointwise projections.
warm_start"linear_path""zero"
record_debug_trace
When enabled, the solver records checkpointed debug history inside the JIT path
and returns it through OTSolution.debug_trace.
OTProblem bundles:
graphtimerho_arho_bmean_ops
rho_a and rho_b must:
- have shape
(num_nodes,), - be nonnegative,
- satisfy
sum(pi * rho) == 1.
solve_ot(problem: OTProblem, config: OTConfig = OTConfig()) -> OTSolutionThis is the main public entrypoint.
It:
- validates endpoint densities,
- constructs a warm start,
- runs the PDHG-based solver path,
- returns the final state, diagnostics, and optional trace.
Important fields:
distanceactionstateiterations_usedconvergeddiagnosticsdebug_trace
The square root of the discrete action.
The current discrete action evaluated on the returned state. This can become non-finite if the iterate is singular.
The returned time-discrete transport path. Most users inspect:
state.rhostate.m
Whether the stopping conditions were met.
A finite-looking state can still have converged=False.
A dictionary containing the latest checkpoint values for:
primal_deltadual_deltacontinuity_residualk_violationendpoint_residualmax_constraint_residualceh_cg_residualceh_cg_iters
Note:
primal_deltaanddual_deltause the weighted paper-style Hilbert-space scaling.
Optional checkpoint history returned when record_debug_trace=True.
OTDebugTrace is a fixed-size checkpoint buffer.
Important rule:
- only the first
num_recordsentries are valid.
Recorded fields:
iterationsactioncontinuity_residualprimal_deltadual_deltamax_constraint_residualceh_cg_residualceh_cg_itersmin_varthetanum_records
This is the main tool for understanding why a run did not converge or why the returned action became non-finite.
- For graph semantics, see Graph Model.
- For solver behavior, see Solver Overview.
- For debugging, see Debugging and Diagnostics.
- For runnable scripts, see Examples Guide.