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

Safe HaskellNone

Ipopt.AnyRF

Contents

Description

The AnyRF 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.

Values of type AnyRF Identity can be generated using functions defined in Ipopt.NLP (also exported by Ipopt). Directly using the constructor is another option: AnyRF $ Identity . V.sum, calculates the sum of all variables in the problem.

convergence can sometimes be improved by exposing additional variables/derivatives to the solver. IE. instead of maximizing f(u) where we internally calculate x(u), maximize f(u,y) with another constraint that y = x(u). Albersmeyer 2010 SIAM. Also generally known in process optimization (ie. equation-oriented which has many variables works, while sequential-modular modes that have very few variables left does not work)

AnyRF could be used to generate some C and feed it to something like casadi, though this has to happen a runtime unless there's a clean way to handle constant parameters such as (fromIntegral 3)

Synopsis

Documentation

data AnyRF cb Source

AnyRF cb is a function that uses variables from the nonlinear program in a way supported by AnyRFCxt. The cb is usually Identity

Constructors

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

type AnyRFCxt a = (VectorSpace a, RealFloat a, Scalar a ~ a)Source

RealFloat gives most numerical operations, VectorSpace is involved to allow using definitions from the splines package

helpers for defining instances

liftOp0 :: (forall a. AnyRFCxt a => a) -> AnyRF IdentitySource

liftOp1 :: (forall a. AnyRFCxt a => a -> a) -> AnyRF Identity -> AnyRF IdentitySource

liftOp2 :: (forall a. AnyRFCxt a => a -> a -> a) -> AnyRF Identity -> AnyRF Identity -> AnyRF IdentitySource

orphan instances

these belong somewhere between the ad package and vector-space