ml4co_kit.task.graph.mcut

Maximum Cut (MCut).

MCut involves partitioning the vertices of an undirected graph into two disjoint sets to maximize the number of edges crossing between them.

Classes

MCutTask(edge_weighted, precision)

class ml4co_kit.task.graph.mcut.MCutTask(edge_weighted: bool = False, precision: ~numpy.float32 | ~numpy.float64 = <class 'numpy.float32'>)[source]

Bases: GraphTaskBase

check_constraints(sol: ndarray) bool[source]

Check if the solution is valid.

evaluate(sol: ndarray, check_constr: bool = True) floating[source]

Evaluate the given solution. To be implemented by subclasses.

render(save_path: Path, with_sol: bool = True, figsize: tuple = (5, 5), pos_type: str = 'kamada_kawai_layout', node_color: str = 'darkblue', sol_node_color: str = 'orange', node_size: int = 20, edge_color: str = 'darkblue', edge_alpha: float = 0.5, edge_width: float = 1.0)[source]

Render the MCut problem instance with or without solution.