Skip to content

Commit

Permalink
fix mapping of meta data for variable bounds
Browse files Browse the repository at this point in the history
- mapping from full x to x without fixed vars was not taken into account
  • Loading branch information
svigerske committed Jul 21, 2022
1 parent 3598ca5 commit 278d295
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 12 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ More detailed information about incremental changes can be found in the

## 3.14

### 3.14.9 (2022-07-21)

- Fixed mapping of meta data for variable bounds, e.g., variable names,
from TNLP to Ipopts internal NLP [#590].

### 3.14.8 (2022-07-13)

- Added options ma27_print_level, ma57_print_level, and mumps_print_level
Expand Down
66 changes: 54 additions & 12 deletions src/Interfaces/IpTNLPAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,19 +751,33 @@ bool TNLPAdapter::GetSpaces(

string_md.clear();
string_md.resize(n_x_l);
pos_idx = P_x_x_L_space_->ExpandedPosIndices();
const Index* pos_idxL = P_x_x_L_space_->ExpandedPosIndices();
for( Index i = 0; i < n_x_l; i++ )
{
string_md[i] = iter->second[pos_idx[i]];
if( pos_idx != NULL )
{
string_md[i] = iter->second[pos_idx[pos_idxL[i]]];
}
else
{
string_md[i] = iter->second[pos_idxL[i]];
}
}
dv_x_l_space->SetStringMetaData(iter->first, string_md);

string_md.clear();
string_md.resize(n_x_u);
pos_idx = P_x_x_U_space_->ExpandedPosIndices();
const Index* pos_idxU = P_x_x_U_space_->ExpandedPosIndices();
for( Index i = 0; i < n_x_u; i++ )
{
string_md[i] = iter->second[pos_idx[i]];
if( pos_idx != NULL )
{
string_md[i] = iter->second[pos_idx[pos_idxU[i]]];
}
else
{
string_md[i] = iter->second[pos_idxU[i]];
}
}
dv_x_u_space->SetStringMetaData(iter->first, string_md);
}
Expand Down Expand Up @@ -794,19 +808,33 @@ bool TNLPAdapter::GetSpaces(

integer_md.clear();
integer_md.resize(n_x_l);
pos_idx = P_x_x_L_space_->ExpandedPosIndices();
const Index* pos_idxL = P_x_x_L_space_->ExpandedPosIndices();
for( Index i = 0; i < n_x_l; i++ )
{
integer_md[i] = iter->second[pos_idx[i]];
if( pos_idx != NULL )
{
integer_md[i] = iter->second[pos_idx[pos_idxL[i]]];
}
else
{
integer_md[i] = iter->second[pos_idxL[i]];
}
}
dv_x_l_space->SetIntegerMetaData(iter->first, integer_md);

integer_md.clear();
integer_md.resize(n_x_u);
pos_idx = P_x_x_U_space_->ExpandedPosIndices();
const Index* pos_idxU = P_x_x_U_space_->ExpandedPosIndices();
for( Index i = 0; i < n_x_u; i++ )
{
integer_md[i] = iter->second[pos_idx[i]];
if( pos_idx != NULL )
{
integer_md[i] = iter->second[pos_idx[pos_idxU[i]]];
}
else
{
integer_md[i] = iter->second[pos_idxU[i]];
}
}
dv_x_u_space->SetIntegerMetaData(iter->first, integer_md);
}
Expand Down Expand Up @@ -837,19 +865,33 @@ bool TNLPAdapter::GetSpaces(

numeric_md.clear();
numeric_md.resize(n_x_l);
pos_idx = P_x_x_L_space_->ExpandedPosIndices();
const Index* pos_idxL = P_x_x_L_space_->ExpandedPosIndices();
for( Index i = 0; i < n_x_l; i++ )
{
numeric_md[i] = iter->second[pos_idx[i]];
if( pos_idx != NULL )
{
numeric_md[i] = iter->second[pos_idx[pos_idxL[i]]];
}
else
{
numeric_md[i] = iter->second[pos_idxL[i]];
}
}
dv_x_l_space->SetNumericMetaData(iter->first, numeric_md);

numeric_md.clear();
numeric_md.resize(n_x_u);
pos_idx = P_x_x_U_space_->ExpandedPosIndices();
const Index* pos_idxU = P_x_x_U_space_->ExpandedPosIndices();
for( Index i = 0; i < n_x_u; i++ )
{
numeric_md[i] = iter->second[pos_idx[i]];
if( pos_idx != NULL )
{
numeric_md[i] = iter->second[pos_idx[pos_idxU[i]]];
}
else
{
numeric_md[i] = iter->second[pos_idxU[i]];
}
}
dv_x_u_space->SetNumericMetaData(iter->first, numeric_md);
}
Expand Down

0 comments on commit 278d295

Please sign in to comment.