Skip to content

Commit

Permalink
- update optimiziation tests
Browse files Browse the repository at this point in the history
 - compare results (used mumps)
 - delete removeAliasOpt (alias variable case is now in BatchRactor)
- added flag "ls_ipopt": switch linear solver for ipopt
 - possible that configure must be changed (e.g. -lcoinhsl)
  


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17190 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Vitalij Ruge committed Sep 11, 2013
1 parent 092831b commit 6a8337a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
34 changes: 27 additions & 7 deletions SimulationRuntime/c/optimization/mainOptimizer/ipoptODE.c
Expand Up @@ -42,6 +42,7 @@
#include "../OptimizationFlags.h"
#include "../localFunction.h"
#include "../../simulation/results/simulation_result.h"
#include "../../simulation/options.h"

#ifdef WITH_IPOPT

Expand All @@ -59,6 +60,8 @@ int startIpopt(DATA* data, SOLVER_INFO* solverInfo, int flag)
int j,k,l;
double obj;
int res;
char *cflags;

IpoptProblem nlp = NULL;
IPOPT_DATA_ *iData = ((IPOPT_DATA_*)solverInfo->solverData);
iData->current_var = 0;
Expand All @@ -76,9 +79,13 @@ int startIpopt(DATA* data, SOLVER_INFO* solverInfo, int flag)
*/

loadDAEmodel(data, iData);
iData->index_debug_iter=0;
iData->degub_step = 10;
iData->index_debug_next=0;
iData->index_debug_iter=0;
iData->degub_step = 10;
iData->index_debug_next=0;

cflags = omc_flagValue[FLAG_LS_IPOPT];
if(!cflags)
cflags = "mumps";

/*ToDo*/
for(i=0; i<(*iData).nx; i++)
Expand Down Expand Up @@ -109,17 +116,30 @@ int startIpopt(DATA* data, SOLVER_INFO* solverInfo, int flag)

AddIpoptNumOption(nlp, "tol", iData->data->simulationInfo.tolerance);

if(ACTIVE_STREAM(LOG_IPOPT)){
if(ACTIVE_STREAM(LOG_IPOPT))
{
AddIpoptIntOption(nlp, "print_level", 5);
AddIpoptIntOption(nlp, "file_print_level", 5);
AddIpoptIntOption(nlp, "file_print_level", 0);
}
else{
AddIpoptIntOption(nlp, "print_level", 0);
else if(ACTIVE_STREAM(LOG_STATS))
{
AddIpoptIntOption(nlp, "print_level", 3);
AddIpoptIntOption(nlp, "file_print_level", 0);
}
else
{
AddIpoptIntOption(nlp, "print_level", 2);
AddIpoptIntOption(nlp, "file_print_level", 0);
}

AddIpoptStrOption(nlp, "mu_strategy", "adaptive");
AddIpoptStrOption(nlp, "hessian_approximation", "limited-memory");

if(cflags)
AddIpoptStrOption(nlp, "linear_solver", cflags);
else
AddIpoptStrOption(nlp, "linear_solver", "mumps");

/* AddIpoptStrOption(nlp, "derivative_test", "second-order"); */
/* AddIpoptStrOption(nlp, "derivative_test_print_all", "yes"); */
/* AddIpoptNumOption(nlp,"derivative_test_perturbation",1e-6); */
Expand Down
6 changes: 5 additions & 1 deletion SimulationRuntime/c/util/simulation_options.c
Expand Up @@ -45,6 +45,7 @@ const char *FLAG_NAME[FLAG_MAX+1] = {
/* FLAG_IOM */ "iom",
/* FLAG_L */ "l",
/* FLAG_LS */ "ls",
/* FLAG_LS_IPOPT */ "ls_ipopt",
/* FLAG_LV */ "lv",
/* FLAG_MEASURETIMEPLOTFORMAT */ "measureTimePlotFormat",
/* FLAG_NLS */ "nls",
Expand Down Expand Up @@ -75,6 +76,7 @@ const char *FLAG_DESC[FLAG_MAX+1] = {
/* FLAG_IOM */ "value specifies the initialization optimization method",
/* FLAG_L */ "value specifies a time where the linearization of the model should be performed",
/* FLAG_LS */ "value specifies the linear solver method",
/* FLAG_LS_IPOPT */ "value specifies the linear solver method for ipopt",
/* FLAG_LV */ "[string list] value specifies the logging level",
/* FLAG_MEASURETIMEPLOTFORMAT */ "value specifies the output format of the measure time functionality",
/* FLAG_NLS */ "value specifies the nonlinear solver",
Expand Down Expand Up @@ -104,7 +106,8 @@ const char *FLAG_DETAILED_DESC[FLAG_MAX+1] = {
/* FLAG_INTERACTIVE */ "specify interactive simulation",
/* FLAG_IOM */ "value specifies the initialization optimization method",
/* FLAG_L */ "value specifies a time where the linearization of the model should be performed",
/* FLAG_LS */ "value specifies the linear solver method\n lapack",
/* FLAG_LS */ "value specifies the linear solver method\n lapack, lis",
/* FLAG_LS_IPOPT */ "value specifies the linear solver method for Ipopt, default mumps.\n Note: Use if you build ipopt with other linear solver like ma27",
/* FLAG_LV */ "value specifies the logging level",
/* FLAG_MEASURETIMEPLOTFORMAT */ "value specifies the output format of the measure time functionality\n svg\n jpg\n ps\n gif\n ...",
/* FLAG_NLS */ "value specifies the nonlinear solver",
Expand Down Expand Up @@ -135,6 +138,7 @@ const int FLAG_TYPE[FLAG_MAX] = {
/* FLAG_IOM */ FLAG_TYPE_OPTION,
/* FLAG_L */ FLAG_TYPE_OPTION,
/* FLAG_LS */ FLAG_TYPE_OPTION,
/* FLAG_LS_IPOPT */ FLAG_TYPE_OPTION,
/* FLAG_LV */ FLAG_TYPE_OPTION,
/* FLAG_MEASURETIMEPLOTFORMAT */ FLAG_TYPE_OPTION,
/* FLAG_NLS */ FLAG_TYPE_OPTION,
Expand Down
1 change: 1 addition & 0 deletions SimulationRuntime/c/util/simulation_options.h
Expand Up @@ -52,6 +52,7 @@ enum _FLAG
FLAG_IOM,
FLAG_L,
FLAG_LS,
FLAG_LS_IPOPT,
FLAG_LV,
FLAG_MEASURETIMEPLOTFORMAT,
FLAG_NLS,
Expand Down

0 comments on commit 6a8337a

Please sign in to comment.