Stability | unstable |
---|---|
Maintainer | Adam Vogt <vogt.adam@gmail.com> |
Safe Haskell | None |
Description: lowest-level parts of the binding
- createIpoptProblemAD :: Vec -> Vec -> Vec -> Vec -> (forall a. AnyRFCxt a => Vector a -> a) -> (forall a. AnyRFCxt a => Vector a -> Vector a) -> IO IpProblem
- ipoptSolve :: Vector v Double => IpProblem -> Vec -> IO (IpOptSolved v)
- data IpOptSolved v = IpOptSolved {}
- addIpoptNumOption :: Real a => IpProblem -> String -> a -> IO Bool
- addIpoptStrOption :: IpProblem -> String -> String -> IO Bool
- addIpoptIntOption :: Integral a => IpProblem -> String -> a -> IO Bool
- openIpoptOutputFile :: Integral a => IpProblem -> String -> a -> IO Bool
- type Vec = IOVector IpNumber
- type IpNumber = CDouble
- type IpIndex = CInt
- type IpInt = CInt
- type IpBool = CInt
- type IpF = FunPtr (CInt -> Ptr CDouble -> CInt -> Ptr CDouble -> Ptr () -> IO CInt)
- type IpGradF = FunPtr (CInt -> Ptr CDouble -> CInt -> Ptr CDouble -> Ptr () -> IO CInt)
- type IpG = FunPtr (CInt -> Ptr CDouble -> CInt -> CInt -> Ptr CDouble -> Ptr () -> IO CInt)
- type IpJacG = FunPtr (CInt -> Ptr CDouble -> CInt -> CInt -> CInt -> Ptr CInt -> Ptr CInt -> Ptr CDouble -> Ptr () -> IO CInt)
- type IpH = FunPtr (CInt -> Ptr CDouble -> CInt -> CDouble -> CInt -> Ptr CDouble -> CInt -> CInt -> Ptr CInt -> Ptr CInt -> Ptr CDouble -> Ptr () -> IO CInt)
- newtype IpProblem = IpProblem {
- unIpProblem :: Ptr ()
- data ApplicationReturnStatus
- = SolveSucceeded
- | SolvedToAcceptableLevel
- | InfeasibleProblemDetected
- | SearchDirectionBecomesTooSmall
- | DivergingIterates
- | UserRequestedStop
- | FeasiblePointFound
- | MaximumIterationsExceeded
- | RestorationFailed
- | ErrorInStepComputation
- | MaximumCputimeExceeded
- | NotEnoughDegreesOfFreedom
- | InvalidProblemDefinition
- | InvalidOption
- | InvalidNumberDetected
- | UnrecoverableException
- | NonipoptExceptionThrown
- | InsufficientMemory
- | InternalError
- createIpoptProblem :: Vec -> Vec -> Vec -> Vec -> Int -> Int -> IpF -> IpG -> IpGradF -> IpJacG -> IpH -> IO IpProblem
- freeIpoptProblem :: IpProblem -> IO ()
- setIpoptProblemScaling :: IpProblem -> Double -> IOVector IpNumber -> IOVector IpNumber -> IO Bool
- wrapIpF :: (MVector s CDouble -> IO CDouble) -> IO IpF
- wrapIpGradF :: (MVector s CDouble -> IO (MVector RealWorld CDouble)) -> IO IpGradF
- wrapIpG :: (MVector s CDouble -> IO (MVector RealWorld CDouble)) -> IO IpG
- wrapIpJacG :: (MVector s CInt -> MVector s1 CInt -> IO b) -> (MVector s2 CDouble -> MVector s3 CDouble -> IO b1) -> IO IpJacG
- wrapIpH :: (MVector s3 CInt -> MVector s4 CInt -> IO b1) -> (CDouble -> MVector s CDouble -> MVector s1 CDouble -> MVector s2 CDouble -> IO b) -> IO IpH
- wrapIpF1 :: UnFunPtr IpF -> IO IpF
- wrapIpGradF1 :: UnFunPtr IpGradF -> IO IpGradF
- wrapIpG1 :: UnFunPtr IpG -> IO IpG
- wrapIpJacG1 :: UnFunPtr IpJacG -> IO IpJacG
- wrapIpH1 :: UnFunPtr IpH -> IO IpH
- wrapIpF2 :: (Integral a2, Storable a, Storable a1) => (MVector s a1 -> IO a) -> a2 -> Ptr a1 -> t -> Ptr a -> t1 -> IO IpBool
- wrapIpGradF2 :: (Integral a2, Storable a, Storable a1) => (MVector s a1 -> IO (MVector RealWorld a)) -> a2 -> Ptr a1 -> t -> Ptr a -> t1 -> IO IpBool
- wrapIpG2 :: (Integral a1, Integral a3, Storable a, Storable a2) => (MVector s a2 -> IO (MVector RealWorld a)) -> a3 -> Ptr a2 -> t -> a1 -> Ptr a -> t1 -> IO IpBool
- wrapIpJacG2 :: (Integral a5, Integral a3, Storable a, Storable a1, Storable a2, Storable a4) => (MVector s a -> MVector s1 a1 -> IO b) -> (MVector s2 a2 -> MVector s3 a4 -> IO b1) -> a3 -> Ptr a2 -> t -> t1 -> a5 -> Ptr a -> Ptr a1 -> Ptr a4 -> t2 -> IO IpBool
- wrapIpH2 :: (Integral a1, Integral a3, Integral a7, Storable a, Storable a2, Storable a4, Storable a5, Storable a6) => (MVector s3 a5 -> MVector s4 a6 -> IO b1) -> (t3 -> MVector s a -> MVector s1 a2 -> MVector s2 a4 -> IO b) -> a3 -> Ptr a2 -> t -> t3 -> a1 -> Ptr a -> t1 -> a7 -> Ptr a5 -> Ptr a6 -> Ptr a4 -> t2 -> IO IpBool
specifying problem
:: Vec |
|
-> Vec |
|
-> Vec |
|
-> Vec |
|
-> (forall a. AnyRFCxt a => Vector a -> a) | objective function |
-> (forall a. AnyRFCxt a => Vector a -> Vector a) | constraint functions |
-> IO IpProblem |
Set-up an IpProblem
to be solved later. Only objective function (f
)
and constraint functions (g
) need to be specified. Derivatives needed by ipopt
are computed by Numeric.AD.
To solve the optimization problem:
min f(x) such that xL <= x <= xU gL <= g(x) <= gU
First create an opaque IpProblem
object (nlp):
nlp <- createIpOptProblemAD xL xU gL gU f g
Then pass it off to ipoptSolve
.
ipoptSolve nlp x0
Refer to the example Test2.hs
for details of setting up the vectors supplied.
solve
data IpOptSolved v Source
lenses are in Ipopt.PP
solver options
types
type IpJacG = FunPtr (CInt -> Ptr CDouble -> CInt -> CInt -> CInt -> Ptr CInt -> Ptr CInt -> Ptr CDouble -> Ptr () -> IO CInt)Source
type IpH = FunPtr (CInt -> Ptr CDouble -> CInt -> CDouble -> CInt -> Ptr CDouble -> CInt -> CInt -> Ptr CInt -> Ptr CInt -> Ptr CDouble -> Ptr () -> IO CInt)Source
IpProblem | |
|
data ApplicationReturnStatus Source
lower-level parts of the binding
createIpoptProblem :: Vec -> Vec -> Vec -> Vec -> Int -> Int -> IpF -> IpG -> IpGradF -> IpJacG -> IpH -> IO IpProblemSource
freeIpoptProblem :: IpProblem -> IO ()Source
setIpoptProblemScaling :: IpProblem -> Double -> IOVector IpNumber -> IOVector IpNumber -> IO BoolSource
marshalling functions
wrapIpJacG :: (MVector s CInt -> MVector s1 CInt -> IO b) -> (MVector s2 CDouble -> MVector s3 CDouble -> IO b1) -> IO IpJacGSource
wrapIpH :: (MVector s3 CInt -> MVector s4 CInt -> IO b1) -> (CDouble -> MVector s CDouble -> MVector s1 CDouble -> MVector s2 CDouble -> IO b) -> IO IpHSource
wrapIpGradF1 :: UnFunPtr IpGradF -> IO IpGradFSource
wrapIpJacG1 :: UnFunPtr IpJacG -> IO IpJacGSource
wrapIpF2 :: (Integral a2, Storable a, Storable a1) => (MVector s a1 -> IO a) -> a2 -> Ptr a1 -> t -> Ptr a -> t1 -> IO IpBoolSource
wrapIpGradF2 :: (Integral a2, Storable a, Storable a1) => (MVector s a1 -> IO (MVector RealWorld a)) -> a2 -> Ptr a1 -> t -> Ptr a -> t1 -> IO IpBoolSource
wrapIpG2 :: (Integral a1, Integral a3, Storable a, Storable a2) => (MVector s a2 -> IO (MVector RealWorld a)) -> a3 -> Ptr a2 -> t -> a1 -> Ptr a -> t1 -> IO IpBoolSource
wrapIpJacG2 :: (Integral a5, Integral a3, Storable a, Storable a1, Storable a2, Storable a4) => (MVector s a -> MVector s1 a1 -> IO b) -> (MVector s2 a2 -> MVector s3 a4 -> IO b1) -> a3 -> Ptr a2 -> t -> t1 -> a5 -> Ptr a -> Ptr a1 -> Ptr a4 -> t2 -> IO IpBoolSource
wrapIpH2 :: (Integral a1, Integral a3, Integral a7, Storable a, Storable a2, Storable a4, Storable a5, Storable a6) => (MVector s3 a5 -> MVector s4 a6 -> IO b1) -> (t3 -> MVector s a -> MVector s1 a2 -> MVector s2 a4 -> IO b) -> a3 -> Ptr a2 -> t -> t3 -> a1 -> Ptr a -> t1 -> a7 -> Ptr a5 -> Ptr a6 -> Ptr a4 -> t2 -> IO IpBoolSource