File tree Expand file tree Collapse file tree 3 files changed +27
-5
lines changed Expand file tree Collapse file tree 3 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,6 @@ library
4545 Linear.SlackForm.Types
4646 Linear.SlackForm.Util
4747 Linear.System.Linear.Types
48- Linear.System.Linear.Util
4948 Linear.System.Simple.Types
5049 Linear.System.Simple.Util
5150 Linear.System.Types
Original file line number Diff line number Diff line change 1+ -- |
2+ -- Module: Linear.Constraint.Linear.Util
3+ -- Description: Utility functions for linear constraints
4+ -- Copyright: (c) Junaid Rasheed, 2020-2024
5+ -- License: BSD-3
6+ -- Maintainer: Junaid Rasheed <jrasheed178@gmail.com>
7+ -- Stability: experimental
8+ module Linear.Constraint.Linear.Util where
9+
10+ import Linear.Constraint.Linear.Types (LinearEquation (.. ))
11+ import Linear.Expr.Util ( exprVarsOnlyVars )
12+ import Linear.Var.Types ( Var )
13+ import qualified Data.Set as Set
14+
15+ -- | Get the variables in a linear equation
16+ linearEquationVars :: LinearEquation -> Set. Set Var
17+ linearEquationVars (LinearEquation lhs _) = exprVarsOnlyVars lhs
Original file line number Diff line number Diff line change 77-- Stability: experimental
88module Linear.SlackForm.Types where
99
10+ import qualified Data.Set as Set
1011import GHC.Generics (Generic )
11- import Linear.Expr.Types (Expr )
12+ import Linear.Expr.Types (ExprVarsOnly )
1213import Linear.System.Linear.Types (LinearSystem )
14+ import Linear.System.Simple.Types
1315import Linear.Var.Types (SimplexNum , Var )
1416
1517-- Expr == SimplexNum
1618data SlackForm = SlackForm
17- { maxObjective :: Expr -- TODO: should be ExprVarsOnly
19+ { maxObjective :: ExprVarsOnly -- TODO: should be ExprVarsOnly
1820 , constraints :: LinearSystem
19- , vars :: [ Var ] -- all vars are non-negative
21+ , vars :: Set. Set Var -- all vars are non-negative
2022 }
2123 deriving (Show , Eq , Read , Generic )
2224
2325class CanBeSlackForm a where
24- toSlackForm :: a -> SlackForm
26+ -- TODO: CanBeExprVarsOnly
27+ toSlackForm :: a -> ExprVarsOnly -> SlackForm
28+
29+ instance CanBeSlackForm LinearSystem where
30+ toSlackForm ls obj = SlackForm obj ls Set. empty
You can’t perform that action at this time.
0 commit comments