$title Goemans/Williamson Randomized Approximation Algorithm for MaxCut (MAXCUT,SEQ=338) $onText Let G(N, E) denote a graph. A cut is a partition of the vertices N into two sets S and T. Any edge (u,v) in E with u in S and v in T is said to be crossing the cut and is a cut edge. The size of the cut is defined to be sum of weights of the edges crossing the cut. This model presents a simple MIP formulation of the problem that is seeded with a solution from the Goemans/Williamson randomized approximation algorithm based on a semidefinite programming relaxation. The model uses MOSEK to solve the SDP. The MaxCut instance tg20_7777 is available from the Biq Mac Library and comes from applications in statistical physics. Wiegele A., Biq Mac Library - Binary Quadratic and Max Cut Library. http://biqmac.uni-klu.ac.at/biqmaclib.html Goemans M.X., and Williamson, D.P., Improved Approximation Algorithms for Maximum Cut and Satisfiability Problems Using Semidefinite Programming. Journal of the ACM 42 (1995), 1115-1145. http://www-math.mit.edu/~goemans/PAPERS/maxcut-jacm.pdf Keywords: mixed integer linear programming, approximation algorithms, convex optimization, randomized algorithms, maximum cut problem, mathematics $offText $ifThen x%gams.LP% == x option lp=mosek; $elseIfI not %gams.LP% == mosek $ log Selected LP solver %gams.LP% cannot solve SDP problems $ exit $endIf Set n 'nodes'; Alias (n,i,j); Parameter w(i,j) 'edge weights'; Set e(i,j) 'edges'; $if not set instance $set instance tg207777.inc $onEmbeddedCode Python: with open("%instance%", "r") as f: n, _ = [int(i) for i in f.readline().split()] gams.set('n', [str(i+1) for i in range(n)]) gams.set('w', [(i,j,int(v)) for i,j,v in [l.split() for l in f.readlines()]]) $offEmbeddedCode n w * We want all edges to be i-j with i maxwS, maxwS = wS; bestS(n) = S(n);); ); display maxwS; * use computed feasible solution as starting point for MIP solve x.l(bestS) = 1; cut.l(e(i,j)) = x.l(i) xor x.l(j); * SCIP and COPT do this by default, for other solvers we need to enable it $set MIPSTART $if %gams.mip% == cplex $set MIPSTART mipStart $if %gams.mip% == cbc $set MIPSTART mipStart $if %gams.mip% == gurobi $set MIPSTART mipStart $if %gams.mip% == highs $set MIPSTART mipStart $if %gams.mip% == xpress $set MIPSTART loadmipsol $ifThen not x%MIPSTART% == x $ echo %MIPSTART% 1 > %gams.mip%.opt maxcut.optFile = 1; $endIf solve maxcut max z using mip;