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 ¶
- Constants
- func NewSolverConfig(opts ...SolverOption) *common.SolverConfig
- func Solve(prog *lp.LinearProgram, opts ...SolverOption) *lp.LinearProgram
- type BranchingStrategy
- type HeuristicStrategy
- type SolverMethod
- type SolverOption
- func WithBranchingStrategy(bs common.BranchingStrategy) SolverOption
- func WithGapSensitivity(gap float64) SolverOption
- func WithHeuristicStrategy(hs common.HeuristicStrategy) SolverOption
- func WithLogging(enabled bool) SolverOption
- func WithMaxIterations(max int) SolverOption
- func WithRandomSeed(seed int) SolverOption
- func WithSolverMethod(m common.SolverMethod) SolverOption
- func WithStrongBranchingDepth(depth int) SolverOption
- func WithThreads(n int) SolverOption
- func WithTolerance(t float64) SolverOption
- func WithUseCuttingPlanes(enabled bool) SolverOption
Constants ¶
const ( SimplexMethod SolverMethod = common.SimplexMethod FirstFractional BranchingStrategy = common.FirstFractional MostFractional BranchingStrategy = common.MostFractional LeastFractional BranchingStrategy = common.LeastFractional RandomBranching BranchingStrategy = common.RandomBranching RandomHeuristic HeuristicStrategy = common.RandomHeuristic LargestInfeasibility HeuristicStrategy = common.LargestInfeasibility )
Re-export constants
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 BranchingStrategy ¶
type BranchingStrategy = common.BranchingStrategy
type HeuristicStrategy ¶
type HeuristicStrategy = common.HeuristicStrategy
type SolverMethod ¶
type SolverMethod = common.SolverMethod
type SolverOption ¶
type SolverOption func(*common.SolverConfig)
SolverOption defines a function that modifies SolverConfig.
func WithBranchingStrategy ¶
func WithBranchingStrategy(bs common.BranchingStrategy) SolverOption
WithBranchingStrategy sets the branching strategy.
func WithGapSensitivity ¶
func WithGapSensitivity(gap float64) SolverOption
WithGapSensitivity sets the gap sensitivity.
func WithHeuristicStrategy ¶
func WithHeuristicStrategy(hs common.HeuristicStrategy) SolverOption
WithHeuristicStrategy sets the heuristic strategy.
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 WithStrongBranchingDepth ¶
func WithStrongBranchingDepth(depth int) SolverOption
WithStrongBranchingDepth sets the strong branching depth.
func WithThreads ¶
func WithThreads(n int) SolverOption
WithThreads sets the number of threads to use.
func WithUseCuttingPlanes ¶
func WithUseCuttingPlanes(enabled bool) SolverOption
WithUseCuttingPlanes enables or disables cutting planes.