Menu

#29 Several optimization tutorials fail to run

v1.0_(example)
open
nobody
1
2019-08-07
2019-07-30
Manuel
No

While trying to setup my own parameter estimation, I had a look at several tutorials in DAE Tools 1.9.0 and found them not to execute (on Windows; they seem to work though on Debian GNU/Linux).

python opt_tutorial5.py
Creating the system...
The system created successfully.
Traceback (most recent call last):
  File "opt_tutorial5.py", line 222, in <module>
    run()
  File "opt_tutorial5.py", line 161, in run
    simulation.SolveInitial()
RuntimeError: Miscellanous exception in function: dae::solver::daeIDASolver::SolveInitial, source file: .\ida_solver.cpp, line: 813
Sundials IDAS solver cowardly failed to calculate initial conditions at TIME = 0; IDA_NO_RECOVERY
IDAS solver error in module 'IDAS' in function 'IDACalcIC': The residual routine or the linear setup or solve routine had a recoverable error, but IDACalcIC was unable to recover. [IDA_NO_RECOVERY]

Another example:

$ python tutorial_che_opt_2.py
Creating the system... 
The system created successfully.
    Starting the run No. 1 ...

Exception occurred: Miscellanous exception in function: dae::solver::daeIDASolver::SolveInitial, source file: .\ida_solver.cpp, line: 813
Sundials IDAS solver cowardly failed to calculate initial conditions at TIME = 0; IDA_LSETUP_FAIL
IDAS solver error in module 'IDAS' in function 'IDACalcIC': The linear solver setup failed unrecoverably. [IDA_LSETUP_FAIL]

                        Optimization failed: Algorithm received an invalid number (such as NaN or Inf) from the NLP; see also option check derivatives for naninf.

I use Python 3.6 on Windows 10 64bit (Python version on Debian 9 is 3.5).
Any hint?

