Skip to content

Commit

Permalink
changed add_durations to using randint
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Behrens authored Nov 21, 2022
1 parent 8269182 commit 83cea84
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gen.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse, os, time
from subprocess import getoutput
from random import randint

def agents():
instance_filled = getoutput('clingo ' + instanceFileName + ' encodings/agents.lp -c d=' + args.distance + ' -c a=' + args.agents + ' --init-watches=rnd --sign-def=rnd --rand-freq=1 -V0 --out-atomf=%s. --out-ifs="\n" | head -n -1')
Expand Down Expand Up @@ -39,8 +40,14 @@ def warehouse():
instance_unfilled = getoutput('clingo encodings/warehouse.lp -c s=' + args.size + ' -c w=' + args.width + ' -c a=' + args.agents + ' --rand-freq=1 --init-watches=rnd --sign-def=rnd -V0 --out-atomf=%s. --out-ifs="\n" | head -n -1')

def add_durations():
instance_with_duration = getoutput('clingo encodings/durations.lp -c mindur=' + args.durations[0] + ' -c maxdur=' + args.durations[1] + ' ' + instanceFileName + ' -V0 --out-atomf=%s. --out-ifs="\n" -W none --init-watches=rnd --sign-def=rnd --rand-freq=1 | head -n -1')
write('w', instance_with_duration)
#instance_with_duration = getoutput('clingo encodings/durations.lp -c mindur=' + args.durations[0] + ' -c maxdur=' + args.durations[1] + ' ' + instanceFileName + ' -V0 --out-atomf=%s. --out-ifs="\n" -W none --init-watches=rnd --sign-def=rnd --rand-freq=1 | head -n -1')
#write('w', instance_with_duration)
with open(instanceFileName, 'r+') as instance:
instance_with_durations = instance.readlines()
instance.seek(0)
for line in instance_with_durations:
if 'edge' in line: line = line.replace('))','),'+str(randint(int(args.durations[0]),int(args.durations[1])))+')')
instance.writelines(line)

def meta_inc():
global instanceFileName
Expand Down

0 comments on commit 83cea84

Please sign in to comment.