packages feed

casadi-bindings-1.9.0.0: Casadi/Wrappers/Classes/DirectSingleShooting.hs

{-# OPTIONS_GHC -Wall #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# Language ForeignFunctionInterface #-}
{-# Language FlexibleInstances #-}
{-# Language MultiParamTypeClasses #-}

module Casadi.Wrappers.Classes.DirectSingleShooting
       (
         DirectSingleShooting,
         DirectSingleShootingClass(..),
         directSingleShooting,
         directSingleShooting',
         directSingleShooting'',
         directSingleShooting''',
         directSingleShooting_getConstraintBounds,
         directSingleShooting_getGuess,
         directSingleShooting_getNLPSolver,
         directSingleShooting_getReportConstraints,
         directSingleShooting_getVariableBounds,
         directSingleShooting_reportConstraints',
         directSingleShooting_setOptimalSolution,
       ) where


import Prelude hiding ( Functor )

import Data.Vector ( Vector )
import Foreign.C.Types
import Foreign.Ptr ( Ptr )
import Foreign.ForeignPtr ( newForeignPtr )
import System.IO.Unsafe ( unsafePerformIO ) -- for show instances

import Casadi.Wrappers.Classes.PrintableObject
import Casadi.Wrappers.CToolsInstances ( )
import Casadi.Wrappers.Data
import Casadi.Wrappers.Enums
import Casadi.MarshalTypes ( CppVec, StdString' ) -- StdOstream'
import Casadi.Marshal ( Marshal(..), withMarshal )
import Casadi.WrapReturn ( WrapReturn(..) )

instance Show DirectSingleShooting where
  show = unsafePerformIO . printableObject_getDescription
-- direct wrapper
foreign import ccall unsafe "CasADi__DirectSingleShooting__getGuess" c_CasADi__DirectSingleShooting__getGuess
  :: Ptr DirectSingleShooting' -> Ptr (CppVec CDouble) -> IO ()
casADi__DirectSingleShooting__getGuess
  :: DirectSingleShooting -> Vector Double -> IO ()
casADi__DirectSingleShooting__getGuess x0 x1 =
  withMarshal x0 $ \x0' ->
  withMarshal x1 $ \x1' ->
  c_CasADi__DirectSingleShooting__getGuess x0' x1' >>= wrapReturn

-- classy wrapper
{-|
>Get the variables.
-}
directSingleShooting_getGuess :: DirectSingleShootingClass a => a -> Vector Double -> IO ()
directSingleShooting_getGuess x = casADi__DirectSingleShooting__getGuess (castDirectSingleShooting x)


-- direct wrapper
foreign import ccall unsafe "CasADi__DirectSingleShooting__getVariableBounds" c_CasADi__DirectSingleShooting__getVariableBounds
  :: Ptr DirectSingleShooting' -> Ptr (CppVec CDouble) -> Ptr (CppVec CDouble) -> IO ()
casADi__DirectSingleShooting__getVariableBounds
  :: DirectSingleShooting -> Vector Double -> Vector Double -> IO ()
casADi__DirectSingleShooting__getVariableBounds x0 x1 x2 =
  withMarshal x0 $ \x0' ->
  withMarshal x1 $ \x1' ->
  withMarshal x2 $ \x2' ->
  c_CasADi__DirectSingleShooting__getVariableBounds x0' x1' x2' >>= wrapReturn

-- classy wrapper
{-|
>Get the variables.
-}
directSingleShooting_getVariableBounds :: DirectSingleShootingClass a => a -> Vector Double -> Vector Double -> IO ()
directSingleShooting_getVariableBounds x = casADi__DirectSingleShooting__getVariableBounds (castDirectSingleShooting x)


-- direct wrapper
foreign import ccall unsafe "CasADi__DirectSingleShooting__getConstraintBounds" c_CasADi__DirectSingleShooting__getConstraintBounds
  :: Ptr DirectSingleShooting' -> Ptr (CppVec CDouble) -> Ptr (CppVec CDouble) -> IO ()
casADi__DirectSingleShooting__getConstraintBounds
  :: DirectSingleShooting -> Vector Double -> Vector Double -> IO ()
casADi__DirectSingleShooting__getConstraintBounds x0 x1 x2 =
  withMarshal x0 $ \x0' ->
  withMarshal x1 $ \x1' ->
  withMarshal x2 $ \x2' ->
  c_CasADi__DirectSingleShooting__getConstraintBounds x0' x1' x2' >>= wrapReturn

-- classy wrapper
{-|
>Get the constraints.
-}
directSingleShooting_getConstraintBounds :: DirectSingleShootingClass a => a -> Vector Double -> Vector Double -> IO ()
directSingleShooting_getConstraintBounds x = casADi__DirectSingleShooting__getConstraintBounds (castDirectSingleShooting x)


-- direct wrapper
foreign import ccall unsafe "CasADi__DirectSingleShooting__setOptimalSolution" c_CasADi__DirectSingleShooting__setOptimalSolution
  :: Ptr DirectSingleShooting' -> Ptr (CppVec CDouble) -> IO ()
casADi__DirectSingleShooting__setOptimalSolution
  :: DirectSingleShooting -> Vector Double -> IO ()
casADi__DirectSingleShooting__setOptimalSolution x0 x1 =
  withMarshal x0 $ \x0' ->
  withMarshal x1 $ \x1' ->
  c_CasADi__DirectSingleShooting__setOptimalSolution x0' x1' >>= wrapReturn

-- classy wrapper
{-|
>Set the optimal solution.
-}
directSingleShooting_setOptimalSolution :: DirectSingleShootingClass a => a -> Vector Double -> IO ()
directSingleShooting_setOptimalSolution x = casADi__DirectSingleShooting__setOptimalSolution (castDirectSingleShooting x)


-- direct wrapper
foreign import ccall unsafe "CasADi__DirectSingleShooting__getNLPSolver" c_CasADi__DirectSingleShooting__getNLPSolver
  :: Ptr DirectSingleShooting' -> IO (Ptr NLPSolver')
casADi__DirectSingleShooting__getNLPSolver
  :: DirectSingleShooting -> IO NLPSolver
casADi__DirectSingleShooting__getNLPSolver x0 =
  withMarshal x0 $ \x0' ->
  c_CasADi__DirectSingleShooting__getNLPSolver x0' >>= wrapReturn

-- classy wrapper
directSingleShooting_getNLPSolver :: DirectSingleShootingClass a => a -> IO NLPSolver
directSingleShooting_getNLPSolver x = casADi__DirectSingleShooting__getNLPSolver (castDirectSingleShooting x)


-- direct wrapper
foreign import ccall unsafe "CasADi__DirectSingleShooting__reportConstraints_TIC" c_CasADi__DirectSingleShooting__reportConstraints_TIC
  :: Ptr DirectSingleShooting' -> IO ()
casADi__DirectSingleShooting__reportConstraints'
  :: DirectSingleShooting -> IO ()
casADi__DirectSingleShooting__reportConstraints' x0 =
  withMarshal x0 $ \x0' ->
  c_CasADi__DirectSingleShooting__reportConstraints_TIC x0' >>= wrapReturn

-- classy wrapper
directSingleShooting_reportConstraints' :: DirectSingleShootingClass a => a -> IO ()
directSingleShooting_reportConstraints' x = casADi__DirectSingleShooting__reportConstraints' (castDirectSingleShooting x)


-- direct wrapper
foreign import ccall unsafe "CasADi__DirectSingleShooting__getReportConstraints" c_CasADi__DirectSingleShooting__getReportConstraints
  :: Ptr DirectSingleShooting' -> IO (Ptr StdString')
casADi__DirectSingleShooting__getReportConstraints
  :: DirectSingleShooting -> IO String
casADi__DirectSingleShooting__getReportConstraints x0 =
  withMarshal x0 $ \x0' ->
  c_CasADi__DirectSingleShooting__getReportConstraints x0' >>= wrapReturn

-- classy wrapper
directSingleShooting_getReportConstraints :: DirectSingleShootingClass a => a -> IO String
directSingleShooting_getReportConstraints x = casADi__DirectSingleShooting__getReportConstraints (castDirectSingleShooting x)


-- direct wrapper
foreign import ccall unsafe "CasADi__DirectSingleShooting__DirectSingleShooting" c_CasADi__DirectSingleShooting__DirectSingleShooting
  :: IO (Ptr DirectSingleShooting')
casADi__DirectSingleShooting__DirectSingleShooting
  :: IO DirectSingleShooting
casADi__DirectSingleShooting__DirectSingleShooting  =
  c_CasADi__DirectSingleShooting__DirectSingleShooting  >>= wrapReturn

-- classy wrapper
{-|
>>  CasADi::DirectSingleShooting::DirectSingleShooting()
>------------------------------------------------------------------------
>
>Default constructor.
>
>>  CasADi::DirectSingleShooting::DirectSingleShooting(const Function &ffcn, const Function &mfcn, const Function &cfcn=Function(), const Function &rfcn=Function())
>------------------------------------------------------------------------
>
>Create a multiple shooting OCP solver.
>
>Parameters:
>-----------
>
>ffcn:  Continuous time dynamics, an CasADi::Function with the folowing
>mapping:
>
>>Input scheme: CasADi::DAEInput (DAE_NUM_IN = 5) [daeIn]
>+-----------+-------+----------------------------+
>| Full name | Short |        Description         |
>+===========+=======+============================+
>| DAE_X     | x     | Differential state .       |
>+-----------+-------+----------------------------+
>| DAE_Z     | z     | Algebraic state .          |
>+-----------+-------+----------------------------+
>| DAE_P     | p     | Parameter .                |
>+-----------+-------+----------------------------+
>| DAE_T     | t     | Explicit time dependence . |
>+-----------+-------+----------------------------+
>
>>Output scheme: CasADi::DAEOutput (DAE_NUM_OUT = 4) [daeOut]
>+-----------+-------+--------------------------------------------+
>| Full name | Short |                Description                 |
>+===========+=======+============================================+
>| DAE_ODE   | ode   | Right hand side of the implicit ODE .      |
>+-----------+-------+--------------------------------------------+
>| DAE_ALG   | alg   | Right hand side of algebraic equations .   |
>+-----------+-------+--------------------------------------------+
>| DAE_QUAD  | quad  | Right hand side of quadratures equations . |
>+-----------+-------+--------------------------------------------+
> Important notes:
>In the above table, INTEGRATOR_P input is not really of shape (np x
>1), but rather ( (np+nu) x 1 ).
>
>The first np entries of the INTEGRATOR_P input are interpreted as parameters
>to be optimized but constant over the whole domain. The remainder are
>interpreted as controls.
>
>BEWARE: if the right hand side of ffcn is dependent on time, the results
>will be incorrect.
>
>Parameters:
>-----------
>
>mfcn:  Mayer term, CasADi::Function mapping to cost (1 x 1)
>
>>Input scheme: CasADi::MayerInput (MAYER_NUM_IN = 3) [mayerIn]
>+-----------+-------+---------------------------------------------+
>| Full name | Short |                 Description                 |
>+===========+=======+=============================================+
>| MAYER_X   | x     | States at the end of integration (nx x 1) . |
>+-----------+-------+---------------------------------------------+
>| MAYER_P   | p     | Problem parameters (np x 1) .               |
>+-----------+-------+---------------------------------------------+
>
>Parameters:
>-----------
>
>cfcn:  Path constraints, CasADi::Function mapping to (nh x 1)
>
>>Input scheme: CasADi::DAEInput (DAE_NUM_IN = 5) [daeIn]
>+-----------+-------+----------------------------+
>| Full name | Short |        Description         |
>+===========+=======+============================+
>| DAE_X     | x     | Differential state .       |
>+-----------+-------+----------------------------+
>| DAE_Z     | z     | Algebraic state .          |
>+-----------+-------+----------------------------+
>| DAE_P     | p     | Parameter .                |
>+-----------+-------+----------------------------+
>| DAE_T     | t     | Explicit time dependence . |
>+-----------+-------+----------------------------+
>
>Parameters:
>-----------
>
>rfcn:  Initial value constraints
-}
directSingleShooting :: IO DirectSingleShooting
directSingleShooting = casADi__DirectSingleShooting__DirectSingleShooting


-- direct wrapper
foreign import ccall unsafe "CasADi__DirectSingleShooting__DirectSingleShooting_TIC" c_CasADi__DirectSingleShooting__DirectSingleShooting_TIC
  :: Ptr Function' -> Ptr Function' -> Ptr Function' -> Ptr Function' -> IO (Ptr DirectSingleShooting')
casADi__DirectSingleShooting__DirectSingleShooting'
  :: Function -> Function -> Function -> Function -> IO DirectSingleShooting
casADi__DirectSingleShooting__DirectSingleShooting' x0 x1 x2 x3 =
  withMarshal x0 $ \x0' ->
  withMarshal x1 $ \x1' ->
  withMarshal x2 $ \x2' ->
  withMarshal x3 $ \x3' ->
  c_CasADi__DirectSingleShooting__DirectSingleShooting_TIC x0' x1' x2' x3' >>= wrapReturn

-- classy wrapper
directSingleShooting' :: Function -> Function -> Function -> Function -> IO DirectSingleShooting
directSingleShooting' = casADi__DirectSingleShooting__DirectSingleShooting'


-- direct wrapper
foreign import ccall unsafe "CasADi__DirectSingleShooting__DirectSingleShooting_TIC_TIC" c_CasADi__DirectSingleShooting__DirectSingleShooting_TIC_TIC
  :: Ptr Function' -> Ptr Function' -> Ptr Function' -> IO (Ptr DirectSingleShooting')
casADi__DirectSingleShooting__DirectSingleShooting''
  :: Function -> Function -> Function -> IO DirectSingleShooting
casADi__DirectSingleShooting__DirectSingleShooting'' x0 x1 x2 =
  withMarshal x0 $ \x0' ->
  withMarshal x1 $ \x1' ->
  withMarshal x2 $ \x2' ->
  c_CasADi__DirectSingleShooting__DirectSingleShooting_TIC_TIC x0' x1' x2' >>= wrapReturn

-- classy wrapper
directSingleShooting'' :: Function -> Function -> Function -> IO DirectSingleShooting
directSingleShooting'' = casADi__DirectSingleShooting__DirectSingleShooting''


-- direct wrapper
foreign import ccall unsafe "CasADi__DirectSingleShooting__DirectSingleShooting_TIC_TIC_TIC" c_CasADi__DirectSingleShooting__DirectSingleShooting_TIC_TIC_TIC
  :: Ptr Function' -> Ptr Function' -> IO (Ptr DirectSingleShooting')
casADi__DirectSingleShooting__DirectSingleShooting'''
  :: Function -> Function -> IO DirectSingleShooting
casADi__DirectSingleShooting__DirectSingleShooting''' x0 x1 =
  withMarshal x0 $ \x0' ->
  withMarshal x1 $ \x1' ->
  c_CasADi__DirectSingleShooting__DirectSingleShooting_TIC_TIC_TIC x0' x1' >>= wrapReturn

-- classy wrapper
directSingleShooting''' :: Function -> Function -> IO DirectSingleShooting
directSingleShooting''' = casADi__DirectSingleShooting__DirectSingleShooting'''