Find a sparse mode containing reactions of the core subset.

        Return an iterator of the support of a sparse mode that contains as
        many reactions from core as possible, and as few reactions from
        additional as possible (approximately). A dictionary of weights can be
        supplied which gives further penalties for including specific
        additional reactions.

def find_sparse_mode(self, core, additional, scaling, weights={}):
        """Find a sparse mode containing reactions of the core subset.

        Return an iterator of the support of a sparse mode that contains as
        many reactions from core as possible, and as few reactions from
        additional as possible (approximately). A dictionary of weights can be
        supplied which gives further penalties for including specific
        additional reactions.
        """

        if len(core) == 0:
            return

        self.lp7(core)
        k = set()
        for reaction_id in core:
            flux = self.get_flux(reaction_id)
            if self.is_flipped(reaction_id):
                flux *= -1
            if flux >= self._epsilon:
                k.add(reaction_id)

        if len(k) == 0:
            return

        self.lp10(k, additional, weights)
        for reaction_id in self._model.reactions:
            flux = self.get_flux(reaction_id)
            if abs(flux) >= self._epsilon / scaling:
                yield reaction_id