From b8f8dcbb150e803f88725844f73afbce0d91a3c0 Mon Sep 17 00:00:00 2001 From: Max Schweikart Date: Fri, 10 Feb 2023 14:03:26 +0100 Subject: [PATCH] chore: remove compiled GAMS files --- .gitignore | 1 + gams/maxCut/maxcut.lst | 531 ----------------------------------------- gams/maxcut/maxcut.lst | 427 --------------------------------- gams/sat/sat.lst | 221 ----------------- gradlew | 0 5 files changed, 1 insertion(+), 1179 deletions(-) delete mode 100644 gams/maxCut/maxcut.lst delete mode 100644 gams/maxcut/maxcut.lst delete mode 100644 gams/sat/sat.lst mode change 100644 => 100755 gradlew diff --git a/.gitignore b/.gitignore index 3f19aabc..45650d4d 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ out/ ### Toolbox ### /jobs/ gamslice.txt +*.lst diff --git a/gams/maxCut/maxcut.lst b/gams/maxCut/maxcut.lst deleted file mode 100644 index 32227bb8..00000000 --- a/gams/maxCut/maxcut.lst +++ /dev/null @@ -1,531 +0,0 @@ -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:32 Page 1 -Goemans/Williamson Randomized Approximation Algorithm for MaxCut (MAXCUT,SEQ=338) -C o m p i l a t i o n - - - 2 - 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. By default CSDP is used to solve the SDP. - Use --SDPSOLVER=MOSEK to switch to Mosek. - - 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 - 31 - 39 - 40 Set n 'nodes'; - 41 - 42 Alias (n,i,j); - 43 - 44 Parameter w(i,j) 'edge weights'; - 45 - 46 Set e(i,j) 'edges'; - 47 - 48 Set S(n), T(n), bestS(n); - 49 - 50 Scalar - 51 wS weight of cut S / -inf / - 52 maxwS best weight / -inf / - 53 mingapS min gap / inf /; - 54 - 55 Scalar SDPRelaxation / inf /; - 56 - 57 parameter rep(*) / 'value of cut' -inf - 58 'value of best known bound' +inf - 59 'relative gap' NA /; - 60 - 61 - 68 - 69 * We want all edges to be i-j with in2u[-1] or r[0]n2u[-1] or r[1] maxwS, maxwS = wS; mingapS = (SDPRelaxation-ws)/SDPRelaxation; bestS(n) = S(n);); - 253 ); - 254 option clear=S; - 255 S(bestS) = yes; - 256 T(n) = yes; - 257 T(S) = no; - 258 - 259 display maxwS, mingapS, rep_hp; - 260 - 261 rep('value of cut') = maxwS; - 262 rep('value of best known bound') = SDPRelaxation; - 263 rep('relative gap') = (rep('value of best known bound')-rep('value of cut'))/rep('value of best known bound'); - 264 - 265 put_utility 'log' / '### Value of cut: ' rep('value of cut'):0:4; - 266 put_utility 'log' / '### Value of best known bound: ' rep('value of best known bound'):0:4; - 267 put_utility 'log' / '### Relative gap: ' rep('relative gap'):0:16; - 268 - 269 - 270 * use computed feasible solution as starting point for MIP solve - 271 x.l(bestS) = 1; - 272 cut.l(e(i,j)) = x.l(i) xor x.l(j); - 274 - 276 - 277 - 279 * SCIP and COPT do this by default, for other solvers we need to enable it - 282 option miqcp=cplex; - 283 file cpxopt2 / cplex.op2 /; - 284 putclose cpxopt2 'mipstart 1' / - 285 'upperobjstop ' SDPRelaxation:0:16 - 286 putclose cpxopt2; - 287 qubo.optFile = 2; - 289 qubo.limrow = 0; - 290 qubo.limcol = 0; - 291 qubo.solprint = 0; - 292 qubo.reslim = 60-timeelapsed; - 293 solve qubo max z using miqcp; - 294 - 295 option clear=S; - 296 S(n) = x.l(n) > 0.5; - 297 T(n) = yes; - 298 T(S) = no; - 299 - 300 parameter rep(*); - 301 rep('value of cut') = max(rep('value of cut'),z.l); - 302 rep('value of best known bound') = min(rep('value of best known bound'),qubo.objest); - 303 rep('relative gap') = (rep('value of best known bound')-rep('value of cut'))/rep('value of best known bound'); - 305 - 306 put_utility 'log' / '### Value of cut: ' rep('value of cut'):0:4; - 307 put_utility 'log' / '### Value of best known bound: ' rep('value of best known bound'):0:4; - 308 put_utility 'log' / '### Relative gap: ' rep('relative gap'):0:16; - 309 - 310 *write solution - 313 embeddedCode Python: - 314 import networkx as nx - 315 # read input graph - 316 g = nx.read_gml("G:/Studium/TVA/ProvideQ/toolbox-server/jobs/MAX_CUT/1/problem.gml", label=None) - 317 # get cut value and bound ant turn them into graph attributes - 318 attrs_g = {"cut_value": list(gams.get('rep'))[0][1], "bound": list(gams.get('rep'))[1][1]} - 319 g.graph.update(attrs_g) - 320 # get node partition - 321 s = list(gams.get("S")) - 322 t = list(gams.get("T")) - 323 # turn node partitions into dicts - 324 attr1 = {} - 325 for n in s: - 326 try: - 327 attr1[int(n)] = {"Partition": 1} - 328 except ValueError: - 329 attr1[n] = {"Partition": 1} - 330 attr2 = {} - 331 for n in t: - 332 try: - 333 attr2[int(n)] = {"Partition": 2} - 334 except ValueError: - 335 attr2[n] = {"Partition": 2} - 336 # make node partition a node attribute - 337 nx.set_node_attributes(g, attr1) - 338 nx.set_node_attributes(g, attr2) - 339 lines = list(nx.generate_gml(g, stringizer=None)) - 340 with open("G:/Studium/TVA/ProvideQ/toolbox-server/jobs/MAX_CUT/1/problem_sol.gml", 'w') as fout: - 341 if "Comment" in lines[1] or "id" in lines[2]: - 342 for line in lines[:5]: - 343 fout.write(line + '\n') - 344 else: - 345 for line in lines[:3]: - 346 fout.write(line + '\n') - 347 - 348 for node in g.nodes(data=True): - 349 if type(node[0]) == int: - 350 strNode = " node [\n id " + f'{node[0]}' + "\n" - 351 else: - 352 strNode = " node [\n id " + "\"{}\"".format(node[0]) + "\n" - 353 for key, val in node[-1].items(): - 354 if type(val) == int or type(val) == float: - 355 strNode += " "+ str(key) + " " + f'{val}' + "\n" - 356 else: - 357 strNode += " "+ str(key) + " " + "\"{}\"".format(str(val)) + "\n" - 358 strNode += " ]" - 359 fout.write(strNode + '\n') - 360 for edge in g.edges(data=True): - 361 if type(edge[0]) == int: - 362 strEdge = " edge [\n source " + f'{edge[0]}' + "\n target " + f'{edge[1]}' + "\n" - 363 else: - 364 strEdge = " edge [\n source " + "\"{}\"".format(edge[0]) + "\n target " + "\"{}\"".format(edge[1]) + "\n" - 365 for key, val in edge[-1].items(): - 366 if type(val) == int or type(val) == float: - 367 strEdge += " " + str(key) + " " + f'{val}' + "\n" - 368 else: - 369 strEdge += " " + str(key) + " " + "\"{}\"".format(str(val)) + "\n" - 370 strEdge += " ]" - 371 fout.write(strEdge + '\n') - 372 fout.write("]") - 373 endembeddedCode - 374 -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:32 Page 2 -Goemans/Williamson Randomized Approximation Algorithm for MaxCut (MAXCUT,SEQ=338) -Include File Summary - - - SEQ GLOBAL TYPE PARENT LOCAL FILENAME - - 1 1 INPUT 0 0 G:\Studium\TVA\ProvideQ\toolbox-server\gams\maxCut\maxcut.gms - 2 136 LIBINCLUDE 1 158 .C:\Program Files (x86)\GAMS\42\inclib\linalg.gms - 3 229 EXIT 2 105 .C:\Program Files (x86)\GAMS\42\inclib\linalg.gms - - -COMPILATION TIME = 0.172 SECONDS 3 MB 42.0.0 3dcbfd09 WEX-WEI -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:32 Page 3 -Goemans/Williamson Randomized Approximation Algorithm for MaxCut (MAXCUT,SEQ=338) -Range Statistics SOLVE sdp Using LP From line 132 - - -RANGE STATISTICS (ABSOLUTE NON-ZERO FINITE VALUES) - -RHS [min, max] : [ NA, NA] - Zero values observed as well -Bound [min, max] : [ 1.000E+00, 1.000E+00] -Matrix [min, max] : [ 5.000E-01, 1.000E+00] - Zero values observed as well - -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:32 Page 4 -Goemans/Williamson Randomized Approximation Algorithm for MaxCut (MAXCUT,SEQ=338) -Model Statistics SOLVE sdp Using LP From line 132 - - -MODEL STATISTICS - -BLOCKS OF EQUATIONS 1 SINGLE EQUATIONS 1 -BLOCKS OF VARIABLES 2 SINGLE VARIABLES 5 -NON ZERO ELEMENTS 5 - - -GENERATION TIME = 0.000 SECONDS 4 MB 42.0.0 3dcbfd09 WEX-WEI -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:32 Page 5 -Goemans/Williamson Randomized Approximation Algorithm for MaxCut (MAXCUT,SEQ=338) -Solution Report SOLVE sdp Using LP From line 132 - - - S O L V E S U M M A R Y - - MODEL sdp OBJECTIVE sdpobj - TYPE LP DIRECTION MINIMIZE - SOLVER MOSEK FROM LINE 132 - -**** SOLVER STATUS 1 Normal Completion -**** MODEL STATUS 1 Optimal -**** OBJECTIVE VALUE -1.0000 - - RESOURCE USAGE, LIMIT 0.000 59.834 - ITERATION COUNT, LIMIT 3 2147483647 -*** This solver runs with a demo license. No commercial use. - - -**** REPORT SUMMARY : 0 NONOPT - 0 INFEASIBLE - 0 UNBOUNDED -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:32 Page 6 -Goemans/Williamson Randomized Approximation Algorithm for MaxCut (MAXCUT,SEQ=338) -E x e c u t i o n - - ----- 235 PARAMETER SDPRelaxation = 1.000 - ----- 259 PARAMETER maxwS = 1.000 best weight - PARAMETER mingapS = -7.7597E-11 min gap - ----- 259 PARAMETER rep_hp - - value of ~ value of ~ relative ~ - -hp1 1.000 1.000 -7.7597E-11 -hp2 1.000 1.000 -7.7597E-11 -hp3 1.000 1.000 -7.7597E-11 -hp4 1.000 1.000 -7.7597E-11 -hp5 1.000 1.000 -7.7597E-11 -hp6 1.000 1.000 -7.7597E-11 -hp7 1.000 1.000 -7.7597E-11 -hp8 1.000 1.000 -7.7597E-11 -hp9 1.000 1.000 -7.7597E-11 -hp10 1.000 1.000 -7.7597E-11 - -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:32 Page 7 -Goemans/Williamson Randomized Approximation Algorithm for MaxCut (MAXCUT,SEQ=338) -Range Statistics SOLVE qubo Using MIQCP From line 293 - - -RANGE STATISTICS (ABSOLUTE NON-ZERO FINITE VALUES) - -RHS [min, max] : [ NA, NA] - Zero values observed as well -Bound [min, max] : [ 1.000E+00, 1.000E+00] - Zero values observed as well -Matrix [min, max] : [ 1.000E+00, 2.000E+00] - -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:32 Page 8 -Goemans/Williamson Randomized Approximation Algorithm for MaxCut (MAXCUT,SEQ=338) -Model Statistics SOLVE qubo Using MIQCP From line 293 - - -MODEL STATISTICS - -BLOCKS OF EQUATIONS 1 SINGLE EQUATIONS 1 -BLOCKS OF VARIABLES 2 SINGLE VARIABLES 3 -NON ZERO ELEMENTS 3 NON LINEAR N-Z 2 -CODE LENGTH 13 CONSTANT POOL 16 DISCRETE VARIABLES 2 - - -GENERATION TIME = 0.000 SECONDS 4 MB 42.0.0 3dcbfd09 WEX-WEI -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:32 Page 9 -Goemans/Williamson Randomized Approximation Algorithm for MaxCut (MAXCUT,SEQ=338) -Solution Report SOLVE qubo Using MIQCP From line 293 - - - S O L V E S U M M A R Y - - MODEL qubo OBJECTIVE z - TYPE MIQCP DIRECTION MAXIMIZE - SOLVER CPLEX FROM LINE 293 - -**** SOLVER STATUS 1 Normal Completion -**** MODEL STATUS 1 Optimal -**** OBJECTIVE VALUE 1.0000 - - RESOURCE USAGE, LIMIT 0.000 59.742 - ITERATION COUNT, LIMIT 0 2147483647 - EVALUATION ERRORS NA 0 ---- GAMS/Cplex Link licensed for continuous and discrete problems. - -Reading parameter(s) from "G:\Studium\TVA\ProvideQ\toolbox-server\gams\maxCut\cplex.op2" ->> mipstart 1 ->> upperobjstop 0.9999999999224030 -Finished reading from "G:\Studium\TVA\ProvideQ\toolbox-server\gams\maxCut\cplex.op2" - ---- GMO Q Extraction (ThreePass): 0.00s ---- GMO setup time: 0.00s ---- GMO memory 0.50 Mb (peak 0.50 Mb) ---- Dictionary memory 0.00 Mb ---- Cplex 22.1.1.0 link memory 0.00 Mb (peak 0.00 Mb) ---- Starting Cplex - - ---- MIQP status (101): integer optimal solution. ---- Cplex Time: 0.00sec (det. 0.01 ticks) - ---- Fixing integer variables and solving final QP... - - ---- Fixed MIQP status (1): optimal. ---- Cplex Time: 0.00sec (det. 0.00 ticks) - - -Proven optimal solution -MIP Solution: 1.000000 (0 iterations, 0 nodes) -Final Solve: 1.000000 (0 iterations) - -Best possible: 1.000000 -Absolute gap: 0.000000 -Relative gap: 0.000000 - - - -**** REPORT SUMMARY : 0 NONOPT - 0 INFEASIBLE - 0 UNBOUNDED - 0 ERRORS -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:32 Page 10 -Goemans/Williamson Randomized Approximation Algorithm for MaxCut (MAXCUT,SEQ=338) -E x e c u t i o n - - -**** REPORT FILE SUMMARY - - pyScript G:\Studium\TVA\ProvideQ\toolbox-server\gams\maxCut\225a\myEmb.dat -cpxopt2 G:\Studium\TVA\ProvideQ\toolbox-server\gams\maxCut\cplex.op2 - - -EXECUTION TIME = 0.141 SECONDS 4 MB 42.0.0 3dcbfd09 WEX-WEI - - -USER: ProvideQ Project License S220922|0002CO-GEN - GAMS Software GmbH, Braunschweig Office DCE2398 - -**** ************* BETA release -**** GAMS Base Module 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEI x86 64bit/MS Window -**** ************* BETA release - - -**** FILE SUMMARY - -Input G:\Studium\TVA\ProvideQ\toolbox-server\gams\maxCut\maxcut.gms -Output G:\Studium\TVA\ProvideQ\toolbox-server\gams\maxCut\maxcut.lst diff --git a/gams/maxcut/maxcut.lst b/gams/maxcut/maxcut.lst deleted file mode 100644 index 99668abe..00000000 --- a/gams/maxcut/maxcut.lst +++ /dev/null @@ -1,427 +0,0 @@ -GAMS 40.3.0 f227c22a Sep 16, 2022 WEX-WEI x86 64bit/MS Windows - 02/02/23 23:10:23 Page 1 -Goemans/Williamson Randomized Approximation Algorithm for MaxCut (MAXCUT,SEQ=338) -C o m p i l a t i o n - - - 2 - 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. By default CSDP is used to solve the SDP. - Use --SDPSOLVER=MOSEK to switch to Mosek. - - 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 - 31 - 39 - 40 Set n 'nodes'; - 41 - 42 Alias (n,i,j); - 43 - 44 Parameter w(i,j) 'edge weights'; - 45 - 46 Set e(i,j) 'edges'; - 47 - 48 Set S(n), T(n), bestS(n); - 49 - 50 Scalar - 51 wS weight of cut S / -inf / - 52 maxwS best weight / -inf / - 53 mingapS min gap / inf /; - 54 - 55 Scalar SDPRelaxation / inf /; - 56 - 57 parameter rep(*) / 'value of cut' -inf - 58 'value of best known bound' +inf - 59 'relative gap' NA /; - 60 - 61 - 67 $ offembeddedCode n w -**** $865 -**** 865 Problem in embedded code section - 68 - 69 * We want all edges to be i-j with in2u[-1] or r[0]n2u[-1] or r[1] maxwS, maxwS = wS; mingapS = (SDPRelaxation-ws)/SDPRelaxation; bestS(n) = S(n);); -**** $352 $352 -**** LINE 181 INPUT C:\Users\maxsc\Projects\toolbox-server\gams\maxcut\maxcut.gms -**** 352 Set has not been initialized - 253 ); - 254 option clear=S; - 255 S(bestS) = yes; - 256 T(n) = yes; -**** $352 -**** LINE 185 INPUT C:\Users\maxsc\Projects\toolbox-server\gams\maxcut\maxcut.gms -**** 352 Set has not been initialized - 257 T(S) = no; - 258 - 259 display maxwS, mingapS, rep_hp; - 260 - 261 rep('value of cut') = maxwS; - 262 rep('value of best known bound') = SDPRelaxation; - 263 rep('relative gap') = (rep('value of best known bound')-rep('value of cut'))/rep('value of best known bound'); - 264 - 265 put_utility 'log' / '### Value of cut: ' rep('value of cut'):0:4; - 266 put_utility 'log' / '### Value of best known bound: ' rep('value of best known bound'):0:4; - 267 put_utility 'log' / '### Relative gap: ' rep('relative gap'):0:16; - 268 - 269 - 270 * use computed feasible solution as starting point for MIP solve - 271 x.l(bestS) = 1; - 272 cut.l(e(i,j)) = x.l(i) xor x.l(j); -**** $352,352 $352 $352 -**** LINE 201 INPUT C:\Users\maxsc\Projects\toolbox-server\gams\maxcut\maxcut.gms -**** 352 Set has not been initialized - 274 - 276 - 277 - 279 * SCIP and COPT do this by default, for other solvers we need to enable it - 282 option miqcp=cplex; - 283 file cpxopt2 / cplex.op2 /; - 284 putclose cpxopt2 'mipstart 1' / - 285 'upperobjstop ' SDPRelaxation:0:16 - 286 putclose cpxopt2; - 287 qubo.optFile = 2; - 289 qubo.limrow = 0; - 290 qubo.limcol = 0; - 291 qubo.solprint = 0; - 292 qubo.reslim = 60-timeelapsed; - 293 solve qubo max z using miqcp; -**** $257 -**** LINE 266 INPUT C:\Users\maxsc\Projects\toolbox-server\gams\maxcut\maxcut.gms -**** 257 Solve statement not checked because of previous errors - 294 - 295 option clear=S; - 296 S(n) = x.l(n) > 0.5; -**** $352 $352 -**** LINE 269 INPUT C:\Users\maxsc\Projects\toolbox-server\gams\maxcut\maxcut.gms -**** 352 Set has not been initialized - 297 T(n) = yes; -**** $352 -**** LINE 270 INPUT C:\Users\maxsc\Projects\toolbox-server\gams\maxcut\maxcut.gms -**** 352 Set has not been initialized - 298 T(S) = no; - 299 - 300 parameter rep(*); - 301 rep('value of cut') = max(rep('value of cut'),z.l); -**** $141 -**** LINE 274 INPUT C:\Users\maxsc\Projects\toolbox-server\gams\maxcut\maxcut.gms -**** 141 Symbol declared but no values have been assigned. Check for missing -**** data definition, assignment, data loading or implicit assignment -**** via a solve statement. -**** A wild shot: You may have spurious commas in the explanatory -**** text of a declaration. Check symbol reference list. - 302 rep('value of best known bound') = min(rep('value of best known bound'),qubo.objest); - 303 rep('relative gap') = (rep('value of best known bound')-rep('value of cut'))/rep('value of best known bound'); - 305 - 306 put_utility 'log' / '### Value of cut: ' rep('value of cut'):0:4; - 307 put_utility 'log' / '### Value of best known bound: ' rep('value of best known bound'):0:4; - 308 put_utility 'log' / '### Relative gap: ' rep('relative gap'):0:16; - 309 - 310 *write solution - 313 embeddedCode Python: - 314 import networkx as nx - 315 # read input graph - 316 g = nx.read_gml("C:/Users/maxsc/Projects/toolbox-server/jobs/maxcut/2/problem.gml", label=None) - 317 # get cut value and bound ant turn them into graph attributes - 318 attrs_g = {"cut_value": list(gams.get('rep'))[0][1], "bound": list(gams.get('rep'))[1][1]} - 319 g.graph.update(attrs_g) - 320 # get node partition - 321 s = list(gams.get("S")) - 322 t = list(gams.get("T")) - 323 # turn node partitions into dicts - 324 attr1 = {} - 325 for n in s: - 326 try: - 327 attr1[int(n)] = {"Partition": 1} - 328 except ValueError: - 329 attr1[n] = {"Partition": 1} - 330 attr2 = {} - 331 for n in t: - 332 try: - 333 attr2[int(n)] = {"Partition": 2} - 334 except ValueError: - 335 attr2[n] = {"Partition": 2} - 336 # make node partition a node attribute - 337 nx.set_node_attributes(g, attr1) - 338 nx.set_node_attributes(g, attr2) - 339 lines = list(nx.generate_gml(g, stringizer=None)) - 340 with open("C:/Users/maxsc/Projects/toolbox-server/jobs/maxcut/2/problem_sol.gml", 'w') as fout: - 341 if "Comment" in lines[1] or "id" in lines[2]: - 342 for line in lines[:5]: - 343 fout.write(line + '\n') - 344 else: - 345 for line in lines[:3]: - 346 fout.write(line + '\n') - 347 - 348 for node in g.nodes(data=True): - 349 if type(node[0]) == int: - 350 strNode = " node [\n id " + f'{node[0]}' + "\n" - 351 else: - 352 strNode = " node [\n id " + "\"{}\"".format(node[0]) + "\n" - 353 for key, val in node[-1].items(): - 354 if type(val) == int or type(val) == float: - 355 strNode += " "+ str(key) + " " + f'{val}' + "\n" - 356 else: - 357 strNode += " "+ str(key) + " " + "\"{}\"".format(str(val)) + "\n" - 358 strNode += " ]" - 359 fout.write(strNode + '\n') - 360 for edge in g.edges(data=True): - 361 if type(edge[0]) == int: - 362 strEdge = " edge [\n source " + f'{edge[0]}' + "\n target " + f'{edge[1]}' + "\n" - 363 else: - 364 strEdge = " edge [\n source " + "\"{}\"".format(edge[0]) + "\n target " + "\"{}\"".format(edge[1]) + "\n" - 365 for key, val in edge[-1].items(): - 366 if type(val) == int or type(val) == float: - 367 strEdge += " " + str(key) + " " + f'{val}' + "\n" - 368 else: - 369 strEdge += " " + str(key) + " " + "\"{}\"".format(str(val)) + "\n" - 370 strEdge += " ]" - 371 fout.write(strEdge + '\n') - 372 fout.write("]") - 373 endembeddedCode - 374 - -**** 42 ERROR(S) 0 WARNING(S) -GAMS 40.3.0 f227c22a Sep 16, 2022 WEX-WEI x86 64bit/MS Windows - 02/02/23 23:10:23 Page 2 -Goemans/Williamson Randomized Approximation Algorithm for MaxCut (MAXCUT,SEQ=338) -Include File Summary - - - SEQ GLOBAL TYPE PARENT LOCAL FILENAME - - 1 1 INPUT 0 0 C:\Users\maxsc\Projects\toolbox-server\gams\maxcut\maxcut.gms - 2 136 LIBINCLUDE 1 158 .C:\GAMS\40\inclib\linalg.gms - 3 229 EXIT 2 105 .C:\GAMS\40\inclib\linalg.gms - - -COMPILATION TIME = 1.312 SECONDS 3 MB 40.3.0 f227c22a WEX-WEI - - -USER: GAMS Demo license for Max Schweikart G220922|0002CO-GEN - TVA at the Karlsruhe Institute of Technology, Germany DL074179 - - -**** FILE SUMMARY - -Input C:\Users\maxsc\Projects\toolbox-server\gams\maxcut\maxcut.gms -Output C:\Users\maxsc\Projects\toolbox-server\gams\maxcut\maxcut.lst - -**** USER ERROR(S) ENCOUNTERED diff --git a/gams/sat/sat.lst b/gams/sat/sat.lst deleted file mode 100644 index 09550aa8..00000000 --- a/gams/sat/sat.lst +++ /dev/null @@ -1,221 +0,0 @@ -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:48 Page 1 -G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m -C o m p i l a t i o n - - - 1 *input can be set through --CNFINPUT= - 2 *if no input is provided, use default input for demo - 4 - 5 set c 'clauses' - 6 pn 'positive/negative' / '+', '-' /, - 7 l 'literals' - 8 cnf(c<,l,pn) 'clauses to literals mapping' - 9 ; - 10 - 11 * read cnf file and load content into GAMS data structures - 44 - 45 * Simplest SAT Model - 46 Binary variables - 47 b(l) 'encodes yes (1) or no (0) for literal' - 48 ; - 49 Variable - 50 obj 'dummy objective variable' - 51 ; - 52 Equation - 53 defclause(c) 'define clauses' - 54 defobj 'defined dummy objective' - 55 ; - 56 - 57 defclause(c).. sum(cnf(c,l,'+'), b(l)) + sum(cnf(c,l,'-'), 1-b(l)) =g= 1; - 58 - 59 defobj.. obj =e= sum(l, b(l)); - 60 - 61 model sat / all /; - 62 - 63 * set absolute termination criterion to a value satisfied by any feasible solution - 64 sat.optca = card(l)+1; - 65 - 66 * solve SAT problem as MIP - 67 solve sat max obj using mip; - 68 - 69 * write solution file - 72 file fr / "G:\Studium\TVA\ProvideQ\toolbox-server\jobs\SAT\3\problem.sol" /; put fr; - 73 put 'c Solution G:\Studium\TVA\ProvideQ\toolbox-server\jobs\SAT\3\problem.cnf'; - 74 if(sat.modelstat=1 or sat.modelstat=8, - 75 put / 's cnf 1 ' card(l):0:0 ' ' card(c):0:0; - 76 loop(l, - 77 put$(b.l(l)<0.5) / 'v -' l.tl:0; - 78 put$(b.l(l)>=0.5) / 'v ' l.tl:0; - 79 ); - 80 elseif sat.solvestat=1, - 81 put / 's cnf 0 ' card(l):0:0 ' ' card(c):0:0; - 82 else - 83 put / 's cnf -1 ' card(l):0:0 ' ' card(c):0:0; - 84 ); - 85 - - -COMPILATION TIME = 0.062 SECONDS 3 MB 42.0.0 3dcbfd09 WEX-WEI -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:48 Page 2 -G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m -Equation Listing SOLVE sat Using MIP From line 67 - - ----- defclause =G= define clauses - -defclause(c0).. b(1) =G= 1 ; (LHS = 0, INFES = 1 ****) - -defclause(c1).. b(2) =G= 1 ; (LHS = 0, INFES = 1 ****) - - ----- defobj =E= defined dummy objective - -defobj.. - b(1) - b(2) + obj =E= 0 ; (LHS = 0) - -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:48 Page 3 -G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m -Column Listing SOLVE sat Using MIP From line 67 - - ----- b encodes yes (1) or no (0) for literal - -b(1) - (.LO, .L, .UP, .M = 0, 0, 1, 0) - 1 defclause(c0) - -1 defobj - -b(2) - (.LO, .L, .UP, .M = 0, 0, 1, 0) - 1 defclause(c1) - -1 defobj - - ----- obj dummy objective variable - -obj - (.LO, .L, .UP, .M = -INF, 0, +INF, 0) - 1 defobj - -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:48 Page 4 -G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m -Range Statistics SOLVE sat Using MIP From line 67 - - -RANGE STATISTICS (ABSOLUTE NON-ZERO FINITE VALUES) - -RHS [min, max] : [ 1.000E+00, 1.000E+00] - Zero values observed as well -Bound [min, max] : [ 1.000E+00, 1.000E+00] - Zero values observed as well -Matrix [min, max] : [ 1.000E+00, 1.000E+00] - -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:48 Page 5 -G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m -Model Statistics SOLVE sat Using MIP From line 67 - - -MODEL STATISTICS - -BLOCKS OF EQUATIONS 2 SINGLE EQUATIONS 3 -BLOCKS OF VARIABLES 2 SINGLE VARIABLES 3 -NON ZERO ELEMENTS 5 DISCRETE VARIABLES 2 - - -GENERATION TIME = 0.000 SECONDS 4 MB 42.0.0 3dcbfd09 WEX-WEI -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:48 Page 6 -G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m -Solution Report SOLVE sat Using MIP From line 67 - - - S O L V E S U M M A R Y - - MODEL sat OBJECTIVE obj - TYPE MIP DIRECTION MAXIMIZE - SOLVER CPLEX FROM LINE 67 - -**** SOLVER STATUS 1 Normal Completion -**** MODEL STATUS 1 Optimal -**** OBJECTIVE VALUE 2.0000 - - RESOURCE USAGE, LIMIT 0.000 10000000000.000 - ITERATION COUNT, LIMIT 0 2147483647 ---- GAMS/Cplex Link licensed for continuous and discrete problems. ---- GMO setup time: 0.00s ---- GMO memory 0.50 Mb (peak 0.50 Mb) ---- Dictionary memory 0.00 Mb ---- Cplex 22.1.1.0 link memory 0.00 Mb (peak 0.00 Mb) ---- Starting Cplex - - ---- MIP status (101): integer optimal solution. ---- Cplex Time: 0.00sec (det. 0.00 ticks) - ---- Fixing integer variables and solving final LP... - - ---- Fixed MIP status (1): optimal. ---- Cplex Time: 0.00sec (det. 0.00 ticks) - - -Proven optimal solution -MIP Solution: 2.000000 (0 iterations, 0 nodes) -Final Solve: 2.000000 (0 iterations) - -Best possible: 2.000000 -Absolute gap: 0.000000 -Relative gap: 0.000000 - - ----- EQU defclause define clauses - - LOWER LEVEL UPPER MARGINAL - -c0 1.0000 1.0000 +INF . -c1 1.0000 1.0000 +INF . - - LOWER LEVEL UPPER MARGINAL - ----- EQU defobj . . . 1.0000 - - defobj defined dummy objective - ----- VAR b encodes yes (1) or no (0) for literal - - LOWER LEVEL UPPER MARGINAL - -1 . 1.0000 1.0000 1.0000 -2 . 1.0000 1.0000 1.0000 - - LOWER LEVEL UPPER MARGINAL - ----- VAR obj -INF 2.0000 +INF . - - obj dummy objective variable - - -**** REPORT SUMMARY : 0 NONOPT - 0 INFEASIBLE - 0 UNBOUNDED -GAMS 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEX-WEI x86 64bit/MS Windows - 02/10/23 11:10:48 Page 7 -G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m -E x e c u t i o n - - -**** REPORT FILE SUMMARY - -fr G:\Studium\TVA\ProvideQ\toolbox-server\jobs\SAT\3\problem.sol - - -EXECUTION TIME = 0.032 SECONDS 4 MB 42.0.0 3dcbfd09 WEX-WEI - - -USER: ProvideQ Project License S220922|0002CO-GEN - GAMS Software GmbH, Braunschweig Office DCE2398 - -**** ************* BETA release -**** GAMS Base Module 42.0.0 3dcbfd09 Jan 13, 2023 (BETA) WEI x86 64bit/MS Window -**** ************* BETA release - - -**** FILE SUMMARY - -Input G:\Studium\TVA\ProvideQ\toolbox-server\gams\sat\sat.gms -Output G:\Studium\TVA\ProvideQ\toolbox-server\gams\sat\sat.lst diff --git a/gradlew b/gradlew old mode 100644 new mode 100755