Cleaning up
This commit is contained in:
parent
d9d65c249f
commit
35fe3314f2
@ -1,49 +0,0 @@
|
||||
3 1.0 map20190601214806875702_auto|GC_Position 7,5 |GC_Area H(6,4) R(6,5) R(7,4) E(8,4) R(8,5)
|
||||
3 1.0 map20190601214806875702_auto|GC_Position 6,5 |GC_Area E(5,4) R(5,5) H(6,4) R(7,4) R(7,5)
|
||||
1 1.0 map20190601214806875702_auto|GC_Position 6,5 |GC_Area E(5,4) R(5,5) H(6,4) R(7,4) R(7,5)
|
||||
2 1.0 map20190601214806875702_auto|GC_Position 7,5 |GC_Area H(6,4) R(6,5) R(7,4) E(8,4) R(8,5)
|
||||
4 1.0 map20190601214806875702_auto|GC_Position 7,4 |GC_Area E(6,3) H(6,4) R(6,5) R(7,3) R(7,5) E(8,3) E(8,4) R(8,5)
|
||||
4 1.0 map20190601214806875702_auto|GC_Position 7,3 |GC_Area H(6,2) E(6,3) H(6,4) R(7,2) R(7,4) E(8,2) E(8,3) E(8,4)
|
||||
4 1.0 map20190601214806875702_auto|GC_Position 7,2 |GC_Area R(6,1) H(6,2) E(6,3) R(7,1) R(7,3) R(8,1) E(8,2) E(8,3)
|
||||
1 1.0 map20190601214806875702_auto|GC_Position 7,2 |GC_Area R(6,1) H(6,2) E(6,3) R(7,1) R(7,3) R(8,1) E(8,2) E(8,3)
|
||||
4 1.0 map20190601214806875702_auto|GC_Position 7,1 |GC_Area R(6,0) R(6,1) H(6,2) E(7,0) R(7,2) G(8,0) R(8,1) E(8,2)
|
||||
3 1.0 map20190601214806875702_auto|GC_Position 6,1 |GC_Area H(5,0) R(5,1) E(5,2) R(6,0) H(6,2) E(7,0) R(7,1) R(7,2)
|
||||
3 1.0 map20190601214806875702_auto|GC_Position 5,1 |GC_Area R(4,0) R(4,1) R(4,2) H(5,0) E(5,2) R(6,0) R(6,1) H(6,2)
|
||||
1 1.0 map20190601214806875702_auto|GC_Position 5,1 |GC_Area R(4,0) R(4,1) R(4,2) H(5,0) E(5,2) R(6,0) R(6,1) H(6,2)
|
||||
2 1.0 map20190601214806875702_auto|GC_Position 6,1 |GC_Area H(5,0) R(5,1) E(5,2) R(6,0) H(6,2) E(7,0) R(7,1) R(7,2)
|
||||
2 1.0 map20190601214806875702_auto|GC_Position 7,1 |GC_Area R(6,0) R(6,1) H(6,2) E(7,0) R(7,2) G(8,0) R(8,1) E(8,2)
|
||||
2 1.0 map20190601214806875702_auto|GC_Position 8,1 |GC_Area E(7,0) R(7,1) R(7,2) G(8,0) E(8,2) H(9,0) R(9,1) E(9,2)
|
||||
2 1.0 map20190601214806875702_auto|GC_Position 9,1 |GC_Area G(8,0) R(8,1) E(8,2) H(9,0) E(9,2) E(10,0) R(10,1) E(10,2)
|
||||
1 1.0 map20190601214806875702_auto|GC_Position 9,1 |GC_Area G(8,0) R(8,1) E(8,2) H(9,0) E(9,2) E(10,0) R(10,1) E(10,2)
|
||||
3 1.0 map20190601214806875702_auto|GC_Position 8,1 |GC_Area E(7,0) R(7,1) R(7,2) G(8,0) E(8,2) H(9,0) R(9,1) E(9,2)
|
||||
3 1.0 map20190601214806875702_auto|GC_Position 7,1 |GC_Area R(6,0) R(6,1) H(6,2) E(7,0) R(7,2) G(8,0) R(8,1) E(8,2)
|
||||
3 1.0 map20190601214806875702_auto|GC_Position 6,1 |GC_Area H(5,0) R(5,1) E(5,2) R(6,0) H(6,2) E(7,0) R(7,1) R(7,2)
|
||||
3 1.0 map20190601214806875702_auto|GC_Position 5,1 |GC_Area R(4,0) R(4,1) R(4,2) H(5,0) E(5,2) R(6,0) R(6,1) H(6,2)
|
||||
3 1.0 map20190601214806875702_auto|GC_Position 4,1 |GC_Area E(3,0) R(3,1) E(3,2) R(4,0) R(4,2) H(5,0) R(5,1) E(5,2)
|
||||
3 1.0 map20190601214806875702_auto|GC_Position 3,1 |GC_Area E(2,0) R(2,1) E(2,2) E(3,0) E(3,2) R(4,0) R(4,1) R(4,2)
|
||||
3 1.0 map20190601214806875702_auto|GC_Position 2,1 |GC_Area E(1,0) R(1,1) E(1,2) E(2,0) E(2,2) E(3,0) R(3,1) E(3,2)
|
||||
3 1.0 map20190601214806875702_auto|GC_Position 1,1 |GC_Area R(0,0) R(0,1) R(0,2) E(1,0) E(1,2) E(2,0) R(2,1) E(2,2)
|
||||
3 1.0 map20190601214806875702_auto|GC_Position 0,1 |GC_Area R(0,0) R(0,2) E(1,0) R(1,1) E(1,2)
|
||||
5 1.0 map20190601214806875702_auto|GC_Position 0,2 |GC_Area R(0,1) R(0,3) R(1,1) E(1,2) H(1,3)
|
||||
5 1.0 map20190601214806875702_auto|GC_Position 0,3 |GC_Area R(0,2) R(0,4) E(1,2) H(1,3) B(1,4)
|
||||
1 1.0 map20190601214806875702_auto|GC_Position 0,3 |GC_Area R(0,2) R(0,4) E(1,2) H(1,3) B(1,4)
|
||||
5 1.0 map20190601214806875702_auto|GC_Position 0,4 |GC_Area R(0,3) R(0,5) H(1,3) B(1,4) R(1,5)
|
||||
5 1.0 map20190601214806875702_auto|GC_Position 0,5 |GC_Area R(0,4) B(1,4) R(1,5)
|
||||
2 1.0 map20190601214806875702_auto|GC_Position 1,5 |GC_Area R(0,4) R(0,5) B(1,4) H(2,4) R(2,5)
|
||||
2 1.0 map20190601214806875702_auto|GC_Position 2,5 |GC_Area B(1,4) R(1,5) H(2,4) Y(3,4) R(3,5)
|
||||
1 1.0 map20190601214806875702_auto|GC_Position 2,5 |GC_Area B(1,4) R(1,5) H(2,4) Y(3,4) R(3,5)
|
||||
3 1.0 map20190601214806875702_auto|GC_Position 1,5 |GC_Area R(0,4) R(0,5) B(1,4) H(2,4) R(2,5)
|
||||
1 1.0 map20190601214806875702_auto|GC_Position 1,5 |GC_Area R(0,4) R(0,5) B(1,4) H(2,4) R(2,5)
|
||||
2 1.0 map20190601214806875702_auto|GC_Position 2,5 |GC_Area B(1,4) R(1,5) H(2,4) Y(3,4) R(3,5)
|
||||
2 1.0 map20190601214806875702_auto|GC_Position 3,5 |GC_Area H(2,4) R(2,5) Y(3,4) R(4,4) R(4,5)
|
||||
1 1.0 map20190601214806875702_auto|GC_Position 3,5 |GC_Area H(2,4) R(2,5) Y(3,4) R(4,4) R(4,5)
|
||||
2 1.0 map20190601214806875702_auto|GC_Position 4,5 |GC_Area Y(3,4) R(3,5) R(4,4) E(5,4) R(5,5)
|
||||
2 1.0 map20190601214806875702_auto|GC_Position 5,5 |GC_Area R(4,4) R(4,5) E(5,4) H(6,4) R(6,5)
|
||||
2 1.0 map20190601214806875702_auto|GC_Position 6,5 |GC_Area E(5,4) R(5,5) H(6,4) R(7,4) R(7,5)
|
||||
2 1.0 map20190601214806875702_auto|GC_Position 7,5 |GC_Area H(6,4) R(6,5) R(7,4) E(8,4) R(8,5)
|
||||
4 1.0 map20190601214806875702_auto|GC_Position 7,4 |GC_Area E(6,3) H(6,4) R(6,5) R(7,3) R(7,5) E(8,3) E(8,4) R(8,5)
|
||||
4 1.0 map20190601214806875702_auto|GC_Position 7,3 |GC_Area H(6,2) E(6,3) H(6,4) R(7,2) R(7,4) E(8,2) E(8,3) E(8,4)
|
||||
4 1.0 map20190601214806875702_auto|GC_Position 7,2 |GC_Area R(6,1) H(6,2) E(6,3) R(7,1) R(7,3) R(8,1) E(8,2) E(8,3)
|
||||
4 1.0 map20190601214806875702_auto|GC_Position 7,1 |GC_Area R(6,0) R(6,1) H(6,2) E(7,0) R(7,2) G(8,0) R(8,1) E(8,2)
|
||||
2 1.0 map20190601214806875702_auto|GC_Position 8,1 |GC_Area E(7,0) R(7,1) R(7,2) G(8,0) E(8,2) H(9,0) R(9,1) E(9,2)
|
||||
1 1.0 map20190601214806875702_auto|GC_Position 8,1 |GC_Area E(7,0) R(7,1) R(7,2) G(8,0) E(8,2) H(9,0) R(9,1) E(9,2)
|
@ -1 +1 @@
|
||||
0 1.0 map20190605101829303992_auto|GC_Position 0,1 |GC_Area E(0,0) E(0,2) R(1,0) R(1,1) R(1,2)
|
||||
0 1.0 map20190605103058832675_auto|GC_Position 4,1 |GC_Area G(2,0) R(2,1) E(2,2) E(2,3) R(3,0) R(3,1) R(3,2) R(3,3) H(4,0) E(4,2) H(4,3)
|
@ -1 +1 @@
|
||||
2.195611 map20190605101829303992_auto
|
||||
2.412344 map20190605103058832675_auto
|
||||
|
@ -1,4 +0,0 @@
|
||||
from VowpalWrapper import wrapper
|
||||
|
||||
#wrapper.wrap_ex("vw ./VowpalWabbit/VowPalInputData/input_dataset06042221.txt -c --passes 2 -f ./VowpalWabbit/VowpalModels/25k_002.model")
|
||||
#wrapper.wrap_ex("vw -i ./VowpalWabbit/VowpalModels/1k_001.model -t ./VowpalWabbit/VowPalInputData/prediction_dataset.txt -p /dev/stdout --quiet")
|
@ -3,7 +3,7 @@ from config import MAP_NAME, GRID_WIDTH, GRID_HEIGHT, GC_X, GC_Y
|
||||
from VowpalWabbit.VowpalWrapper import wrapper
|
||||
|
||||
#const
|
||||
RADIUS = 1
|
||||
RADIUS = 2
|
||||
##
|
||||
|
||||
COORDINATES_LIST = []
|
||||
@ -118,7 +118,7 @@ def check_position(position, i):
|
||||
def get_predicted_move(position):
|
||||
input_filename = pass_input(position)
|
||||
output_filename = "./VowpalWabbit/VowpalDataCache/constant_output.txt"
|
||||
wrapper.wrap_ex("vw -i ./VowpalWabbit/VowpalModels/1k_001.model -t "+input_filename+" -p "+output_filename+" --quiet")
|
||||
wrapper.wrap_ex("vw -i ./VowpalWabbit/VowpalModels/25k_002.model -t "+input_filename+" -p "+output_filename+" --quiet")
|
||||
with open( output_filename, 'r' ) as fout:
|
||||
prediction = float(list(fout.readline().split())[0])
|
||||
move = make_move_from_prediction(prediction)
|
||||
|
@ -1,7 +0,0 @@
|
||||
param (
|
||||
[Parameter(Mandatory=$true)][string]$loop
|
||||
)
|
||||
|
||||
for($i = 1; $i -le $loop; $i++){
|
||||
python main.py auto true bestfs
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
import re
|
||||
from config import MAP_NAME, GRID_WIDTH, GRID_HEIGHT, GC_X, GC_Y
|
||||
|
||||
COORDINATES_LIST = []
|
||||
MOVES_LIST = []
|
||||
|
||||
with open( MAP_NAME, 'r' ) as map:
|
||||
MAP_CONTENT = map.readlines()[2:]
|
||||
MAP_CONTENT = [list(row.strip().replace(" ","")) for row in MAP_CONTENT]
|
||||
|
||||
moves_mapping = {
|
||||
"pick_garbage": 1,
|
||||
"right": 2,
|
||||
"left": 3,
|
||||
"up": 4,
|
||||
"down": 5
|
||||
}
|
||||
|
||||
def parse_list(whole_result,current_x,current_y):
|
||||
global COORDINATES_LIST, MOVES_LIST
|
||||
COORDINATES_LIST = whole_result.copy()
|
||||
moves = []
|
||||
print("x,y",current_x,current_y,"list",whole_result)
|
||||
parser = {'[0,1]':"down",'[0,-1]':"up",'[1,0]':"right",'[-1,0]':"left"}
|
||||
for x in range(len(whole_result)):
|
||||
if whole_result[x]=="pick_garbage":
|
||||
moves.append(whole_result[x])
|
||||
else:
|
||||
x_subtraction = whole_result[x][0] - current_x
|
||||
y_subtraction = whole_result[x][1] - current_y
|
||||
current_x = whole_result[x][0]
|
||||
current_y = whole_result[x][1]
|
||||
moves.append(parser[f"[{x_subtraction},{y_subtraction}]"])
|
||||
print(moves)
|
||||
MOVES_LIST = moves.copy()
|
||||
generate_input(1.0)
|
||||
return moves
|
||||
|
||||
def generate_input(importance):
|
||||
i = 0 #we'll use it to map coords to moves
|
||||
input_file_content = []
|
||||
for position in COORDINATES_LIST:
|
||||
|
||||
coords = check_position(position, i) #set valid gc position
|
||||
|
||||
#vowpal config goes here
|
||||
label = moves_mapping[MOVES_LIST[i]]
|
||||
tag = re.findall("(map_[0-9]+|map[0-9]+_auto)", MAP_NAME)[0]
|
||||
gc_position = "|GC_Position "+str(coords[0])+","+str(coords[1])
|
||||
input_line = str(label) + " " + str(importance) + " " + tag + gc_position+" |GC_Area "
|
||||
|
||||
area = get_gc_area(coords,1)
|
||||
for a in area:
|
||||
input_line += a + " "
|
||||
|
||||
i += 1
|
||||
input_file_content.append(input_line)
|
||||
|
||||
#save to file
|
||||
filename = ".\VowPalInputData\input_" + str(tag) + ".txt"
|
||||
input_file = open(filename,"w+")
|
||||
for line in input_file_content:
|
||||
input_file.write(line+"\n")
|
||||
input_file.close()
|
||||
|
||||
|
||||
def get_gc_area(position, radius):
|
||||
area = []
|
||||
for x in range(max(0, position[0] - radius), min(position[0] + radius + 1, GRID_WIDTH)): #prevents giong abroad
|
||||
for y in range(max(0, position[1] - radius), min(position[1] + radius + 1, GRID_HEIGHT)):
|
||||
if([x,y] == position): #we dont need gc data here
|
||||
continue
|
||||
area.append(MAP_CONTENT[y][x]+"("+str(x)+","+str(y)+")")
|
||||
return area
|
||||
|
||||
def check_position(position, i):
|
||||
if(type(position) is list): #if position valid, return it
|
||||
return position
|
||||
elif(position == "pick_garbage"): #if invalid, look for recent coords. if not found, return initial coords
|
||||
for j in range(i-1,-1,-1):
|
||||
if(type(COORDINATES_LIST[j]) is list):
|
||||
return COORDINATES_LIST[j]
|
||||
return [GC_X, GC_Y]
|
||||
else: #in case sh t happened
|
||||
print("An error has ocurred while processing GC position.")
|
Loading…
Reference in New Issue
Block a user