Skip to content

Commit

Permalink
fix numerical hessian structure for dyn. optimization without nonline…
Browse files Browse the repository at this point in the history
…ar constraints

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24011 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Vitalij Ruge committed Jan 12, 2015
1 parent 33e60d6 commit fb8f8ed
Showing 1 changed file with 36 additions and 17 deletions.
53 changes: 36 additions & 17 deletions SimulationRuntime/c/optimization/DataManagement/DerStructure.c
Expand Up @@ -490,8 +490,9 @@ static inline void local_hessian_struct(DATA * data, OptDataDim * dim, OptDataSt
if(s->lagrange){
for(i = 0; i< nv; ++i){
for(j = 0; j <nv; ++j){
if(s->gradL[i]*s->gradL[j])
if(s->gradL[i]*s->gradL[j]){
Hl[i][j] = (modelica_boolean)1;
}
}
}
}
Expand All @@ -509,24 +510,42 @@ static inline void local_hessian_struct(DATA * data, OptDataDim * dim, OptDataSt
/***********************************/
for(i = 0; i< nv; ++i){
for(j = 0; j <nv; ++j){
for(l = 0; l <nJ; ++l){
tmp = Hg[l][i][j] || Hl[i][j];
if(tmp && !H0[i][j]){
H0[i][j] = (modelica_boolean)1;
++dim->nH0;
if(i <= j)
++dim->nH0_;
}
if((tmp || Hm[i][j]) && !H1[i][j]){
H1[i][j] = (modelica_boolean)1;
++dim->nH1;
if(i <= j)
++dim->nH1_;
if(nJ>0){
for(l = 0; l <nJ; ++l){
tmp = Hg[l][i][j] || Hl[i][j];
if(tmp && !H0[i][j]){
H0[i][j] = (modelica_boolean)1;
++dim->nH0;
if(i <= j)
++dim->nH0_;
}
if((tmp || Hm[i][j]) && !H1[i][j]){
H1[i][j] = (modelica_boolean)1;
++dim->nH1;
if(i <= j)
++dim->nH1_;
}
if(H0[i][j] && H1[i][j])
break;
}
if(H0[i][j] && H1[i][j])
break;
}
}else{
tmp = Hl[i][j];
if(tmp && !H0[i][j]){
H0[i][j] = (modelica_boolean)1;
++dim->nH0;
if(i <= j)
++dim->nH0_;
}
if((tmp || Hm[i][j]) && !H1[i][j]){
H1[i][j] = (modelica_boolean)1;
++dim->nH1;
if(i <= j)
++dim->nH1_;
}
if(H0[i][j] && H1[i][j])
break;
}
}
}

/*******************************/
Expand Down

0 comments on commit fb8f8ed

Please sign in to comment.