| 19 | #include "MarabouError.h" |
| 20 | |
| 21 | bool BlandsRule::select( ITableau &tableau, |
| 22 | const List<unsigned> &candidates, |
| 23 | const Set<unsigned> &excluded ) |
| 24 | { |
| 25 | List<unsigned> remainingCandidates = candidates; |
| 26 | |
| 27 | List<unsigned>::iterator it = remainingCandidates.begin(); |
| 28 | while ( it != remainingCandidates.end() ) |
| 29 | { |
| 30 | if ( excluded.exists( *it ) ) |
| 31 | it = remainingCandidates.erase( it ); |
| 32 | else |
| 33 | ++it; |
| 34 | } |
| 35 | |
| 36 | if ( remainingCandidates.empty() ) |
| 37 | return false; |
| 38 | |
| 39 | it = remainingCandidates.begin(); |
| 40 | unsigned minIndex = *it; |
| 41 | unsigned minVariable = tableau.nonBasicIndexToVariable( minIndex ); |
| 42 | |
| 43 | ++it; |
| 44 | unsigned variable; |
| 45 | while ( it != remainingCandidates.end() ) |
| 46 | { |
| 47 | variable = tableau.nonBasicIndexToVariable( *it ); |
| 48 | if ( variable < minVariable ) |
| 49 | { |
| 50 | minIndex = *it; |
| 51 | minVariable = variable; |
| 52 | } |
| 53 | |
| 54 | ++it; |
| 55 | } |
| 56 | |
| 57 | tableau.setEnteringVariableIndex( minIndex ); |
| 58 | return true; |
| 59 | } |
| 60 | |
| 61 | // |
| 62 | // Local Variables: |
no test coverage detected