You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gilles (JIRA)" <ji...@apache.org> on 2010/06/15 14:03:23 UTC

[jira] Created: (MATH-376) One-time initialization in "DirectSearchOptimizer"

One-time initialization in "DirectSearchOptimizer"
--------------------------------------------------

                 Key: MATH-376
                 URL: https://issues.apache.org/jira/browse/MATH-376
             Project: Commons Math
          Issue Type: Bug
            Reporter: Gilles
            Priority: Minor


In class  "DirectSearchOptimizer" (in package "optimization.direct"), the "optimize" method contains this code (at line 270):
{code}
if (startConfiguration == null) {
    // no initial configuration has been set up for simplex
    // build a default one from a unit hypercube
    final double[] unit = new double[startPoint.length];
    Arrays.fill(unit, 1.0);
    setStartConfiguration(unit);
}
{code}

I think that this has the consequence that it is impossible to call "optimize" a second time, where one would like to solve a problem with a different dimension.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-376) One-time initialization in "DirectSearchOptimizer"

Posted by "Luc Maisonobe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12879084#action_12879084 ] 

Luc Maisonobe commented on MATH-376:
------------------------------------

This code is here only for the case setStartConfiguration has not been called by the user, which is not the recommended way.
This behaviour is documented in the javadoc of the class. The case of multiple calls with different problems size is explained: in this case users must call setStartConfiguration.

> One-time initialization in "DirectSearchOptimizer"
> --------------------------------------------------
>
>                 Key: MATH-376
>                 URL: https://issues.apache.org/jira/browse/MATH-376
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Gilles
>            Priority: Minor
>
> In class  "DirectSearchOptimizer" (in package "optimization.direct"), the "optimize" method contains this code (at line 270):
> {code}
> if (startConfiguration == null) {
>     // no initial configuration has been set up for simplex
>     // build a default one from a unit hypercube
>     final double[] unit = new double[startPoint.length];
>     Arrays.fill(unit, 1.0);
>     setStartConfiguration(unit);
> }
> {code}
> I think that this has the consequence that it is impossible to call "optimize" a second time, where one would like to solve a problem with a different dimension.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (MATH-376) One-time initialization in "DirectSearchOptimizer"

Posted by "Gilles (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gilles resolved MATH-376.
-------------------------

    Fix Version/s: 2.2
       Resolution: Fixed

Implemented (second option) in r955230.


> One-time initialization in "DirectSearchOptimizer"
> --------------------------------------------------
>
>                 Key: MATH-376
>                 URL: https://issues.apache.org/jira/browse/MATH-376
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Gilles
>            Priority: Minor
>             Fix For: 2.2
>
>
> In class  "DirectSearchOptimizer" (in package "optimization.direct"), the "optimize" method contains this code (at line 270):
> {code}
> if (startConfiguration == null) {
>     // no initial configuration has been set up for simplex
>     // build a default one from a unit hypercube
>     final double[] unit = new double[startPoint.length];
>     Arrays.fill(unit, 1.0);
>     setStartConfiguration(unit);
> }
> {code}
> I think that this has the consequence that it is impossible to call "optimize" a second time, where one would like to solve a problem with a different dimension.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (MATH-376) One-time initialization in "DirectSearchOptimizer"

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12879287#action_12879287 ] 

Gilles edited comment on MATH-376 at 6/16/10 8:36 AM:
------------------------------------------------------

Sorry, I should have read the documentation :-}. It would have me rephrased this issue as follows.
Considering the algorithm operation, is it a serious problem that the automatic default is used as initial simplex?
In the affirmative, instead of providing a default (as in the above excerpt) the code should throw an "IllegalStateException", signaling that "setStartConfiguration" must be called.
The alternative would be to extend the check:
{code}
if (startConfiguration == null
    ||  startConfiguration.length != startPoint.length) {
    // Re-initialize the default simplex with the appropriate number of vertices.
    // ...
}
{code}
Because it is confusing (and IMO doesn't make much sense) to allow one default run but not more.


      was (Author: erans):
    Sorry, I should have read the documentation :-}. It would have me rephrased this issue as follows.
