Is there a way to write custom methods for NonLinearModelFit or NMinimize?
To give background, I currently have a batch of code that uses NonLinearModelFit with NMinimize as the method to do constrained optimization. The interface I developed exposes all the method options and suboptions for NMinimize for user selection.
Since writing that code I've been writing my own algorithms for multi-objective optimization (MOO) which I think would perform quite well. However, with the old code being built around the structure of the FittedModel construct that NonLinearModelFit returns, I would need to wrap my algorithms in code that produces the same structured output. Not impossible, but really annoying.
So my hope is that maybe there is a way that I can create custom methods for either NMinimize or NonLinearModelFit so that Mathematica can pass along the FittedModel and reduce development time.
NMinimize's Nelder-Mead algorithm. It works, but it's very sensitive to starting values, and it is sluggish even in the simplest of cases. I'd love to be able to still useNonlinearModelFitfor its rich statistical output, but I couldn't make it work. I'd very much appreciate knowing more about your approach! – MarcoB May 07 '15 at 01:47Method -> {"NMinimize", StepMonitor :> steps++, EvaluationMonitor :> evals++, Method -> CurrentValue[EvaluationNotebook[], {TaggingRules, "method"}]}and that took care of it. I usedTaggingRulesbecause the code produces a pallet that can be used independent of the underlying notebook being saved. Most of the code is preparing the data and constraints to be inserted intoNonLinearModelFit. We've always had very consistent results with the NelderMead method. – Guyondowy May 09 '15 at 06:06"method" -> {"NelderMead", "ContractRatio" -> 0.5, "ExpandRatio" -> 2.0, "InitialPoints" -> Automatic, "PenaltyFunction" -> Automatic, "PostProcess" -> Automatic, "RandomSeed" -> 0, "ReflectRatio" -> 1.0, "ShrinkRatio" -> 0.5, "Tolerance" -> 0.001, but these are the default values for the NelderMead algorithm so nothing revelatory. At least this way you know what the"method"TaggingRulesis referencing. As I hinted to earlier, all these are exposed through a custom UI – Guyondowy May 09 '15 at 07:21