MCPcopy Create free account
hub / github.com/NeuralNetworkVerification/Marabou / restoreState

Method restoreState

src/engine/Tableau.cpp:1719–1778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1717}
1718
1719void Tableau::restoreState( const TableauState &state, TableauStateStorageLevel level )
1720{
1721 if ( level == TableauStateStorageLevel::STORE_BOUNDS_ONLY ||
1722 _lpSolverType != LPSolverType::NATIVE )
1723 {
1724 }
1725 else if ( level == TableauStateStorageLevel::STORE_ENTIRE_TABLEAU_STATE )
1726 {
1727 freeMemoryIfNeeded();
1728
1729 setDimensions( state._m, state._n );
1730
1731 // Restore matrix A
1732 state._A->storeIntoOther( _A );
1733 for ( unsigned i = 0; i < _n; ++i )
1734 state._sparseColumnsOfA[i]->storeIntoOther( _sparseColumnsOfA[i] );
1735 for ( unsigned i = 0; i < _m; ++i )
1736 state._sparseRowsOfA[i]->storeIntoOther( _sparseRowsOfA[i] );
1737 memcpy( _denseA, state._denseA, sizeof( double ) * _m * _n );
1738
1739 // Restore right hand side vector _b
1740 memcpy( _b, state._b, sizeof( double ) * _m );
1741
1742 // Basic variables
1743 _basicVariables = state._basicVariables;
1744
1745 // Restore the assignments
1746 memcpy( _basicAssignment, state._basicAssignment, sizeof( double ) * _m );
1747 memcpy( _nonBasicAssignment, state._nonBasicAssignment, sizeof( double ) * ( _n - _m ) );
1748 _basicAssignmentStatus = state._basicAssignmentStatus;
1749
1750 // Restore the indices
1751 memcpy( _basicIndexToVariable, state._basicIndexToVariable, sizeof( unsigned ) * _m );
1752 memcpy( _nonBasicIndexToVariable,
1753 state._nonBasicIndexToVariable,
1754 sizeof( unsigned ) * ( _n - _m ) );
1755 memcpy( _variableToIndex, state._variableToIndex, sizeof( unsigned ) * _n );
1756
1757 // Restore the basis factorization
1758 _basisFactorization->restoreFactorization( state._basisFactorization );
1759
1760 // Restore the merged variables
1761 _mergedVariables = state._mergedVariables;
1762
1763 computeAssignment();
1764 _costFunctionManager->initialize();
1765 computeCostFunction();
1766
1767 if ( _statistics )
1768 {
1769 _statistics->setUnsignedAttribute( Statistics::CURRENT_TABLEAU_M, _m );
1770 _statistics->setUnsignedAttribute( Statistics::CURRENT_TABLEAU_N, _n );
1771 }
1772 }
1773 else
1774 {
1775 ASSERT( false );
1776 return;

Callers

nothing calls this directly

Calls 4

setUnsignedAttributeMethod · 0.80
storeIntoOtherMethod · 0.45
restoreFactorizationMethod · 0.45
initializeMethod · 0.45

Tested by

no test coverage detected