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

Luc Maisonobe commented on MATH-388:
------------------------------------

This issue is in some sense related to MATH-380.
I intend to completely change the way to solve ODE problems with Jacobians soon 
using a much better architecture (the current implementation is really bad).
I will however encounter the exact same problem with the new architecture so 
need to solve MATH-388 before MATH-380.

The simple Initial Value Problem is:
   y(t0) = y0
   y'(t) = f(t,y)
its solution is a function y(t)

Here, we want to integrate at the same time this problem and an extension of 
this problem which is:
   dy(t0)/dy0      = Jy0
   dy(t0)/dp       = Jp0
   d[dy(t)/dy~0~]/dt = one variational equation
   d[dy(t)/dp]/dt  = another variational equation

So we end up with a very large state vector containing the initial y and also 
two jacobians. As an example, in some orbit determination problems the size of 
the initial y vector is 7 and the size of the extended y can be 7 + (7 * 7) + 
(7 * 2) = 70.

However, we want to compute the step sizes and error estimation only on the 
first 7 parameters, not the 63 final ones.

The dimension of the state vector is specified by the user who implements the 
FirstOrderDifferentialEquations method and hence provides a getDimension() 
method. There is no way now to say: my problem is dimension 70 but error should 
only be computed on the first 7 components of the vector.

So we need to add a getErrorDimension() or getMainProblemDimension() or 
something like that. In the example above, this new method would return 7 and 
the existing getDimension would return 70. The ODE integrators have to be 
changed (this is a simple change) to use the appropriate dimension in the 
various loops.

Adding the new method in the FirstOrderDifferentialEquations is bad because it 
breaks compatibility on user code (the interface is explicitly here to be 
implemented by users as it represents the problem they want our integrators to 
solve). I would suggest to extend the interface using something like:

{code:title=ExtendedFirstOrderDifferentialEquations.java}
public interface ExtendedFirstOrderDifferentialEquations
  extends FirstOrderDifferentialEquations {

    /** Return the dimension of the main problem.
      * <p>
      * The main problem represent the first part of an ODE state
      * and the error estimations and adaptive step size computation
      * should be done on this first part only, not on the final part
      * of the state which represent an extension of the main problem.
      * </p>
      * @return dimension of the main problem, must be lesser than or
      * equal to the {...@link #getDimension() total dimension}
      */
    int getMainProblemDimension();

}
{code}

Then ODE integrators would have to check if the user provided 
FirstOrderDifferentialEquations implements only the base interface or the 
extended interface. In the former case, getDimension() would be used for both 
state dimension and error dimension, in the later case the appropriate method 
would be used for each loop.

This is the only solution I see that is backaward compatible. It implies 
putting in our integrators code statements like:

{code}
  int errorDimension;
  if (equations instanceof ExtendedFirstOrderDifferentialEquations) {
    errorDimension = equations.getDimension();
  } else {
    ExtendedFirstOrderDifferentialEquations extEq =  
(ExtendedFirstOrderDifferentialEquations) equations;
    errorDimension = extEq.getMainProblemDimension();
  }
{code}

This is not really elegant, but I don't see another way yet.

One problem is that some adventurous users may have implemented their own ODE 
integrators and would not include this new feature, because basically the 
requirements for an integrator are only defined in terms of 
FirstOrderDifferentialEquations not on the proposed new 
ExtendedFirstOrderDifferentialEquations. However, this is not an incompatible 
change: these custom integrator currently use the complete dimension to compute 
size, and they would still do it. So this problem is probably not important 
(and I'm pretty sure noone as attempted yet to implement their own integrators 
from scratch).

What do other developers think ?


> ODE integrator: different size needed for state vector and tolerance error 
> vector dimension
> -------------------------------------------------------------------------------------------
>
>                 Key: MATH-388
>                 URL: https://issues.apache.org/jira/browse/MATH-388
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Pascal Parraud
>            Assignee: Luc Maisonobe
>             Fix For: 2.2
>
>
> The user should be allowed to chose a tolerance vector dimension different 
> from the state vector dimension.
> For example, using the FirstOrderIntegratorWithJacibians, we don't want to 
> set some tolerance error for the jacobian part in order to not interfere with 
> the main state vector integration.
> This is really a problem with the dimension of the tolerance vector, there is 
> no work-around assigning some particular value to the tolerance vector.

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

Reply via email to