Skip to content

Commit

Permalink
- improve max_iter flag for ipopt
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@19387 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Vitalij Ruge committed Mar 3, 2014
1 parent a7a1c4e commit adc729e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions SimulationRuntime/c/optimization/mainOptimizer/ipoptODE.c
Expand Up @@ -308,18 +308,20 @@ static int set_optimizer_flags(IPOPT_DATA_ *iData, IpoptProblem *nlp)
strcpy(buffer,cflags);

while(buffer[i] != '\0'){
if(buffer[i] == 'e')
if(buffer[i] == 'e'){
index_e = i;
break;
}
++i;
}

if(index_e < 0){
AddIpoptIntOption(*nlp, "max_iter", (int) atoi(cflags));
printf("\nmax_iter = %i",atoi(cflags));
}else{
int max_iter = (int) (atoi(cflags)*pow(10.0, (double)atoi(cflags+index_e+1)));
AddIpoptIntOption(*nlp, "max_iter", max_iter);
printf("\nmax_iter = %i",max_iter);
long int max_iter = (atoi(cflags)*pow(10.0, (double)atoi(cflags+index_e+1)));
AddIpoptIntOption(*nlp, "max_iter", (int)max_iter);
printf("\nmax_iter = (int) %i | (double) %g",(int)max_iter, atoi(cflags)*pow(10.0, (double)atoi(cflags+index_e+1)));
}

}else
Expand Down

0 comments on commit adc729e

Please sign in to comment.