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

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

ToySolver.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

data OptResult Source

results of optimization

Constructors

Optimum 
Unsat 
Unbounded 

Extract results

Utilities

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