| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell98 |
Numeric.COINOR.CLP.Monad
Description
The monadic interface to CLP allows to optimize with respect to multiple objectives, successively.
Documentation
simplex :: (Eq sh, Indexed sh, Index sh ~ ix) => Method -> Constraints Double ix -> (Direction, Objective sh) -> T sh (Result sh) Source #
Add new constraints to an existing problem and run with a new direction and objective.
>>>case Shape.indexTupleFromShape tripletShape of (x,y,z) -> mapSnd Array.toTuple <$> LP.run tripletShape [] (LP.simplex LP.dual [[2.*x, 1.*y] <=. 10, [1.*y, (5::Double).*z] <=. 20] (LP.Maximize, Array.fromTuple (4,-3,2) :: Array.Array TripletShape Double))Right (28.0,(5.0,0.0,4.0))
forAllMethod $ \method ->
TestLP.forAllOrigin $ \origin ->
TestLP.forAllProblem origin $ \bounds constrs ->
QC.forAll (TestLP.genObjective origin) $ \(dir,obj) ->
case (CLP.simplex method bounds constrs (dir,obj),
LP.run (Array.shape origin) bounds $
LP.simplex method constrs (dir,obj)) of
(Right (optA,_), Right (optB,_)) ->
TestLP.approxReal 0.1 optA optB; _ -> FalseforAllMethod $ \method ->
TestLP.forAllOrigin $ \origin ->
TestLP.forAllProblem origin $ \bounds constrs ->
TestLP.forAllObjectives origin $ \objs_ ->
case TestLP.successiveObjectives origin 0.01 objs_ of
(dirObj, objs) ->
either (\msg -> QC.counterexample (show msg) False) (const $ QC.property True) $
runSuccessive method (Array.shape origin) bounds (constrs,dirObj) objsforAllMethod $ \method ->
TestLP.forAllOrigin $ \origin ->
TestLP.forAllProblem origin $ \bounds constrs ->
TestLP.forAllObjectives origin $ \objs_ ->
case TestLP.successiveObjectives origin 0.01 objs_ of
(dirObj, objs) ->
approxSuccession 0.01
(solveSuccessiveWarm method (Array.shape origin) bounds (constrs,dirObj) objs)
(solveSuccessiveGen method (Array.shape origin) bounds (constrs,dirObj) objs)Instances
| Bounded Direction | |
| Enum Direction | |
Defined in Numeric.LinearProgramming.Common Methods succ :: Direction -> Direction # pred :: Direction -> Direction # fromEnum :: Direction -> Int # enumFrom :: Direction -> [Direction] # enumFromThen :: Direction -> Direction -> [Direction] # enumFromTo :: Direction -> Direction -> [Direction] # enumFromThenTo :: Direction -> Direction -> Direction -> [Direction] # | |
| Show Direction | |
| Eq Direction | |