Safe Haskell | None |
---|
- type NLPT = StateT NLPState
- nlpstate0 :: NLPState
- module Control.Monad.State
- solveNLP' :: MonadIO m => (IpProblem -> IO ()) -> NLPT m IpOptSolved
- var' :: (Monad m, Functor m) => Maybe (Double, Double) -> String -> NLPT m (AnyRF Identity, Ix)
- var :: (Monad m, Functor m) => Maybe (Double, Double) -> String -> StateT NLPState m (AnyRF Identity)
- varFresh :: (Monad m, Functor m) => Maybe (Double, Double) -> [Char] -> StateT NLPState m (AnyRF Identity)
- data AnyRF cb = AnyRF (forall a. RealFloat a => Vector a -> cb a)
- addG :: Monad m => Maybe String -> (Double, Double) -> AnyRF Identity -> NLPT m ()
- addF :: Monad m => Maybe String -> AnyRF Identity -> NLPT m ()
- data IpOptSolved = IpOptSolved {}
- data ApplicationReturnStatus
- = SolveSucceeded
- | SolvedToAcceptableLevel
- | InfeasibleProblemDetected
- | SearchDirectionBecomesTooSmall
- | DivergingIterates
- | UserRequestedStop
- | FeasiblePointFound
- | MaximumIterationsExceeded
- | RestorationFailed
- | ErrorInStepComputation
- | MaximumCputimeExceeded
- | NotEnoughDegreesOfFreedom
- | InvalidProblemDefinition
- | InvalidOption
- | InvalidNumberDetected
- | UnrecoverableException
- | NonipoptExceptionThrown
- | InsufficientMemory
- | InternalError
- addIpoptNumOption :: Real a => IpProblem -> String -> a -> IO Bool
- addIpoptStrOption :: IpProblem -> String -> String -> IO Bool
- addIpoptIntOption :: Integral a => IpProblem -> String -> a -> IO Bool
- setIpoptProblemScaling :: IpProblem -> Double -> IOVector IpNumber -> IOVector IpNumber -> IO Bool
- openIpoptOutputFile :: Integral a => IpProblem -> String -> a -> IO Bool
- type Vec = IOVector IpNumber
- type IpNumber = CDouble
high-level
the initial state to use when you actually have to get to IO with the solution
module Control.Monad.State
:: MonadIO m | |
=> (IpProblem -> IO ()) | set ipopt options (using functions from Ipopt.Raw) |
-> NLPT m IpOptSolved |
calls createIpoptProblemAD
and ipoptSolve
. To be used at the
end of a do-block.
variables
:: (Monad m, Functor m) | |
=> Maybe (Double, Double) | bounds |
-> String | variable name (namespace from the |
-> NLPT m (AnyRF Identity, Ix) | the value, and index (into the raw vector of variables that the solver sees) |
add a variable, or get a reference to the the same variable if it has already been used
var :: (Monad m, Functor m) => Maybe (Double, Double) -> String -> StateT NLPState m (AnyRF Identity)Source
varFresh :: (Monad m, Functor m) => Maybe (Double, Double) -> [Char] -> StateT NLPState m (AnyRF Identity)Source
var
, except this causes the solver to get a new variable,
so that you can use:
[a,b,c,d,e] <- replicateM 5 (varFresh (Just (0, 10)) "x")
and the different letters can take different values (between 0 and 10)
in the optimal solution (depending on what you do with a
and similar
in the objective function).
this wrapper holds functions that can be used
for the objective (f
) or for constraints (g
). Many functions
in the instances provided are partial: this seems to be unavoidable
because the input variables haven't been decided yet, so you should
not be allowed to use compare
on these. But for now just use the
standard Prelude classes, and unimplementable functions (which
would not produce an AnyRF
) are calls to error
generate these using var
, or perhaps by directly using the constructor:
AnyRF $ Identity . V.sum
, would for example give the sum of all variables.
functions
:: Monad m | |
=> Maybe String | optional description |
-> (Double, Double) | bounds |
-> AnyRF Identity | g_i(x) |
-> NLPT m () |
add a constraint
add a piece of the objective function, which is added in the form `f_1 + f_2 + ...`, to make it easier to understand (at some point) which components are responsible for the majority of the cost, and which are irrelevant.
low-level bits still needed
data IpOptSolved Source
data ApplicationReturnStatus Source
solver options
setIpoptProblemScaling :: IpProblem -> Double -> IOVector IpNumber -> IOVector IpNumber -> IO BoolSource