jgerstmayr / EXUDYN

Multibody Dynamics Simulation: Rigid and flexible multibody systems
https://www.youtube.com/channel/UCsQD2bIPBXB_4J23WtqKkVw/playlists
Other
166 stars 23 forks source link

Function: Minimize returns error #54

Closed nicolasfourn closed 1 year ago

nicolasfourn commented 1 year ago

Using exudyn version 1.6.164.dev1 python 3.10.11 scipy 1.10.1

Running the file "minimizeExample.py" The function Minimize returns the error:

Traceback (most recent call last):

  File ~\miniconda3\envs\exudyn\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
    exec(code, globals, locals)

  File c:\users\path\exampleminimize.py:165
    [pOpt, vOpt, pList, values] = Minimize(objectiveFunction = ParameterFunction,

  File ~\miniconda3\envs\exudyn\lib\site-packages\exudyn\processing.py:1044 in Minimize
    StoreParameterFunctionValues(optimizeResult['x'])

  File ~\miniconda3\envs\exudyn\lib\site-packages\exudyn\processing.py:977 in StoreParameterFunctionValues
    parameterValueLst[i].append(parametersAtIteration[i])

IndexError: index 0 is out of bounds for axis 0 with size 0

This error does not arise using exudyn version 1.6.0 python 3.10.12 scipy 1.10.1

jgerstmayr commented 1 year ago

There is an internal bug, if initialGuess==[]. if you set initialGuess to any non-empty list e.g. [None], it will not use this value, but will work for now. In the next update (1.6.184), this will work correctly.