Documentation
¶
Overview ¶
Package solver provides a high-level interface for solving linear programming problems using the revised simplex method.
It exposes a configurable Solver type and related options that allow users to control how problems are solved, including tolerances, iteration limits, and output handling.
Index ¶
- func NewSolverConfig(opts ...SolverOption) *common.SolverConfig
- func Solve(prog *lp.LinearProgram, opts ...SolverOption) *lp.LinearProgram
- type SolverMethod
- type SolverOption
- func WithGapSensitivity(gap float64) SolverOption
- func WithLogging(enabled bool) SolverOption
- func WithMaxIterations(max int) SolverOption
- func WithRandomSeed(seed int) SolverOption
- func WithSolverMethod(m common.SolverMethod) SolverOption
- func WithThreads(n int) SolverOption
- func WithTolerance(t float64) SolverOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSolverConfig ¶
func NewSolverConfig(opts ...SolverOption) *common.SolverConfig
NewSolverConfig builds a SolverConfig applying all options on defaults.
func Solve ¶
func Solve(prog *lp.LinearProgram, opts ...SolverOption) *lp.LinearProgram
Solve takes a linear program and an optional configuration, and attempts to solve it using the revised simplex method.
Types ¶
type SolverMethod ¶
type SolverMethod = common.SolverMethod
const (
SimplexMethod SolverMethod = common.SimplexMethod
)
Re-export constants
type SolverOption ¶
type SolverOption func(*common.SolverConfig)
SolverOption defines a function that modifies SolverConfig.
func WithGapSensitivity ¶
func WithGapSensitivity(gap float64) SolverOption
WithGapSensitivity sets the gap sensitivity.
func WithLogging ¶
func WithLogging(enabled bool) SolverOption
WithLogging enables or disables logging.
func WithMaxIterations ¶
func WithMaxIterations(max int) SolverOption
WithMaxIterations sets the maximum number of iterations.
func WithRandomSeed ¶
func WithRandomSeed(seed int) SolverOption
WithRandomSeed sets the random seed.
func WithSolverMethod ¶
func WithSolverMethod(m common.SolverMethod) SolverOption
WithSolverMethod sets the solver method.
func WithThreads ¶
func WithThreads(n int) SolverOption
WithThreads sets the number of threads to use.