Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mapping of meta data for variable bounds #590

Merged
merged 1 commit into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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