[ 
https://issues.apache.org/jira/browse/MATH-1658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17737303#comment-17737303
 ] 

Gilles Sadowski commented on MATH-1658:
---------------------------------------

Now I'm confused as to what problem we are trying to solve.
It seems that having
{code}
interface ConvergenceChecker extends OptimizationData {
    // ...
}
{code}
would satisfy this feature request.

bq. Given that everywhere we give public write accessors of the form 
{{set<optDataClassName>(<optDataClass> data)}}

What is the benefit (beyond saving a few lines in sub-classes) of adding 
setters (and an out-of-band convention of how they must be named)?

bq. [...] ugly instanceof and type casts.

I agree that those are not nice; but relying on reflection instead is not 
better IMO.

bq. [...] we may have a new fluent interface for the same price.

This is a drastic change of the API, with no more functionality than what is 
allowed by the current one, through multiple calls to {{optimize(...)}} (with 
new arguments).


> ConvergenceChecker should implement OptimizationData
> ----------------------------------------------------
>
>                 Key: MATH-1658
>                 URL: https://issues.apache.org/jira/browse/MATH-1658
>             Project: Commons Math
>          Issue Type: Improvement
>          Components: legacy
>    Affects Versions: 4.0-beta1
>            Reporter: François Laferrière
>            Priority: Minor
>         Attachments: 
> MATH-1658-ConvergenceChecker-implements-OptimizationData.patch, 
> MATH-1658.patch
>
>
> It is a bit peculiar that with BaseOptimizer, ConvergenceChecker can be 
> passed only in constructor.
> It should be possible to change ConvergenceChecker at any other time.
> Further it is a bit strange that the constructor do not accept other 
> OptimizationData.
> In my use cases, I need to create an optimizer once with complex 
> OptimizationData and reuse it many time with very few changes (including 
> changing the ConvergenceChecker).
> So, I suggest that
>  * ConvergenceChecker implements OptimizationData.
>  * protected BaseOptimizer(ConvergenceChecker<PAIR> checker) is replaced by 
> protected BaseOptimizer(OptimizationData... optData) 
> Doing so is compatible with existing code and provide much more flexibility.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to