simplex-method-0.2.0.0: Implementation of the two-phase simplex method in exact rational arithmetic
Copyright(c) Junaid Rasheed 2020-2023
LicenseBSD-3
Maintainerjrasheed178@gmail.com
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Linear.Simplex.Solver.TwoPhase

Description

Module implementing the two-phase simplex method. findFeasibleSolution performs phase one of the two-phase simplex method. optimizeFeasibleSystem performs phase two of the two-phase simplex method. twoPhaseSimplex performs both phases of the two-phase simplex method.

Synopsis

Documentation

findFeasibleSolution :: (MonadIO m, MonadLogger m) => [PolyConstraint] -> m (Maybe FeasibleSystem) Source #

Find a feasible solution for the given system of PolyConstraints by performing the first phase of the two-phase simplex method All variables in the PolyConstraint must be positive. If the system is infeasible, return Nothing Otherwise, return the feasible system in Dict as well as a list of slack variables, a list artificial variables, and the objective variable.

optimizeFeasibleSystem :: (MonadIO m, MonadLogger m) => ObjectiveFunction -> FeasibleSystem -> m (Maybe Result) Source #

Optimize a feasible system by performing the second phase of the two-phase simplex method. We first pass an ObjectiveFunction. Then, the feasible system in DictionaryForm as well as a list of slack variables, a list artificial variables, and the objective variable. Returns a pair with the first item being the Integer variable equal to the ObjectiveFunction and the second item being a map of the values of all Integer variables appearing in the system, including the ObjectiveFunction.

twoPhaseSimplex :: (MonadIO m, MonadLogger m) => ObjectiveFunction -> [PolyConstraint] -> m (Maybe Result) Source #

Perform the two phase simplex method with a given ObjectiveFunction a system of PolyConstraints. Assumes the ObjectiveFunction and PolyConstraint is not empty. Returns a pair with the first item being the Integer variable equal to the ObjectiveFunction and the second item being a map of the values of all Integer variables appearing in the system, including the ObjectiveFunction.