Skip to content

Jackson a #23

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

Merged
merged 2 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions Clique/gen/generate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# File: generate.py
# Author: Jackson Madsen

# Description: Graph generator for clique problem solver
# Use: python3 genereate.py -n num -k num > filename.lp
# python3 generate.py -n num > filename.lp
# python3 generate.py -k num > filename.lp
# python3 generate.py > filename.lp

import argparse
from random import randint

# Process arguments
parser = argparse.ArgumentParser()

parser.add_argument('-n', default = 10, type = int,
help = "Upper limit on number of nodes, non-inclusive. (Default = 10)")
parser.add_argument('-k', default = 3, type = int,
help = "The clique size that is guaranteed to be found in the graph (Default = 3)")
args = parser.parse_args()

numNodes = args.n
cliqueSize = args.k

# Generate all possible nodes
print("node(", sep = "", end = "")
for x in range(1, numNodes):
print(x, " ; ", sep = "", end = "")
print(numNodes, ").", sep ="")

# Collect arbitrary nodes that will form the clique
connected = set()
while len(connected) < cliqueSize:
index = randint(1, numNodes)
connected.add(index)

connected = list(connected)

# Generate edges, with some random additional edges thrown in as well
for i in connected:
seen = set(connected)
edgeStr = f"edge({i}, ("
for j in connected:
if i != j:
edgeStr += f"{j} ; "
for _ in range(randint(0, numNodes)):
randNode = randint(1, numNodes)
if randNode not in seen:
seen.add(randNode)
edgeStr += f"{randNode} ; "

print(edgeStr[:len(edgeStr)-3] + ")).")
















16 changes: 16 additions & 0 deletions Clique/gen/instance1.lp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
node(1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7 ; 8 ; 9 ; 10 ; 11 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 ; 5 ; 38 ; 42 ; 11 ; 75 ; 45 ; 12 ; 16 ; 56 ; 26 ; 27 ; 22 ; 34 ; 97 ; 31 ; 70 ; 88 ; 82 ; 86 ; 94 ; 17 ; 98 ; 36 ; 28 ; 84 ; 62 ; 96 ; 55 ; 76 ; 74 ; 57 ; 9 ; 24 ; 39 ; 41 ; 6 ; 99 ; 30 ; 90 ; 10 ; 58 ; 60 ; 64 ; 91 ; 100 ; 35 ; 47 ; 79 ; 65 ; 15 ; 21 ; 43 ; 33 ; 23 ; 44 ; 46 ; 83 ; 8 ; 73)).
edge(56, (2 ; 67 ; 3 ; 5 ; 38 ; 42 ; 11 ; 75 ; 45 ; 12 ; 16 ; 49 ; 26 ; 27 ; 1 ; 89 ; 20 ; 58 ; 37 ; 40 ; 50 ; 33 ; 86 ; 43 ; 61 ; 52 ; 24 ; 68 ; 77 ; 59 ; 96 ; 98 ; 99)).
edge(26, (2 ; 67 ; 3 ; 5 ; 38 ; 42 ; 11 ; 75 ; 45 ; 12 ; 16 ; 49 ; 56 ; 27 ; 52 ; 1 ; 71 ; 9 ; 72 ; 19 ; 51 ; 66 ; 73 ; 36 ; 20 ; 65 ; 98 ; 90 ; 59 ; 29 ; 33 ; 41 ; 63 ; 76 ; 93 ; 24 ; 87 ; 77 ; 84 ; 8 ; 17 ; 91 ; 92 ; 55 ; 50)).
edge(27, (2 ; 67 ; 3 ; 5 ; 38 ; 42 ; 11 ; 75 ; 45 ; 12 ; 16 ; 49 ; 56 ; 26 ; 72 ; 70 ; 96 ; 8 ; 20 ; 19 ; 37)).
8 changes: 8 additions & 0 deletions Perfect-Numbers/gen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Problem: Perfect-Numbers

## Generator Description
This problem does not contain an instance generator
due to the nature of the problem. We are finding all
the perfect numbers from 2 to an upper limit n. Since
the user provides this upper limit of n, no instance
generator is necessary.
9 changes: 9 additions & 0 deletions Prime-Sieve/gen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Problem: Prime-Sieve

## Generator Description
This problem does not contain an instance generator
due to the nature of the problem. We are filtering
through all the possible numbers from 2 through n,
filtering for primes or composites. Since the user
provides this upper limit of n, no instance
generator is necessary.