GoemansWilliamsonOptimizer#
- class GoemansWilliamsonOptimizer(num_cuts, sort_cuts=True, unique_cuts=True, seed=0)[ソース]#
ベースクラス:
OptimizationAlgorithm
Goemans-Williamson algorithm to approximate the max-cut of a problem. The quadratic program for max-cut is given by:
max sum_{i,j<i} w[i,j]*x[i]*(1-x[j])
Therefore the quadratic term encodes the negative of the adjacency matrix of the graph.
- パラメータ:
Methods
- get_compatibility_msg(problem)[ソース]#
Checks whether a given problem can be solved with the optimizer implementing this method.
- パラメータ:
problem (QuadraticProgram) – The optimization problem to check compatibility.
- 戻り値:
Returns the incompatibility message. If the message is empty no issues were found.
- 戻り値の型:
- is_compatible(problem)#
Checks whether a given problem can be solved with the optimizer implementing this method.
- パラメータ:
problem (QuadraticProgram) – The optimization problem to check compatibility.
- 戻り値:
Returns True if the problem is compatible, False otherwise.
- 戻り値の型:
- static max_cut_value(x, adj_matrix)[ソース]#
Compute the value of a cut from an adjacency matrix and a list of binary values.
- solve(problem)[ソース]#
Returns a list of cuts generated according to the Goemans-Williamson algorithm.
- パラメータ:
problem (QuadraticProgram) – The quadratic problem that encodes the max-cut problem.
- 戻り値:
A list of generated cuts.
- 戻り値の型:
cuts