-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagents.py
More file actions
40 lines (34 loc) · 908 Bytes
/
agents.py
File metadata and controls
40 lines (34 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import mesa
from typing import List, Optional
class Household(mesa.Agent):
def __init__(
self,
uid: int,
model: mesa.Model,
# Parameters
wealth: int,
income: int,
my_rent: int,
my_mortgage: int,
rents_paid: List[House],
houses_owned: List[House]
):
super().__init__(uid, model)
self.wealth = wealth
self.income = income
self.my_rent = my_rent
self.my_mortgage = my_mortgage
class House(mesa.Agent):
def __init__(
self,
uid: int,
model: mesa.Model,
# Parameters
price_to_buy: int,
price_to_rent: int,
owned_by: Optional[Household],
rented_to: Optional[Household],
):
super().__init__(uid, model)
self.price_to_buy = price_to_buy
self.price_to_rent = price_to_rent