Skip to content

Commit

Permalink
Organized inputs via importanize
Browse files Browse the repository at this point in the history
  • Loading branch information
david-istvan committed Apr 6, 2024
1 parent af0628e commit 672116a
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from enum import Enum


class Direction(Enum):
LEFT = 0
DOWN = 1
Expand Down Expand Up @@ -137,4 +138,4 @@ def __str__(self):
print(grid.cells[5].get_actions_to_me_from_all_neighbors())
print(f'me: {grid.cells[0]}')
print(grid.cells[0].get_actions_to_me_from_all_neighbors())
'''
'''
5 changes: 3 additions & 2 deletions src/parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import re
from model import Hint, HumanInput, Cell
from model import Cell, Hint, HumanInput


class Parser():

Expand All @@ -15,4 +16,4 @@ def parse(self, file):
cell = Cell(int(y), int(x), int(map_size))
hints.append(Hint(cell, int(opinion), float(u)))

return HumanInput(int(map_size), float(u), hints)
return HumanInput(int(map_size), float(u), hints)
9 changes: 5 additions & 4 deletions src/runner.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import gymnasium as gym
import logging
import numpy as np
import os
import sl
from datetime import datetime
from matplotlib import pyplot as plt
from parser import Parser
from sklearn.preprocessing import normalize
from datetime import datetime
import logging
import sl


#Constants
FILES_PATH = 'src/files'
Expand Down Expand Up @@ -172,4 +173,4 @@ def plot(no_advice_success_rates, advice_success_rates):
advice_success_rates = evaluate(initial_policy)

save_data(no_advice_success_rates, advice_success_rates)
plot(no_advice_success_rates, advice_success_rates)
plot(no_advice_success_rates, advice_success_rates)
3 changes: 2 additions & 1 deletion src/sl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import numpy as np


'''
Belief constraint fusion for two matrices with the same dimensions
'''
Expand Down Expand Up @@ -56,4 +57,4 @@ def beliefConstraintFusion(opinion1, opinion2):
print(grid.cells[5].get_actions_to_me_from_all_neighbors())
print(f'me: {grid.cells[0]}')
print(grid.cells[0].get_actions_to_me_from_all_neighbors())
'''
'''
5 changes: 3 additions & 2 deletions tests/grid_tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import unittest
from src.model import Grid, Cell, Direction
import os
import random
import unittest
from src.model import Cell, Direction, Grid


class GridTests(unittest.TestCase):

Expand Down
5 changes: 3 additions & 2 deletions tests/model_tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import unittest
from src.model import Hint, Cell
import os
import unittest
from src.model import Cell, Hint


class ModelTests(unittest.TestCase):

Expand Down
3 changes: 2 additions & 1 deletion tests/parser_tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import unittest
from src.parser import Parser
import os


class ParserTests(unittest.TestCase):

Expand Down
7 changes: 4 additions & 3 deletions tests/sl_tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import unittest
import src.sl as sl
import os
import numpy as np
import os
import unittest
from src import sl


class SLTests(unittest.TestCase):

Expand Down
1 change: 1 addition & 0 deletions tests/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from .parser_tests import ParserTests
from .sl_tests import SLTests


"""
Full test suite
"""
Expand Down

0 comments on commit 672116a

Please sign in to comment.