toysolver-0.5.0: Assorted decision procedures for SAT, SMT, Max-SAT, PB, MIP, etc

Copyright(c) Masahiro Sakai 2011
LicenseBSD-style
Maintainermasahiro.sakai@gmail.com
Stabilityprovisional
Portabilitynon-portable (ScopedTypeVariables)
Safe HaskellNone
LanguageHaskell2010

ToySolver.Arith.Simplex.Textbook.LPSolver

Contents

Description

Naïve implementation of Simplex method

Reference:

Synopsis

Solver type

type Solver r = (Var, Tableau r, VarSet, VarMap (Expr r)) Source #

LP monad

type LP r = State (Solver r) Source #

Problem specification

newVar :: LP r Var Source #

Allocate a new non-negative variable.

addConstraint :: Real r => Atom r -> LP r () Source #

Add a contraint, without maintaining feasibilty condition of tableaus.

addConstraintWithArtificialVariable :: Real r => Atom r -> LP r () Source #

Add a contraint and maintain feasibility condition by introducing artificial variable (if necessary).

  • Disequality is not supported.
  • Unlike addConstraint, an equality contstraint becomes one row with an artificial variable.

tableau :: RealFrac r => [Atom r] -> LP r () Source #

define :: Var -> Expr r -> LP r () Source #

Solving

simplex :: (Fractional r, Real r) => OptDir -> Expr r -> LP r Bool Source #

Extract results

Utilities

collectNonnegVars :: forall r. RealFrac r => [Atom r] -> VarSet -> (VarSet, [Atom r]) Source #