Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I view the source code for a specific algorithm in Multicut? #94

Open
liuyx599 opened this issue Mar 16, 2024 · 1 comment
Open

Comments

@liuyx599
Copy link

Hello, as an example, the specific function of multicut_kernighan_lin, which I learned and tried to run in pycharm. I'd like to see the source code of its specific algorithm (intuition tells me it's probably a CPP source), but I can't get further into the source code by clicking on kernighanLinFactory. Where can I find it?

def multicut_kernighan_lin(graph, costs, time_limit=None, warmstart=True, **kwargs):
    """ Solve multicut problem with kernighan lin solver.

    Introduced in "An efficient heuristic procedure for partitioning graphs":
    http://xilinx.asia/_hdl/4/eda.ee.ucla.edu/EE201A-04Spring/kl.pdf

    Arguments:
        graph [nifty.graph] - graph of multicut problem
        costs [np.ndarray] - edge costs of multicut problem
        time_limit [float] - time limit for inference in seconds (default: None)
        warmstart [bool] - whether to warmstart with gaec solution (default: True)
    """
    objective = _to_objective(graph, costs)
    solver = objective.kernighanLinFactory(warmStartGreedy=warmstart).create(objective)
    visitor = _get_visitor(objective, time_limit, **kwargs)
    return solver.optimize() if visitor is None else solver.optimize(visitor=visitor)

Also, the function multicut_kernighan_lin references 1970's An efficient heuristic procedure for partitioning graphs, but in practice it defaults to initializing with a greedy strategy (warmStartGreedy= warmstart) , so strictly speaking it is the KLj(Kernighan-Lin algorithm with Joins) algorithm with Joins proposed in "An efficient fusion move algorithm for the minimum cost lifted multicut problem" of 2015 ICCV ?

@constantinpape
Copy link
Owner

I'd like to see the source code of its specific algorithm (intuition tells me it's probably a CPP source), but I can't get further into the source code by clicking on kernighanLinFactory. Where can I find it?

All the multicut algorithms are implemented in nifty. For example, this is the source code for Kernighan-Lin.

so strictly speaking it is the KLj(Kernighan-Lin algorithm with Joins) algorithm with Joins proposed in "An efficient fusion move algorithm for the minimum cost lifted multicut problem" of 2015 ICCV ?

Yes, that's correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants