Skip to content

Commit

Permalink
- added flag: max_iter for ipopt
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@19375 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Vitalij Ruge committed Mar 2, 2014
1 parent 4b04b28 commit 549b7c8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
7 changes: 5 additions & 2 deletions SimulationRuntime/c/optimization/mainOptimizer/ipoptODE.c
Expand Up @@ -300,8 +300,11 @@ static int set_optimizer_flags(IPOPT_DATA_ *iData, IpoptProblem *nlp)
* AddIpoptNumOption(nlp,"derivative_test_perturbation",1e-6);
*
*/

AddIpoptIntOption(*nlp, "max_iter", 5000);
cflags = (char*)omc_flagValue[FLAG_IPOPT_MAX_ITER];
if(cflags)
AddIpoptIntOption(*nlp, "max_iter", atoi(cflags));
else
AddIpoptIntOption(*nlp, "max_iter", 5000);

return 0;
}
Expand Down
12 changes: 8 additions & 4 deletions SimulationRuntime/c/util/simulation_options.c
Expand Up @@ -47,6 +47,7 @@ const char *FLAG_NAME[FLAG_MAX+1] = {
/* FLAG_IPOPT_HESSE*/ "ipopt_hesse",
/* FLAG_IPOPT_JAC*/ "ipopt_jac",
/* FLAG_IPOPT_INIT*/ "ipopt_init",
/* FLAG_IPOPT_MAX_ITER */ "ipopt_max_iter",
/* FLAG_L */ "l",
/* FLAG_LOG_FORMAT */ "logFormat",
/* FLAG_LS */ "ls",
Expand Down Expand Up @@ -83,7 +84,8 @@ const char *FLAG_DESC[FLAG_MAX+1] = {
/* FLAG_IOM */ "value specifies the initialization optimization method",
/* FLAG_IPOPT_HESSE */ "value specifies the hessian for Ipopt",
/* FLAG_IPOPT_JAC */ "value specifies the jacobian for Ipopt",
/* FLAG_IPOPT_INIT */ "value specifies the initial guess for optimization",
/* FLAG_IPOPT_INIT */ "value specifies the initial guess for optimization",
/* FLAG_IPOPT_MAX_ITER */ "value specifies the max number of iteration for ipopt",
/* FLAG_L */ "value specifies a time where the linearization of the model should be performed",
/* FLAG_LOG_FORMAT */ "value specifies the log format of the executable. -logFormat=text (default) or -logFormat=xml",
/* FLAG_LS */ "value specifies the linear solver method",
Expand Down Expand Up @@ -120,7 +122,8 @@ const char *FLAG_DETAILED_DESC[FLAG_MAX+1] = {
/* FLAG_IOM */ "value specifies the initialization optimization method",
/* FLAG_IPOPT_HESSE */ "value specifies the hessematrix for Ipopt(OMC, BFGS, const)",
/* FLAG_IPOPT_JAC */ "value specifies the jacobian for Ipopt(SYM, NUM, NUMDENSE)",
/* FLAG_IPOPT_INIT */ "value specifies the initial guess for optimization (sim, const)",
/* FLAG_IPOPT_INIT */ "value specifies the initial guess for optimization (sim, const)",
/* FLAG_IPOPT_MAX_ITER */ "value specifies the max number of iteration for ipopt",
/* FLAG_L */ "value specifies a time where the linearization of the model should be performed",
/* FLAG_LOG_FORMAT */ "value specifies the log format of the executable. -logFormat=text (default) or -logFormat=xml",
/* FLAG_LS */ "value specifies the linear solver method\n lapack, lis",
Expand All @@ -146,7 +149,7 @@ const int FLAG_TYPE[FLAG_MAX] = {

/* FLAG_CLOCK */ FLAG_TYPE_OPTION,
/* FLAG_CPU */ FLAG_TYPE_FLAG,
/* FLAG_EMIT_PROTECTED */ FLAG_TYPE_FLAG,
/* FLAG_EMIT_PROTECTED */ FLAG_TYPE_FLAG,
/* FLAG_F */ FLAG_TYPE_OPTION,
/* FLAG_HELP */ FLAG_TYPE_OPTION,
/* FLAG_IIF */ FLAG_TYPE_OPTION,
Expand All @@ -156,8 +159,9 @@ const int FLAG_TYPE[FLAG_MAX] = {
/* FLAG_INTERACTIVE */ FLAG_TYPE_FLAG,
/* FLAG_IOM */ FLAG_TYPE_OPTION,
/* FLAG_IPOPT_HESSE */ FLAG_TYPE_OPTION,
/* FLAG_IPOPT_JAC */ FLAG_TYPE_OPTION,
/* FLAG_IPOPT_JAC */ FLAG_TYPE_OPTION,
/* FLAG_IPOPT_INIT */ FLAG_TYPE_OPTION,
/* FLAG_IPOPT_MAX_ITER */ FLAG_TYPE_OPTION,
/* FLAG_L */ FLAG_TYPE_OPTION,
/* FLAG_LOG_FORMAT */ FLAG_TYPE_OPTION,
/* FLAG_LS */ FLAG_TYPE_OPTION,
Expand Down
1 change: 1 addition & 0 deletions SimulationRuntime/c/util/simulation_options.h
Expand Up @@ -54,6 +54,7 @@ enum _FLAG
FLAG_IPOPT_HESSE,
FLAG_IPOPT_JAC,
FLAG_IPOPT_INIT,
FLAG_IPOPT_MAX_ITER,
FLAG_L,
FLAG_LOG_FORMAT,
FLAG_LS,
Expand Down

0 comments on commit 549b7c8

Please sign in to comment.