paulflang / SBML2Julia

A tool to for optimizing parameters of ordinary differential equation (ODE) models. SBML2Julia translates a model from SBML/PEtab format into Julia for Mathematical Programming (JuMP), performs the optimization task and returns the results.
https://sbml2julia.readthedocs.io/en/latest/
MIT License
5 stars 1 forks source link

Invalid number in NLP function or derivative detected #6

Closed paulflang closed 4 years ago

paulflang commented 4 years ago

I am just trying the petab_test_suite cases and ran into a problem with case 0014. @sshin23 : could you please download case 0014 and have a look what's wrong with this code: 20200720_petab_test_suite_0014_problem.txt

The output I get is:

This is Ipopt version 3.12.10, running with linear solver mumps.
NOTE: Other linear solvers might be more efficient (see Ipopt documentation).

Number of nonzeros in equality constraint Jacobian...:      248
Number of nonzeros in inequality constraint Jacobian.:        0
Number of nonzeros in Lagrangian Hessian.............:      169

Total number of variables............................:       86
                     variables with only lower bounds:        0
                variables with lower and upper bounds:       84
                     variables with only upper bounds:        0
Total number of equality constraints.................:       86
Total number of inequality constraints...............:        0
        inequality constraints with only lower bounds:        0
   inequality constraints with lower and upper bounds:        0
        inequality constraints with only upper bounds:        0

Number of Iterations....: 0

Number of objective function evaluations             = 0
Number of objective gradient evaluations             = 1
Number of equality constraint evaluations            = 1
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 0
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 0
Total CPU secs in IPOPT (w/o function evaluations)   =      0.006
Total CPU secs in NLP function evaluations           =      0.000

EXIT: Invalid number in NLP function or derivative detected.

Thanks!

sshin23 commented 4 years ago

Adding the starting values will fix the problem:

@variable(m, noiseParameter1_obs_a[j in 1:1],start = 1.)
@variable(m, noiseParameter2_obs_a[j in 1:1],start = 1.)

Jump sets the starting point to be zero if the starting value is not explicitly given. With zero starting points, your objective function tries to divide by zero, and this causes an error.

paulflang commented 4 years ago

Thanks. Makes a lot of sense and did the trick. I just got the same error elsewhere and am currently trying to figure out where it originated.