Safe Haskell | None |
---|---|
Language | Haskell2010 |
- ipopts :: QuasiQuoter
- uuParseTest :: (Show a1, ListLike s a1) => P (Str a1 s LineColPos) a -> s -> (a, [Error LineColPos])
- addIpoptOpt :: Name -> String -> OptionVal -> ExpQ
- liftDouble :: Double -> ExpQ
- parseOpts :: P (Str Char String LineColPos) [(String, OptionVal)]
- parseOpt :: P (Str Char String LineColPos) (String, OptionVal)
- data OptionVal
- data OptionType
- ipoptOptions :: Map String OptionType
Documentation
an expression-only quasiquote intended to be the second argument for
solveNLP'
(so solveNLP [ipopts| tol = 1e-3 |]
). This is a shortcut
for calling addIpoptNumOption
addIpoptStrOption
or addIpoptIntOption
.
Refer to ipopt's options reference,
the syntax is like option_name = value;option2 = value2
. The semicolons are optional and
whitespace alone can separate the option name from the value. A few examples of the parser:
>>>
:set -XQuasiQuotes
>>>
let f = [ipopts| tol = 1e-3; print_level = 0 |]
>>>
:t f
f :: IpProblem -> IO ()
>>>
let p x = uuParseTest parseOpts x
>>>
p "tol = 3"
([("tol",ANum 3.0)],[])
>>>
p "tol = 3 tol = 4" -- the last one wins. No warnings done (yet).
([("tol",ANum 3.0),("tol",ANum 4.0)],[])
>>>
p "tol = 3\n\ntol = 4"
([("tol",ANum 3.0),("tol",ANum 4.0)],[])
>>>
p "acceptable_iter = 25; output_file = foobar" -- quotation marks optional
([("acceptable_iter",AInt 25),("output_file",AStr "foobar")],[])
>>>
p "output_file = \"foo bar\"" -- but needed here
([("output_file",AStr "foo bar")],[])
>>>
putStrLn $ (++"...") $ take 100 $ show $ p "atol = 1.8" -- typo gets corrected
([("tol",ANum 1.8)],[-- Deleted 'a' at position LineColPos 0 0 0 expecting one of [Whitespace, ...
>>>
p "tol = $xY" -- interpolating haskell variables
([("tol",AVar OptionNum "xY")],[])
uuParseTest :: (Show a1, ListLike s a1) => P (Str a1 s LineColPos) a -> s -> (a, [Error LineColPos]) Source
liftDouble :: Double -> ExpQ Source
what lift
should do for Double
data OptionType Source
OptionNum | |
OptionStr | |
OptionInt | |
OptionBool | actually string yes or string no |
ipoptOptions :: Map String OptionType Source
a list of all the options in http://www.coin-or.org/Ipopt/documentation/node39.html