Check consistency of model reactions.

    Yield all reactions in the model that are not part of the consistent
    subset.

    Args:
        model: :class:`MetabolicModel` to solve.
        epsilon: Flux threshold value.
        solver: LP solver instance to use.

def fastcc(model, epsilon, solver):
    """Check consistency of model reactions.

    Yield all reactions in the model that are not part of the consistent
    subset.

    Args:
        model: :class:`MetabolicModel` to solve.
        epsilon: Flux threshold value.
        solver: LP solver instance to use.
    """
    reaction_set = set(model.reactions)
    subset = set(reaction_id for reaction_id in reaction_set
                 if model.limits[reaction_id].lower >= 0)

    logger.info('Checking {} irreversible reactions...'.format(len(subset)))
    logger.debug('|J| = {}, J = {}'.format(len(subset), subset))

    p = FastcoreProblem(model, solver, epsilon=epsilon)
    p.lp7(subset)

    consistent_subset = set(
        reaction_id for reaction_id in model.reactions
        if abs(p.get_flux(reaction_id)) >= 0.999 * epsilon)

    logger.debug('|A| = {}, A = {}'.format(
        len(consistent_subset), consistent_subset))

    for reaction in subset - consistent_subset:
        # Inconsistent reaction
        yield reaction

    # Check remaining reactions
    subset = (reaction_set - subset) - consistent_subset

    logger.info('Checking reversible reactions...')
    logger.debug('|J| = {}, J = {}'.format(len(subset), subset))

    flipped = False
    singleton = False
    while len(subset) > 0:
        logger.info('{} reversible reactions left to check...'.format(
            len(subset)))
        if singleton:
            reaction = next(iter(subset))
            subset_i = {reaction}

            logger.debug('LP3 on {}'.format(subset_i))
            p.maximize({reaction: -1 if p.is_flipped(reaction) else 1})
        else:
            subset_i = subset

            logger.debug('LP7 on {}'.format(subset_i))
            p.lp7(subset_i)

        consistent_subset.update(
            reaction_id for reaction_id in subset
            if abs(p.get_flux(reaction_id) >= 0.999 * epsilon))

        logger.debug('|A| = {}, A = {}'.format(
            len(consistent_subset), consistent_subset))

        if not subset.isdisjoint(consistent_subset):
            subset -= consistent_subset
            logger.debug('|J| = {}, J = {}'.format(len(subset), subset))
            flipped = False
        else:
            # TODO: irreversible reactions are taken care of before the
            # loop so at this point all reactions in subset_i are reversble(?).
            subset_rev_i = subset_i & model.reversible
            if flipped or len(subset_rev_i) == 0:
                flipped = False
                if singleton:
                    subset -= subset_rev_i
                    for reaction in subset_rev_i:
                        logger.info('Inconsistent: {}'.format(reaction))
                        yield reaction
                else:
                    singleton = True
            else:
                p.flip(subset_rev_i)
                flipped = True
                logger.info('Flipped {} reactions'.format(len(subset_rev_i)))