Considering the algorithm operation, is it a serious problem that the automatic default is used as initial simplex?
In the affirmative, instead of providing a default (as in the above excerpt) the code should throw an "IllegalStateException", signaling that "setStartConfiguration" must be called.
The alternative would be to extend the check:
{code}
if (startConfiguration == null
    ||  (startConfiguration.length != startPoint.length) {
    // Re-initialize the default simplex with the appropriate number of vertices.
    // ...
}
{code}
Because it is confusing (and IMO doesn't make much sense) to allow one default run but not more.

  
> One-time initialization in "DirectSearchOptimizer"
> --------------------------------------------------
>
>                 Key: MATH-376
>                 URL: https://issues.apache.org/jira/browse/MATH-376
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Gilles
>            Priority: Minor
>
> In class  "DirectSearchOptimizer" (in package "optimization.direct"), the "optimize" method contains this code (at line 270):
> {code}
> if (startConfiguration == null) {
>     // no initial configuration has been set up for simplex
>     // build a default one from a unit hypercube
>     final double[] unit = new double[startPoint.length];
>     Arrays.fill(unit, 1.0);
>     setStartConfiguration(unit);
> }
> {code}
> I think that this has the consequence that it is impossible to call "optimize" a second time, where one would like to solve a problem with a different dimension.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-376) One-time initialization in "DirectSearchOptimizer"

Posted by "Luc Maisonobe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12879300#action_12879300 ] 

Luc Maisonobe commented on MATH-376:
------------------------------------

I agree. Go ahead to make the change, and make sure documentation is updated. It may appear in the javadoc of this top level class as well as in the subclasses and perhaps in the user manual (I did not check).

> One-time initialization in "DirectSearchOptimizer"
> --------------------------------------------------
>
>                 Key: MATH-376
>                 URL: https://issues.apache.org/jira/browse/MATH-376
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Gilles
>            Priority: Minor
>
> In class  "DirectSearchOptimizer" (in package "optimization.direct"), the "optimize" method contains this code (at line 270):
> {code}
> if (startConfiguration == null) {
>     // no initial configuration has been set up for simplex
>     // build a default one from a unit hypercube
>     final double[] unit = new double[startPoint.length];
>     Arrays.fill(unit, 1.0);
>     setStartConfiguration(unit);
> }
> {code}
> I think that this has the consequence that it is impossible to call "optimize" a second time, where one would like to solve a problem with a different dimension.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-376) One-time initialization in "DirectSearchOptimizer"

Posted by "Gilles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12879287#action_12879287 ] 

Gilles commented on MATH-376:
-----------------------------

Sorry, I should have read the documentation :-}. It would have me rephrased this issue as follows.
Considering the algorithm operation, is it a serious problem that the automatic default is used as initial simplex?
In the affirmative, instead of providing a default (as in the above excerpt) the code should throw an "IllegalStateException", signaling that "setStartConfiguration" must be called.
The alternative would be to extend the check:
{code}
if (startConfiguration == null
    ||  (startConfiguration.length != startPoint.length) {
    // Re-initialize the default simplex with the appropriate number of vertices.
    // ...
}
{code}
Because it is confusing (and IMO doesn't make much sense) to allow one default run but not more.


> One-time initialization in "DirectSearchOptimizer"
> --------------------------------------------------
>
>                 Key: MATH-376
>                 URL: https://issues.apache.org/jira/browse/MATH-376
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Gilles
>            Priority: Minor
>
> In class  "DirectSearchOptimizer" (in package "optimization.direct"), the "optimize" method contains this code (at line 270):
> {code}
> if (startConfiguration == null) {
>     // no initial configuration has been set up for simplex
>     // build a default one from a unit hypercube
>     final double[] unit = new double[startPoint.length];
>     Arrays.fill(unit, 1.0);
>     setStartConfiguration(unit);
> }
> {code}
> I think that this has the consequence that it is impossible to call "optimize" a second time, where one would like to solve a problem with a different dimension.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.