ortools/sat/integer_search.cc
std::function<LiteralIndex()> FirstUnassignedVarAtItsMinHeuristic(
    const std::vector<IntegerVariable>& vars, Model* model) {
  return [/*copy*/ vars, model]() {
    IntegerTrail* const integer_trail = model->GetOrCreate<IntegerTrail>();
    for (const IntegerVariable var : vars) {
      // Note that there is no point trying to fix a currently ignored variable.
      if (integer_trail->IsCurrentlyIgnored(var)) continue;
      const LiteralIndex decision = AtMinValue(var, model);
      if (decision != kNoLiteralIndex) return decision;
    }
    return kNoLiteralIndex;
  };
}
// TODO(user): the complexity caused by the linear scan in this heuristic and
// the one below is ok when search_branching is set to SAT_SEARCH because it is
// not executed often, but otherwise it is done for each search decision,
// which seems expensive. Improve.
the complexity caused by the linear scan in this heuristic and
the one below is ok when search_branching is set to SAT_SEARCH because it is
not executed often, but otherwise it is done for each search decision,
which seems expensive. Improve.
the complexity caused by the linear scan in this heuristic and the one below is ok when search_branching is set to SAT_SEARCH because it is not executed often but otherwise it is done for each search decision which seems expensive . Improve .
std::function<LiteralIndex()> FirstUnassignedVarAtItsMinHeuristic(
    const std::vector<IntegerVariable>& vars, Model* model) {
  return [ vars, model]() {
    IntegerTrail* const integer_trail = model->GetOrCreate<IntegerTrail>();
    for (const IntegerVariable var : vars) {
      if (integer_trail->IsCurrentlyIgnored(var)) continue;
      const LiteralIndex decision = AtMinValue(var, model);
      if (decision != kNoLiteralIndex) return decision;
    }
    return kNoLiteralIndex;
  };
}
std :: function < LiteralIndex ( ) > FirstUnassignedVarAtItsMinHeuristic ( const std :: vector < IntegerVariable > & vars , Model * model ) { return [ vars , model ] ( ) { IntegerTrail * const integer_trail = model -> GetOrCreate < IntegerTrail > ( ) ; for ( const IntegerVariable var : vars ) { if ( integer_trail -> IsCurrentlyIgnored ( var ) ) continue ; const LiteralIndex decision = AtMinValue ( var , model ) ; if ( decision != kNoLiteralIndex ) return decision ; } return kNoLiteralIndex ; } ; }
TODO(user): the complexity caused by the linear scan in this heuristic and
the one below is ok when search_branching is set to SAT_SEARCH because it is
not executed often, but otherwise it is done for each search decision,
which seems expensive.
TODO ( user ) : the complexity caused by the linear scan in this heuristic and the one below is ok when search_branching is set to SAT_SEARCH because it is not executed often but otherwise it is done for each search decision which seems expensive .
/*copy*/ // Note that there is no point trying to fix a currently ignored variable.