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 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. |
[ https://issues.apache.org/jira/browse/MATH-388?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Luc Maisonobe updated MATH-388: ------------------------------- Assignee: Luc Maisonobe Fix Version/s: 2.2 > 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. |
In reply to this post by ASF GitHub Bot (Jira)
[ 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. |
In reply to this post by ASF GitHub Bot (Jira)
[ https://issues.apache.org/jira/browse/MATH-388?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Luc Maisonobe updated MATH-388: ------------------------------- Attachment: math-388.patch Could you check whether this patch solves the problem or not ? You should have your ODE implement ExtendedFirstOrderDifferentialEquations instead of FirstOrderDifferentialEquations, so you would need to add an implementation for the getMainDimension method. I did not have the time to do any verification by myself except running existing tests that do not use this new interface. So there may be some problems with the patch, mainly things like ArrayIndexOutOfBoundsException, so use this with care. I will wait for your feedback before checking this in the subversion repository. > 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 > > Attachments: math-388.patch > > > 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. |
In reply to this post by ASF GitHub Bot (Jira)
[ https://issues.apache.org/jira/browse/MATH-388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12890725#action_12890725 ] Pascal Parraud commented on MATH-388: ------------------------------------- After a few tests, the patch: * seems ok for DormandPrince853Integrator, * seems ok for GraggBulirschStoerIntegrator, with 2 fixes : ** in GraggBulirschStoerIntegrator, y0.length changed into scale.length (or mainSetDimension) at lines 712 & 716 ( integrate method), ** in GraggBulirschStoerStepInterpolator, currentState.length changed into scale.length at lines 302 & 306 (estimateErrror method), * needs to be tested for others integrators. And, waiting for a new architecture, ODEWithJacobians & ParameterizedODE classes should extend ExtendedFirstOrderDifferentialEquations instead of FirstOrderDifferentialEquations. > 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 > > Attachments: math-388.patch > > > 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. |
In reply to this post by ASF GitHub Bot (Jira)
[ https://issues.apache.org/jira/browse/MATH-388?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Luc Maisonobe resolved MATH-388. -------------------------------- Resolution: Fixed fixed in subversion repository as of r919963 Note that ODEWithJacobians & ParameterizedODE classes still don't implement ExtendedFirstOrderDifferentialEquations, they should remain simple at user level, it is the MappingWrapper private class inside FirstOrderIntegratorWithJacobians that implements the extended set of equations. > 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 > > Attachments: math-388.patch > > > 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. |
Free forum by Nabble | Edit this page |