Discussion

  • ciroki

    ciroki - 2019-07-30

    Hi Manuel,

    I noticed that too. I am not sure why it happens, but it is daetools related (not python or os). I'll check what is going on and let you know. What you can do is set printInfo to true in daetools.cfg (or programmatically using daeGetConfig function) for both daetols.core and daetools.IDAS and see if there are some strange numbers, infinity or not a number values.
    Dragan

     
    • Manuel

      Manuel - 2019-08-01

      Done. I set

      # Overwriting Core/Activity/IDAS parameters
          cfg = daeGetConfig()
          cfg.SetBoolean("daetools.core.printInfo", True)
          cfg.SetBoolean("daetools.IDAS.printInfo", True)
      

      in run(**kwargs) function.

      This is the output I get. On Windows:

       Creating the system...
            RAM =     0 MB (peak RAM =     0 MB, virtRAM =     0 MB, peak virtRAM =     0 MB)
        Initializing the simulation...
          InitializeStage1
            RAM =     0 MB (peak RAM =     0 MB, virtRAM =     0 MB, peak virtRAM =     0 MB)
          SetUpParametersAndDomains
            RAM =     0 MB (peak RAM =     0 MB, virtRAM =     0 MB, peak virtRAM =     0 MB)
          Setup optimization/sensitivity analysis
          InitializeStage2
            RAM =     0 MB (peak RAM =     0 MB, virtRAM =     0 MB, peak virtRAM =     0 MB)
          InitializeStage3
            RAM =     0 MB (peak RAM =     0 MB, virtRAM =     0 MB, peak virtRAM =     0 MB)
          SetUpVariables
            RAM =     0 MB (peak RAM =     0 MB, virtRAM =     0 MB, peak virtRAM =     0 MB)
          InitializeStage4
            RAM =     0 MB (peak RAM =     0 MB, virtRAM =     0 MB, peak virtRAM =     0 MB)
          CheckSystem
            RAM =     0 MB (peak RAM =     0 MB, virtRAM =     0 MB, peak virtRAM =     0 MB)
          InitializeStage5
            RAM =     0 MB (peak RAM =     0 MB, virtRAM =     0 MB, peak virtRAM =     0 MB)
          DoDataPartitioning
            RAM =     0 MB (peak RAM =     0 MB, virtRAM =     0 MB, peak virtRAM =     0 MB)
          InitializeStage6
            RAM =     0 MB (peak RAM =     0 MB, virtRAM =     0 MB, peak virtRAM =     0 MB)
          Setup DAE Solver
            RAM =     0 MB (peak RAM =     0 MB, virtRAM =     0 MB, peak virtRAM =     0 MB)
          Collect variables to report
            RAM =     0 MB (peak RAM =     0 MB, virtRAM =     0 MB, peak virtRAM =     0 MB)
      The system created successfully.
          Trying to solve the system initially
      Calculate residuals at time 0.000000000000000...
      Calculate sensitivity residuals at time 0.000000000000000...
      Calculate Jacobian at time 0.000000000000000...
      Calculate residuals at time 0.000000000000000...
      Calculate sensitivity residuals at time 0.000000000000000...
      Calculate Jacobian at time 0.000000000000000...
      Calculate residuals at time 0.000000000000000...
      Calculate sensitivity residuals at time 0.000000000000000...
      Calculate Jacobian at time 0.000000000000000...
      Calculate residuals at time 0.000000000000000...
      Calculate sensitivity residuals at time 0.000000000000000...
      Calculate Jacobian at time 0.000000000000000...
      Calculate residuals at time 0.000000000000000...
      Calculate sensitivity residuals at time 0.000000000000000...
      Calculate Jacobian at time 0.000000000000000...
      Traceback (most recent call last):
        File "opt_tutorial5.py", line 226, in <module>
          run()
        File "opt_tutorial5.py", line 165, in run
          simulation.SolveInitial()
      RuntimeError: Miscellanous exception in function: dae::solver::daeIDASolver::SolveInitial, source file: .\ida_solver.cpp, line: 813
      Sundials IDAS solver cowardly failed to calculate initial conditions at TIME = 0; IDA_NO_RECOVERY
      IDAS solver error in module 'IDAS' in function 'IDACalcIC': The residual routine or the linear setup or solve routine had a recoverable error, but IDACalcIC was unable to recover. [IDA_NO_RECOVERY]
      

      On Debian GNU/Linux:

      Creating the system...
            RAM =   108 MB (peak RAM =   108 MB, virtRAM =  2588 MB, peak virtRAM =  3002 MB)
        Initializing the simulation...
          InitializeStage1
            RAM =   108 MB (peak RAM =   108 MB, virtRAM =  2588 MB, peak virtRAM =  3002 MB)
          SetUpParametersAndDomains
            RAM =   108 MB (peak RAM =   108 MB, virtRAM =  2588 MB, peak virtRAM =  3002 MB)
          Setup optimization/sensitivity analysis
          InitializeStage2
            RAM =   108 MB (peak RAM =   108 MB, virtRAM =  2588 MB, peak virtRAM =  3002 MB)
          InitializeStage3
            RAM =   108 MB (peak RAM =   108 MB, virtRAM =  2588 MB, peak virtRAM =  3002 MB)
          SetUpVariables
            RAM =   108 MB (peak RAM =   108 MB, virtRAM =  2588 MB, peak virtRAM =  3002 MB)
          InitializeStage4
            RAM =   109 MB (peak RAM =   109 MB, virtRAM =  2588 MB, peak virtRAM =  3002 MB)
          CheckSystem
            RAM =   109 MB (peak RAM =   109 MB, virtRAM =  2588 MB, peak virtRAM =  3002 MB)
          InitializeStage5
            RAM =   109 MB (peak RAM =   109 MB, virtRAM =  2588 MB, peak virtRAM =  3002 MB)
          DoDataPartitioning
            RAM =   109 MB (peak RAM =   109 MB, virtRAM =  2588 MB, peak virtRAM =  3002 MB)
          InitializeStage6
            RAM =   109 MB (peak RAM =   109 MB, virtRAM =  2588 MB, peak virtRAM =  3002 MB)
          Setup DAE Solver
            RAM =   109 MB (peak RAM =   109 MB, virtRAM =  2588 MB, peak virtRAM =  3002 MB)
          Collect variables to report
            RAM =   109 MB (peak RAM =   109 MB, virtRAM =  2588 MB, peak virtRAM =  3002 MB)
      The system created successfully.
          Trying to solve the system initially
      Calculate residuals at time 0.000000000000000...
      Calculate sensitivity residuals at time 0.000000000000000...
      Calculate Jacobian at time 0.000000000000000...
      Calculate residuals at time 0.000000000000000...
      Calculate sensitivity residuals at time 0.000000000000000...
      Calculate residuals at time 0.000000000000000...
      Calculate sensitivity residuals at time 0.000000000000000...
      Calculate Jacobian at time 0.000000000000000...
      Calculate residuals at time 0.000000000100000...
      Calculate sensitivity residuals at time 0.000000000100000...
      Calculate Jacobian at time 0.000000000100000...
          Report data at the initial time
            RAM =   110 MB (peak RAM =   110 MB, virtRAM =  3072 MB, peak virtRAM =  3072 MB)
      Starting the initialization of the system... Done.
      

      But I do not see any

      strange numbers, infinity or not a number values.

       
  • ciroki

    ciroki - 2019-08-07

    Yes, thanks. Hoewver, I do not see the values of variables, residuals and sensitivity residuals printed. Could you set these options not in the run function but before a call to it, i.e.

    if __name__ == "__main__":    
        cfg = daeGetConfig()
        cfg.SetBoolean("daetools.core.printInfo", True)
        cfg.SetBoolean("daetools.IDAS.printInfo", True)
    
        ...
        run()
    

    because some options are collected from the options file at the very beginning.

    Dragan

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB