lagrangian 0.3.0.0 → 0.3.0.1
raw patch · 3 files changed
+8/−9 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
lagrangian.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.3.0.0+version: 0.3.0.1 -- A short (one-line) description of the package. synopsis: Solve lagrange multiplier problems@@ -24,7 +24,7 @@ . @ \> solve 0.00001 (negate . sum . map (\x -> x * log x)) [sum \<=\> 1] 3- ([0.33, 0.33, 0.33], [-0.09])+ Right ([0.33, 0.33, 0.33], [-0.09]) @ . The first elements of the result pair are the arguments for the
src/Numeric/AD/Lagrangian.hs view
@@ -1,11 +1,10 @@ -- |Numerically solve convex lagrange multiplier problems with conjugate gradient descent. -- --- For example, find the maximum entropy with the constraint that the probabilities add--- up to one. --- +-- Here is an example from the Wikipedia page on Lagrange multipliers.+-- Maximize f(x, y) = x + y, subject to the constraint x^2 + y^2 = 1 -- --- >>> solve 0.00001 (negate . sum . map (\x -> x * log x)) [sum <=> 1] 3--- ([0.33, 0.33, 0.33], [-0.09])+-- >>> solve 0.00001 (\[x, y] -> x + y) [\[x, y] -> x^2 + y^2 <=> 1] 2+-- Right ([0.707,0.707], [-0.707]) -- -- The first elements of the result pair are the arguments for the objective function at the minimum. -- The second elements are the lagrange multipliers.
src/Numeric/AD/Lagrangian/Internal.hs view
@@ -37,7 +37,7 @@ -- ^ The arity of the objective function which should equal the arity of -- the constraints. -> Either (Result, Statistics) (S.Vector Double, S.Vector Double) - -- ^ Either an explaination of why the gradient descent failed or a pair + -- ^ Either an explanation of why the gradient descent failed or a pair -- containing the arguments at the minimum and the lagrange multipliers solve tolerance toMin constraints argCount = result where -- The function to minimize for the langrangian is the squared gradient@@ -85,7 +85,7 @@ -- | WARNING. Experimental. -- This is not a true feasibility test for the function. I am not sure --- exactly how to implement that. This just checks the feasiblility at point.+-- exactly how to implement that. This just checks the feasiblility at a point. -- If this ever returns false, 'solve' can fail. feasible :: (forall s r. (Mode s, Mode r) => [AD2 s r Double] -> AD2 s r Double) -> (forall s r. (Mode s, Mode r) => [Constraint (AD2 s r Double)] )