| 3007 | } |
| 3008 | |
| 3009 | bool Engine::performDeepSoILocalSearch() |
| 3010 | { |
| 3011 | ENGINE_LOG( "Performing local search..." ); |
| 3012 | struct timespec start = TimeUtils::sampleMicro(); |
| 3013 | ASSERT( allVarsWithinBounds() ); |
| 3014 | |
| 3015 | // All the linear constraints have been satisfied at this point. |
| 3016 | // Update the cost function |
| 3017 | _soiManager->initializePhasePattern(); |
| 3018 | |
| 3019 | LinearExpression initialPhasePattern = _soiManager->getCurrentSoIPhasePattern(); |
| 3020 | |
| 3021 | if ( initialPhasePattern.isZero() ) |
| 3022 | { |
| 3023 | if ( hasBranchingCandidate() ) |
| 3024 | while ( !_smtCore.needToSplit() ) |
| 3025 | _smtCore.reportRejectedPhasePatternProposal(); |
| 3026 | return false; |
| 3027 | } |
| 3028 | |
| 3029 | minimizeHeuristicCost( initialPhasePattern ); |
| 3030 | ASSERT( allVarsWithinBounds() ); |
| 3031 | _soiManager->updateCurrentPhasePatternForSatisfiedPLConstraints(); |
| 3032 | // Always accept the first phase pattern. |
| 3033 | _soiManager->acceptCurrentPhasePattern(); |
| 3034 | double costOfLastAcceptedPhasePattern = |
| 3035 | computeHeuristicCost( _soiManager->getCurrentSoIPhasePattern() ); |
| 3036 | |
| 3037 | double costOfProposedPhasePattern = FloatUtils::infinity(); |
| 3038 | bool lastProposalAccepted = true; |
| 3039 | while ( !_smtCore.needToSplit() ) |
| 3040 | { |
| 3041 | struct timespec end = TimeUtils::sampleMicro(); |
| 3042 | _statistics.incLongAttribute( Statistics::TOTAL_TIME_LOCAL_SEARCH_MICRO, |
| 3043 | TimeUtils::timePassed( start, end ) ); |
| 3044 | start = end; |
| 3045 | |
| 3046 | if ( lastProposalAccepted ) |
| 3047 | { |
| 3048 | /* |
| 3049 | Check whether the optimal solution to the last accepted phase |
| 3050 | is a real solution. We only check this when the last proposal |
| 3051 | was accepted, because rejected phase pattern must have resulted in |
| 3052 | increase in the SoI cost. |
| 3053 | |
| 3054 | HW: Another option is to only do this check when |
| 3055 | costOfLastAcceptedPhasePattern is 0, but this might be too strict. |
| 3056 | The overhead is low anyway. |
| 3057 | */ |
| 3058 | collectViolatedPlConstraints(); |
| 3059 | if ( allPlConstraintsHold() ) |
| 3060 | { |
| 3061 | if ( _lpSolverType == LPSolverType::NATIVE && |
| 3062 | _tableau->getBasicAssignmentStatus() != |
| 3063 | ITableau::BASIC_ASSIGNMENT_JUST_COMPUTED ) |
| 3064 | { |
| 3065 | if ( _verbosity > 0 ) |
| 3066 | { |
nothing calls this directly
no test coverage detected