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

Method mergeColumns

src/engine/Tableau.cpp:2559–2597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2557}
2558
2559void Tableau::mergeColumns( unsigned x1, unsigned x2 )
2560{
2561 ASSERT( !isBasic( x1 ) );
2562 ASSERT( !isBasic( x2 ) );
2563
2564 /*
2565 If x2 has tighter bounds than x1, adjust the bounds
2566 for x1.
2567 */
2568 if ( FloatUtils::lt( getUpperBound( x2 ), getUpperBound( x1 ) ) )
2569 tightenUpperBound( x1, getUpperBound( x2 ) );
2570 if ( FloatUtils::gt( getLowerBound( x2 ), getLowerBound( x1 ) ) )
2571 tightenLowerBound( x1, getLowerBound( x2 ) );
2572
2573 /*
2574 Merge column x2 of the constraint matrix into x1
2575 and zero-out column x2
2576 */
2577 _A->mergeColumns( x1, x2 );
2578 _mergedVariables[x2] = x1;
2579
2580 // Adjust sparse columns and rows, also
2581 _sparseColumnsOfA[x2]->clear();
2582 _A->getColumn( x1, _sparseColumnsOfA[x1] );
2583
2584 for ( unsigned i = 0; i < _m; ++i )
2585 _sparseRowsOfA[i]->mergeEntries( x2, x1 );
2586
2587 // And the dense ones, too
2588 for ( unsigned i = 0; i < _m; ++i )
2589 _denseA[x1 * _m + i] += _denseA[x2 * _m + i];
2590 std::fill_n( _denseA + x2 * _m, _m, 0 );
2591
2592 computeAssignment();
2593 computeCostFunction();
2594
2595 if ( _statistics )
2596 _statistics->incLongAttribute( Statistics::NUM_MERGED_COLUMNS );
2597}
2598
2599bool Tableau::areLinearlyDependent( unsigned x1,
2600 unsigned x2,

Callers 1

Calls 4

incLongAttributeMethod · 0.80
clearMethod · 0.45
getColumnMethod · 0.45
mergeEntriesMethod · 0.45

Tested by

no test coverage detected