| 671 | } |
| 672 | |
| 673 | void InputQuery::adjustInputOutputMapping( const Map<unsigned, unsigned> &oldIndexToNewIndex, |
| 674 | const Map<unsigned, unsigned> &mergedVariables ) |
| 675 | { |
| 676 | Map<unsigned, unsigned> newInputIndexToVariable; |
| 677 | unsigned currentIndex = 0; |
| 678 | |
| 679 | // Input variables |
| 680 | for ( const auto &it : _inputIndexToVariable ) |
| 681 | { |
| 682 | if ( mergedVariables.exists( it.second ) ) |
| 683 | throw MarabouError( |
| 684 | MarabouError::MERGED_INPUT_VARIABLE, |
| 685 | Stringf( "Input variable %u has been merged\n", it.second ).ascii() ); |
| 686 | |
| 687 | if ( oldIndexToNewIndex.exists( it.second ) ) |
| 688 | { |
| 689 | newInputIndexToVariable[currentIndex] = oldIndexToNewIndex[it.second]; |
| 690 | ++currentIndex; |
| 691 | } |
| 692 | } |
| 693 | _inputIndexToVariable = newInputIndexToVariable; |
| 694 | |
| 695 | _variableToInputIndex.clear(); |
| 696 | for ( auto it : _inputIndexToVariable ) |
| 697 | _variableToInputIndex[it.second] = it.first; |
| 698 | |
| 699 | Map<unsigned, unsigned> newOutputIndexToVariable; |
| 700 | currentIndex = 0; |
| 701 | |
| 702 | // Output variables |
| 703 | for ( const auto &it : _outputIndexToVariable ) |
| 704 | { |
| 705 | if ( mergedVariables.exists( it.second ) ) |
| 706 | throw MarabouError( |
| 707 | MarabouError::MERGED_OUTPUT_VARIABLE, |
| 708 | Stringf( "Output variable %u has been merged\n", it.second ).ascii() ); |
| 709 | |
| 710 | if ( oldIndexToNewIndex.exists( it.second ) ) |
| 711 | { |
| 712 | newOutputIndexToVariable[currentIndex] = oldIndexToNewIndex[it.second]; |
| 713 | ++currentIndex; |
| 714 | } |
| 715 | } |
| 716 | _outputIndexToVariable = newOutputIndexToVariable; |
| 717 | |
| 718 | _variableToOutputIndex.clear(); |
| 719 | for ( auto it : _outputIndexToVariable ) |
| 720 | _variableToOutputIndex[it.second] = it.first; |
| 721 | } |
| 722 | |
| 723 | void InputQuery::setNetworkLevelReasoner( NLR::NetworkLevelReasoner *nlr ) |
| 724 | { |
no test coverage detected