-2

I'm having an issue with creating this main file with a custom environment for open-AI. So I have created the environment and everything installs OK but when i try to run it it shows the error in the title. Here is the Main file.

class Params():
    def __init__(self, master):
        self.master = master
        self.lr = 0.001
        self.gamma = 0.99
        self.tau = 1.
        self.seed = 1
        self.num_processes = 16
        self.num_step = 20
        self.max_episode_length = 10000
        self.env_name = 'SolitaireEnv-v1'

os.environ['OMP_NUM_THREADS'] = '1'
params = Params()
torch.manual_seed(params.seed)
env = gym.make(params.env_name)
shared_model = ActorCritic(env.observation_space.shape[0], env.action_space)
shared_model.shared_memory()
optimiser = Optimiser.SharedAdam(shared_model.parameters(), lr=params.lr)
optimiser.shared_memory()
processes = []
p = sp.Process(target = Testing, args=(params.num_processes, params, shared_model))
p.start()
processes.append(p)
for rank in range(0, params.num_processes):
    p = sp.Porcess(target=train, args=(rank, params, shared_model, optimiser))
    p.start()
    processes.append(p)
for p in processes:
    p.join()

Below is the __init__function it is using

def __init__(self, master):
    self.master = master

    self.canvas = Canvas(self.master,
                         background=BACKGROUND,
                         highlightthickness=0,
                         width=NROWS*XSPACING,
                         height=3*YSPACING + 20 + MARGIN)
    self.canvas.pack(fill=BOTH, expand=TRUE)


    self.dealbutton = Button(self.canvas,
                             text="Deal",
                             highlightthickness=0,
                             background=BACKGROUND,
                             activebackground="green",
                             command=self.deal)
    Window(self.canvas, MARGIN, 3*YSPACING + 20,
           window=self.dealbutton, anchor=SW)

    x = MARGIN
    y = MARGIN

    self.deck = Deck(x, y, self)

    x = x + XSPACING
    self.opendeck = OpenStack(x, y, self)

    x = x + XSPACING
    self.suits = []
    for i in range(NSUITS):
        x = x + XSPACING
        self.suits.append(SuitStack(x, y, self))

    x = MARGIN
    y = y + YSPACING

    self.rows = []
    for i in range(NROWS):
        self.rows.append(RowStack(x, y, self))
        x = x + XSPACING

    self.openstacks = [self.opendeck] + self.suits + self.rows

    self.deck.fill()
    self.deal()

I'm not sure what else you guys might need but to try help this is the file found (https://svn.python.org/projects/python/trunk/Demo/tkinter/guido/solitaire.py) here i'm using it to attempt to make an AI that will play the game any help would be great as I have hit a wall and not sure where to go form here.

I am also aware there is a question similar but after looking at it, it did not help with the situation I am having.

Barmar
  • 741,623
  • 53
  • 500
  • 612
Marc Leese
  • 31
  • 1
  • 6

1 Answers1

1

Your class Params takes one positional argument, master, as you can see in the __init__() function.

You call it as params = Params(), it should be params = Params(master) where you have an existing value/object for master.

berkelem
  • 2,005
  • 3
  • 18
  • 36