bool PreferredLocationSubspace::PromoteSecondary(TempSolution const& tempSolution, PartitionEntry const* partition, NodeSet & candidateNodes) const
{
    if (partition == nullptr || partition->Service->OnEveryNode)
    {
        return false;
    }

    set<Common::TreeNodeIndex> const& upgradedUDs = PreferredLocationConstraint::GetUpgradedUDs(tempSolution, partition);
    if (!upgradedUDs.empty())
    {
        NodeSet nodesUpgradedUDs(candidateNodes);
        nodesUpgradedUDs.Filter([&](NodeEntry const *node) -> bool
        {
            return PreferredLocationConstraint::CheckUpgradedUDs(upgradedUDs, node);
        });

        if (!nodesUpgradedUDs.IsEmpty)
        {
            // Use the intersection of preferred location and upgradedUDs;
            // If empty, do nothing since candidateNodes already include the preferred location
            candidateNodes.Copy(nodesUpgradedUDs);
        }
    }

    return false;
}