Class VoteAgent
Bases: Agent
An agent that has limited knowledge and resources and can decide to use them to participate in elections.
Source code in democracy_sim/participation_agent.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
assets
deletable
property
writable
Return the assets of this agent.
col
property
Return the col location of the agent.
position
property
Return the location of the agent.
row
property
Return the row location of the agent.
__init__(unique_id, model, pos, personality, assets=1, add=True)
Create a new agent.
Attributes:
Name | Type | Description |
---|---|---|
unique_id |
The unique identifier of the agent. |
|
model |
The simulation model of which the agent is part of. |
|
pos |
The position of the agent in the grid. |
|
personality |
Represents the agent's preferences among colors. |
|
assets |
The wealth/assets/motivation of the agent. |
Source code in democracy_sim/participation_agent.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
ask_for_participation(area)
The agent decides whether to participate in the upcoming election of a given area.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
area
|
The area in which the election takes place. |
required |
Returns:
Type | Description |
---|---|
True if the agent decides to participate, False otherwise |
Source code in democracy_sim/participation_agent.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
compute_assumed_opt_dist(area)
Computes a color distribution that the agent assumes to be an optimal choice in any election (regardless of whether it exists as a real option to vote for or not). It takes "altruistic" concepts into consideration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
area
|
Area
|
The area in which the election takes place. |
required |
Returns:
Name | Type | Description |
---|---|---|
ass_opt |
The assumed optimal color distribution (normalized). |
Source code in democracy_sim/participation_agent.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
decide_altruism_factor(area)
Uses a trained decision tree to decide on the altruism factor.
Source code in democracy_sim/participation_agent.py
144 145 146 147 148 149 150 151 152 |
|
estimate_real_distribution(area)
The agent estimates the real color distribution in the area based on her own knowledge (self.known_cells).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
area
|
Area
|
The area the agent uses to estimate. |
required |
Source code in democracy_sim/participation_agent.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
update_known_cells(area)
This method is to update the list of known cells before casting a vote.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
area
|
The area that holds the pool of cells in question |
required |
Source code in democracy_sim/participation_agent.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
vote(area)
The agent votes in the election of a given area,
i.e., she returns a preference ranking vector over all options.
(Ranking: index = option
, value proportional to rank
)
The available options are set in the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
area
|
Area
|
The area in which the election takes place. |
required |
Source code in democracy_sim/participation_agent.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|