ipopt-hs-0.4.2.0: haskell binding to ipopt and nlopt including automatic differentiation

Stabilityunstable
MaintainerAdam Vogt <vogt.adam@gmail.com>
Safe HaskellNone

Ipopt.Raw

Contents

Description

Description: lowest-level parts of the binding

Synopsis

specifying problem

createIpoptProblemADSource

Arguments

:: Vec

xL Vector of lower bounds for decision variables with length n

-> Vec

xU Vector of upper bounds for decision variables

-> Vec

gL Vector of lower bounds for constraint functions g(x) with length m

-> Vec

gU Vector of upper bounds for constraint functions g(x)

-> (forall a. AnyRFCxt a => Vector a -> a)

objective function f : R^n -> R

-> (forall a. AnyRFCxt a => Vector a -> Vector a)

constraint functions g : R^n -> R^m

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

ipoptSolveSource

Arguments

:: Vector v Double 
=> IpProblem 
-> Vec

starting point x. Note that the value is overwritten with the final x.

-> IO (IpOptSolved v) 

solver options

types

type Vec = IOVector DoubleSource

Vector of numbers

type IpF = FunPtr (CInt -> Ptr CDouble -> CInt -> Ptr CDouble -> Ptr () -> IO CInt)Source

type IpG = FunPtr (CInt -> Ptr CDouble -> CInt -> CInt -> Ptr CDouble -> Ptr () -> IO CInt)Source

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

type IntermediateCBSource

Arguments

 = CInt

alg_mod (0 regular, 1 is resto)

-> CInt

iter count

-> Double

obj value

-> Double

inf_pr

-> Double

inf_du

-> Double

mu

-> Double

d_norm

-> Double

regularization_size

-> Double

alpha_du

-> Double

alpha_pr

-> CInt

ls_trials

-> Ptr ()

user_data (usually null)

-> IO IpBool 

lower-level parts of the binding

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

wrapIpF1 :: UnFunPtr IpF -> IO IpFSource

wrapIpG1 :: UnFunPtr IpG -> IO IpGSource

wrapIpH1 :: UnFunPtr IpH -> IO IpHSource

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