agents package
Subpackages
- agents.base package
- agents.base.Intermediary module
IntermediaryIntermediary.step()Intermediary.work()Intermediary.training()Intermediary.update_attributes()Intermediary.begin_jobs()Intermediary.check_job_completion()Intermediary.evaluate_system()Intermediary.share_rating()Intermediary.share_knowledge()Intermediary.get_heating()Intermediary.get_trigger()Intermediary.get_stage_dynamics()Intermediary.get_class()Intermediary.get_system_age()Intermediary.get_opinion()Intermediary.get_satisfied_ratio()Intermediary.get_preferences()Intermediary.get_attributes()Intermediary.get_comprehensive_metrics()Intermediary.get_emissions()Intermediary.get_energy_demand()Intermediary.get_obstacles()
- agents.base.Job module
- agents.base.Service module
- Module contents
- agents.base.Intermediary module
agents.EnergyAdvisor module
This module provides the implementation for the EnergyAdvisor, an intermediary agent that consults Houseowners on heating systems, subsidies, and financing. It includes the EnergyAdvisor class itself and the ConsultationServiceEnergyAdvisor class, which handles the logic of performing a consultation.
- Authors:
Sören Lohr
Ivan Digel <ivan.digel@uni-kassel.de>
Sascha Holzhauer <sascha.holzhauer@uni-kassel.de>
Dmytro Mykhailiuk <dmytromykhailiuk6@gmail.com>
- class ConsultationServiceEnergyAdvisor(intermediary=None)[source]
Bases:
ConsultationServiceA specialized consultation service provided by an EnergyAdvisor.
This service handles the process of a consultation job. When a job is completed, it evaluates heating systems based on the houseowner’s specific situation, applies relevant subsidies, filters for feasibility and affordability, and provides a tailored recommendation.
Initializes the consultation service for an EnergyAdvisor. Sets the job length specific to energy advisors.
- Parameters:
- intermediaryEnergyAdvisor, optional
The EnergyAdvisor agent providing this service. Defaults to None.
- begin_job()[source]
Begins a consultation job by adding it to active jobs and removes it from the job queue.
- complete_job(job)[source]
Completes a consultation job and provides advice to the houseowner.
This method performs the core logic of the consultation. It assesses heating systems known to the advisor, calculates house-specific costs, applies subsidies, and filters the options based on the customer’s budget. The most suitable options are then presented to the houseowner.
- Parameters:
- jobJob
The consultation job to be completed.
- class EnergyAdvisor(unique_id: int, model: Model, heating_preferences=None, known_hs=None, known_subsidies=None)[source]
Bases:
IntermediaryAn intermediary agent providing expert advice on heating systems.
The EnergyAdvisor specializes in knowledge about heating technologies and financial subsidies. It consults houseowners to help them find the most suitable and cost-effective heating solutions based on their specific needs and financial situation.
- Attributes:
- known_hslist
A list of Heating_system objects the advisor is knowledgeable about.
- heating_preferencesHeating_preferences
The preferences used by the advisor to evaluate heating systems.
- known_subsidieslist
A list of Subsidy objects the advisor is aware of.
- infeasiblelist
A list of heating system names considered infeasible by this advisor.
- perceived_uncertaintydict
A mapping of heating system names to perceived uncertainty values.
- known_subsidies_by_hsdict
A dictionary organizing known subsidies by the heating systems they apply to.
- Serviceslist
A list of services offered by the advisor.
Initializes an EnergyAdvisor agent.
- Parameters:
- unique_idint
The unique identifier for the agent.
- modelModel
The main MESA model instance.
- heating_preferencesHeating_preferences, optional
The agent’s preferences for evaluating heating systems.
- known_hslist, optional
A list of known heating systems.
- known_subsidieslist, optional
A list of known subsidies.
- evaluate_system(system)[source]
Evaluates a heating system based on the advisor’s preferences.
This method extends the base evaluate_system from the Intermediary class. It can be modified to include advisor-specific evaluation criteria.
- Parameters:
- systemHeating_system
The heating system to be evaluated.
- Returns:
- float
The calculated rating for the system.
Shares detailed, house-specific knowledge about heating systems.
The advisor calculates house-specific parameters for its known systems and updates the houseowner’s knowledge base. New systems are added, and existing ones are updated with the advisor’s expert data.
- Parameters:
- agentHouseowner
The houseowner agent to share knowledge with.
Shares the advisor’s ratings of heating systems with a houseowner.
This method updates the houseowner’s neighbours_opinions for each system, effectively influencing the houseowner’s perception of those systems.
- Parameters:
- agentHouseowner
The houseowner to share ratings with.
- systems_listlist
The list of Heating_system objects whose ratings are to be shared.
agents.House module
Defines the House agent for the simulation.
This module contains the House class, a GeoAgent that represents a physical building in the model. It holds attributes like construction year, area, and energy demand, and is directly linked to a Houseowner agent and a Heating_system. It also includes an Enum for different heating terminal types.
- Authors:
Ivan Digel <ivan.digel@uni-kassel.de>
Sascha Holzhauer <sascha.holzhauer@uni-kassel.de>
- class House(unique_id, model, geometry, crs, current_heating=None)[source]
Bases:
GeoAgentA GeoAgent representing a single residential building in the model.
This agent models the physical characteristics of a building, including its geographical footprint, age, size, and energy requirements. Each house is associated with a Houseowner agent and contains the currently installed heating system.
- Attributes:
- milieu_tableMilieu_table
A table containing parameters for different socio-economic milieus.
- milieuMilieu
The milieu associated with the house’s owner.
- yearint
The year the house was constructed.
- areafloat
The living area of the house in square meters.
- energy_demandfloat
The annual energy demand for heating in kWh per sq.m. per year.
- current_heatingHeating_system
The heating system currently installed in the house.
- houseownerHouseowner
The Houseowner agent who owns and lives in the house.
- subareastr
The name of the geographical subarea where the house is located.
- heat_loadfloat
The heating load of the house in kW.
Initializes a House agent.
- Parameters:
- unique_idint
A unique identifier for the agent, typically provided by MESA-Geo.
- modelmesa.Model
The main model instance.
- geometryshapely.geometry.BaseGeometry
A Shapely object representing the house’s geographical footprint.
- crsstr or pyproj.CRS
The coordinate reference system of the geometry.
- current_heatingHeating_system, optional
The heating system to be installed initially. Defaults to None.
- set_house_owner(houseowner)[source]
Assigns a Houseowner agent to this house.
- Parameters:
- houseownerHouseowner
The Houseowner agent to be linked to this house.
- knockknock()[source]
Returns the owner of the house.
- Returns:
- Houseowner
The Houseowner agent associated with this house.
- generate_area_distribution(mean, deviation)[source]
Generates a living area value from a normal distribution.
This method is used for initializing house areas when specific data is not available.
- Parameters:
- meanfloat
The mean living area in square meters.
- deviationfloat
The standard deviation from the mean in square meters.
- Returns:
- float
A randomly generated value for the living area.
- generate_energy_demand_distribution(mean, deviation)[source]
Generates an energy demand value from a normal distribution.
This method is used for initializing energy demand when specific data is not available.
- Parameters:
- meanfloat
The mean energy demand in kWh per square meter per year.
- deviationfloat
The standard deviation from the mean.
- Returns:
- float
A randomly generated value for the energy demand.
- define_energy_demand(year, heat_demand)[source]
Sets the specific energy demand based on construction year and data source.
This method calculates the energy demand (in kWh/m²/a) based on one of two modes defined in the model settings: - ‘eqcity’: Uses a predefined lookup table based on building age classes. - ‘ubem’: Calculates the demand by dividing the total annual heat demand
by the house’s area.
- Parameters:
- yearint
The construction year of the house.
- heat_demandfloat
The total annual heat demand of the house in kWh, used in ‘ubem’ mode.
- Returns:
- float
The calculated specific energy demand in kWh per square meter per year.
agents.Houseowner module
Defines the Houseowner agent, the central decision-making entity.
This module contains the Houseowner class, which represents a household agent responsible for decisions regarding their heating system. The agent’s behavior is driven by psychological, social, and economic factors, and follows a structured decision-making process based on Bamberg’s Stage Model of Self-Regulated Behavioural Change. The Houseowner interacts with other agents like Plumbers, Energy Advisors, and neighbors.
- Authors:
Ivan Digel <ivan.digel@uni-kassel.de>
Sascha Holzhauer <sascha.holzhauer@uni-kassel.de>
Dmytro Mykhailiuk <dmytromykhailiuk6@gmail.com>
Sören Lohr
- class Houseowner(unique_id, house, model, income, milieu, cognitive_resource, aspiration_value, known_hs, suitable_hs, desired_hs, hs_budget, current_breakpoint, current_stage, satisfaction, active_trigger, geometry, crs)[source]
Bases:
NetworkedGeoAgentAn agent representing a houseowner who decides on heating system replacement.
The Houseowner is a NetworkedGeoAgent that models the complex decision-making process of replacing a home heating system. Its behaviour is influenced by personal preferences, budget, social norms, cognitive limitations, and external triggers (e.g., system breakdown). The agent progresses through distinct stages of decision-making.
Initialising a houseowner agent.
- Parameters:
- active_trigger: Trigger
A Trigger object representing an event that impacts the agent’s decision-making.
- aspiration_value: int
Used to define the number of options the agent gets during data gathering before it “feels” satisfied.
- attribute_ratings: dict
Accumulated satisfaction scores of the agent for each system and parameter.
- behavioural_control_switched: bool
Boolean indicating whether behavioural control was updated after installation.
- budget_limit: float
Maximum amount the agent is willing or able to invest in a heating system.
- cognitive_resource: int
The actual amount of effort the agent can allocate in a step; this value may be modified.
- comprehensive_metrics: dict
Stores attribute-wise evaluations of heating systems made by the agent.
- consultation_ordered: bool
A boolean indicating whether a consultation has already been ordered.
- consulted_by_energy_advisor: bool
Indicates whether the agent has already consulted with an energy advisor.
- crs: str
A coordinate reference system used by the agent (e.g. “epsg:4647”).
- current_breakpoint: str
The breakpoint in the decision-making sequence that the agent is currently located at.
- current_stage: str
The current decision-making stage of the agent.
- desired_hs: Heating_system
An instance of a Heating_system that is desirable for the replacement.
- energy_advisor: Agent
A reference to the energy advisor agent object.
- evaluation_factors: dict
Collects values for opinions related to each TPB factor for data collector.
- geometry: shapely
The geographic location of the agent; used for social network generation.
- house: House
Represents the house of the houseowner.
- hs_budget: int
The amount of money the houseowner uses for the heating system replacement.
- income: int
Increases the budget of the houseowner at each step.
- infeasible: list
A list of heating system names that are not feasible for installation in the agent’s context.
- information_sources: Any
Collection of information sources contacted by the agent for the data collector.
- initial_aspiration_value: float
Baseline aspiration threshold, stored for potential resetting.
- initial_cognitive_resource: int
The base cognitive resource level used to refill the effort pool at the beginning of each step.
- installed_once: bool
Indicates whether the agent has replaced its heating system at least once.
- installation_ordered: bool
A boolean indicating whether an installation has already been ordered.
- known_hs: list
A list of heating systems the agent has learned about through information gathering or social interactions.
- known_subsidies_by_hs: dict
Maps heating systems to related subsidies the agent is aware of.
- loan_taking: bool or None
Indicates whether the agent would consider taking a loan for system purchase.
- milieu: Milieu
An instance of the Milieu class. Contains preferences, TPB, and RA-relative variables.
- meeting_prob: float
A probability that an idle agent will meet someone instead of idling.
- neighbours_satisfaction: dict
Dictionary mapping neighbour IDs their satisfaction on heating systems.
- neighbours_systems: dict
Known heating systems of neighbouring agents.
- overload_base: int
Value defining the agent’s initial cognitive overload value.
- overload_value: int
Value defining the agent’s cognitive overload threshold.
- plumber: str
An identifier for the plumber agent who will perform consultations and installations.
- ra_exposure: float
Exposure to others’ opinions, used in the relative agreement process.
- recommended_hs: Heating_system
A recommended system provided by an intermediary.
- risk_tolerance: float
Value representing how risk-tolerant the agent is when selecting a system.
- satisfaction: str
Indicates whether the agent is satisfied with its current heating system. Has only two possible values.
- source_preferences: Information_source_preferences
Probabilities associated with choosing various types of information sources.
- stage_counter: int
Counter used to track the number of decision-making stages completed.
- stage_history: str
A string recording all decision-making stages the agent passed through.
- standard: Personal_standard
A threshold object defining which heating systems are personally acceptable to the agent.
- steps: int
Duplicates steps counter of the model, used for some data collection steps.
- subsidy_curious: bool
Boolean indicating whether the agent is interested in learning about subsidies.
- suitable_hs: list
A subset of known_hs deemed acceptable by the agent’s evaluation process.
- tpb_weights: dict
Weights for TPB components: attitude, perceived behavioural control, and social norms.
- trigger_to_report: Trigger or None
Stores the trigger that will be reported to the data collector.
- unique_id: str
A unique identifier, typically in the format “Houseowner *”, where * corresponds to the house_id.
- unqualified_plumbers: list
List of plumber IDs the agent will avoid calling again during a full decision cycle.
- uncertainty_factor: float
USed during risk calculation to define the attitude towards unknown information
- visited_neighbours: set
Neighbours the agent has interacted with to gather heating system information during one full decision cycle.
- waiting: int
Counts waiting time for an installation.
- weekly_expenses: float
Opex + fuel costs tracked reported to the data collector.
- step()[source]
Executes the agent’s actions for a single simulation step.
This method handles the agent’s behaviour. It refills cognitive resources, manages the budget, checks for triggers, and, if a decision process is active, proceeds through the relevant stages. If not in a decision process, the agent may engage in social interactions.
- evaluate()[source]
Assesses satisfaction with the current heating system.
The agent checks if their current heating system still meets their personal standard. If not, they become ‘Dissatisfied’ and move to the next decision-making stage (‘Goal’ breakpoint). Otherwise, they remain ‘Satisfied’ and exit the decision process for this step.
- get_data()[source]
Gathers information about heating systems from various sources.
The agent chooses an information source based on their milieu-specific preferences. They then perform a data search, which consumes cognitive resources. The process stops when the agent’s aspiration level is met, they run out of cognitive resources, or they are waiting for a scheduled consultation.
- define_choice()[source]
Filters known heating systems to create a list of suitable options.
The agent evaluates all known heating systems against several criteria: - Technical feasibility (not in the infeasible list). - Affordability of installation, either directly from their budget or
with the help of a potential loan.
Affordability of running costs relative to their income.
Risk tolerance, filtering out options perceived as too risky.
Systems that pass these checks are added to the suitable_hs list.
- compare_hs()[source]
Compares suitable heating systems and selects the most desired one.
Using the Theory of Planned Behaviour, the agent calculates an integral rating for each system in suitable_hs. The system with the highest rating is chosen as the desired_hs. A tie-breaking rule is applied if the top two options have very similar ratings.
- install()[source]
Manages the process of ordering and installing a heating system.
The agent finds a qualified plumber for their desired_hs, checks for excessive queue times, and confirms final affordability. If all checks pass, they order a consultation (which leads to installation) from the plumber and wait. If any issues arise (e.g., the system is found to be infeasible), the agent may reconsider their choice or exit the process.
- calculate_satisfaction()[source]
Evaluates satisfaction with the newly installed heating system.
After installation, the agent compares the actual performance and costs of the new system with their prior expectations. They also assess if their choice was suboptimal compared to other suitable alternatives they knew of. This determines their new satisfaction state.
- trigger_check()[source]
Checks for internal or environmental events that trigger a decision process.
- meet_agent()[source]
The agent meets another random agent and exchanges knowledge and opinions. In case the other agent is a successor, the focal agent influences this successor, in case the other agent is a predecessor, the predecessor influences the focal agent. Simulates random social interactions.
- ask_neighbours(coverage)[source]
Asks neighbour about their systems as long as there is cognitive resource and neighbours not visited during this decision-making cycle. * Transfer knowledge of predecessors’ current HS to this agent. * Influence this agent’s opinion about predecessors’ known HS. * Append predecessors’ known HS to this agent in case this agent does not know it yet. * Transfer predecessors’ knowledge about subsidies to this agent. * Add or update this agents predecessors’ rating with predecessors’ rating
- Parameters:
- coverageint
The maximum number of neighbors to contact.
Shares the final installation decision with neighbours. Works as a propagation mechanism. Turned of by default in settings.toml.
This agent shares his opinion about his current HS with another houseowner The method about sharing knowledge is down below, and always goes before this one.
- Parameters:
- neighbourHouseowner
The agent to share the satisfaction information with.
The agent shares the knowledge about their known heating systems with a neighbour. It also influences neighbours’s opinion on other known systems. Also shares known subsidies.
- Parameters:
- counterpart: Houseowner
A houseowner to share the knowledge about known HS.
This agent receives the knowledge about a neighbour’s current heating system.
- Parameters:
- neighbourHouseowner
The agent to share the system name with.
Shares the ratings of all known heating systems with a neighbor.
This method updates the neighbor’s neighbours_opinions attribute, influencing their social norm calculation.
- Parameters:
- neighbourHouseowner
The agent to share ratings with.
- relative_agreement(new_system)[source]
Updates the agent’s knowledge using the Relative Agreement model.
This method is called when the agent receives new information about an already known known heating system, adjusting their own knowledge based on the new data.
- Parameters:
- new_systemHeating_system
An instance of a heating system containing new information.
- find_plumber_with_desired_hs()[source]
Finds a plumber qualified to install the desired heating system.
It searches for a plumber who has the desired_hs in their list of known systems. If no qualified plumber is found, the system may be marked as infeasible for the agent.
- order_installation()[source]
The agent orders a consultation from his plumber regarding installation
- investigate_house()[source]
Updates the agent’s knowledge about their own house and heating system.
This method ensures the agent’s current heating system is in their known_hs list and checks for events like system breakdowns.
- generate_system(variant)[source]
Creates an instance of a heating system from its class name.
- Parameters:
- variantstr
The class name of the heating system to be created.
- Returns:
- Heating_system
An instance of the specified heating system class.
- calculate_attitude(system)[source]
Calculates the agent’s attitude towards a specific heating system.
This method generates a rating based on how well the system’s attributes align with the agent’s personal preferences. This represents the ‘Attitude’ component of the TPB.
- Parameters:
- systemHeating_system
The heating system to be evaluated.
- calculate_social_norm(system)[source]
Calculates the perceived social norm related to a heating system.
The social norm is derived from the opinions of the agent’s neighbours and the prevalence of the system within their social network. This represents the ‘Social Norm’ component of the TPB.
- Parameters:
- systemHeating_system
The heating system for which to calculate the social norm.
- calculate_PBC(system)[source]
Calculates the Perceived Behavioural Control (PBC) for a system.
PBC is determined by the system’s affordability, considering both the upfront installation cost relative to the agent’s budget and the ongoing running costs relative to their income. This represents the ‘Perceived Behavioural Control’ component of the TPB.
- Parameters:
- systemHeating_system
The heating system for which to calculate the PBC.
- calculate_integral_rating()[source]
Combines attitude, social norm, and PBC into a single utility score.
This method weighs and sums the three components of the TPB to create an overall rating for each suitable heating system, which is then used to make the final installation choice.
- Returns:
- dict
A dictionary mapping Heating_system instances to their integral rating.
- check_standard(system)[source]
Checks if a heating system meets the agent’s personal standard.
The agent’s standard is a set of minimum criteria. A system must meet these criteria to be considered satisfactory. They also depend on the Milieu.
- Parameters:
- systemHeating_system
The heating system to check.
- Returns:
- bool
True if the system meets the standard, False otherwise.
- find_loan(system, bypass_avoidance=False)[source]
Attempts to secure a loan to cover the cost of a heating system.
If a system’s price exceeds the agent’s budget, this method calculates whether a viable loan can be obtained based on the agent’s income and the system’s lifetime.
- Parameters:
- systemHeating_system
The system for which to find a loan.
- bypass_avoidancebool, optional
If True, ignores the agent’s general unwillingness to take a loan. Defaults to False.
- apply_subsidies(system)[source]
Applies any known subsidies to a heating system to reduce its price.
- Parameters:
- systemHeating_system
The system to which subsidies will be applied.
- get_satisfied_ratio()[source]
Returns the satisfaction ratio associated with the current heating system.
- get_opex()[source]
Returns the total annual operational and fuel costs for the current heating system.
- get_optimality()[source]
Calculates and stores the suboptimality of the agent’s most recent choice.
Suboptimality is calculated as the ratio of the rating of the chosen system to the rating of the best-rated system known to the agent at the time of the decision. A value of 1.0 indicates an optimal choice.
- get_comprehensive_metrics()[source]
Returns detailed TPB metrics for data collection once at after the first installation.
- store_evaluations()[source]
Stores detailed evaluation data when a non-target HS is chosen.
This method is used for data collection to analyze why an agent might prefer a non-target heating system over a scenario-promoted target system. It saves the agent’s ratings for both the chosen system and the target systems at the moment of decision.
agents.Plumber module
Defines the Plumber agent and its consultation and installation services.
This module contains the Plumber class, an intermediary agent responsible for consulting houseowners about heating system options and installing new systems. It includes two service classes, ConsultationServicePlumber and InstallationServicePlumber, which manage the respective job queues and the logic for these tasks.
- Authors:
Ivan Digel <ivan.digel@uni-kassel.de>
Dmytro Mykhailiuk <dmytromykhailiuk6@gmail.com>
Sascha Holzhauer <sascha.holzhauer@uni-kassel.de>
- class ConsultationServicePlumber(intermediary=None)[source]
Bases:
ServiceA service for handling heating system consultations by a Plumber.
When a consultation job is completed, this service triggers the Plumber’s consultation method, where the Plumber shares knowledge, provides recommendations, or performs a feasibility check on a desired heating system.
Initializes the consultation service for a Plumber. Sets plumber-specific default job duration.
- class InstallationServicePlumber(intermediary=None)[source]
Bases:
ServiceA service for managing and executing heating system installations.
This service manages the queue for installation jobs. It has a custom queue_job method to handle variable installation times. When a job is completed, it triggers the Plumber’s installation method to finalise the process in the simulation.
Initializes the installation service for a Plumber.
- class Plumber(unique_id, model, heating_preferences, standard, current_heating, cognitive_resource, aspiration_value, known_hs, suitable_hs, desired_hs, hs_budget, current_breakpoint, current_stage, satisfaction, active_trigger, active_jobs: dict = None, completed_jobs: dict = None, max_concurrent_jobs: int = 1, active_jobs_counter: int = 0, known_subsidies=None)[source]
Bases:
IntermediaryAn intermediary agent who consults on and installs heating systems.
The Plumber agent models a trade professional who interacts directly with Houseowners. Plumbers have their own knowledge base of heating systems, which can be expanded through training. They provide consultations to help Houseowners choose a system and are responsible for the entire installation process, from feasibility checks to final implementation.
Initializes a Plumber agent.
- Parameters:
- unique_idint
The unique identifier for the agent.
- modelmesa.Model
The main model instance.
- heating_preferencesHeating_preferences
The agent’s preferences for evaluating heating systems.
- known_hslist
A list of known Heating_system objects.
- known_subsidieslist
A list of known Subsidy objects.
Notes
Many parameters are inherited from the Houseowner class for data collector compatibility and may not be directly used in the Plumber’s logic.
- suboptimality
Plumber specific parameters below
- check_job_completion(steps)[source]
Checks for and finalises any jobs scheduled for completion at the current step.
- Parameters:
- stepsint
The current simulation step.
- estimate_queue_time(q_type)[source]
Estimates the total waiting time for a given service queue.
- Parameters:
- q_typestr
The name of the service queue (‘Consultation’ or ‘Installation’).
- Returns:
- int
The estimated total duration in steps for all jobs in the queue.
- training(system=None)[source]
Expands the Plumber’s knowledge by learning about a new heating system.
- consultation(job)[source]
Performs a consultation for a houseowner.
This method has two main paths: 1. If the houseowner has no desired system, the Plumber shares knowledge
about various systems and provides a recommendation.
If the houseowner has a desired system, the Plumber checks its feasibility, verifies the houseowner’s ability to afford it (including subsidies and loans), updates the final costs, and, if successful, queues an installation job.
- Parameters:
- jobJob
The consultation job containing the customer information.
- recommend(agent)[source]
Recommends the best-rated heating system to a houseowner.
The recommendation is based on the Plumber’s own evaluation of the systems they know.
- Parameters:
- agentHouseowner
The houseowner to whom the recommendation is given.
- installation(job)[source]
Performs the installation of a new heating system for a client.
This method is called when an installation job is completed. It finalises the installation, updates the model’s state (e.g., counters), and deducts the cost from the houseowner’s budget.
- Parameters:
- jobJob
The installation job containing the customer information.
- generate_system(variant)[source]
Creates an instance of a heating system from its class name.
- Parameters:
- variantstr
The class name of the heating system to create.
- Returns:
- Heating_system
An instance of the specified heating system.
- install_system(agent, heating)[source]
Replaces the agent’s old heating system with a new one.
This is the core logic for the installation, where the houseowner’s current_heating is updated, along with all relevant financial and environmental metrics in the model.
- Parameters:
- agentHouseowner
The houseowner receiving the new system.
- heatingstr
The class name of the heating system to install.
- evaluate_system(system)[source]
Rates a heating system based on the Plumber’s own preferences.
- Parameters:
- systemHeating_system
The heating system to evaluate.
Shares knowledge of other clients’ systems with a houseowner.
- Parameters:
- agentHouseowner
The agent to share information with.
Shares the Plumber’s ratings of known systems with a houseowner.
- Parameters:
- agentHouseowner
The agent to share ratings with.
Shares attribute knowledge about systems with a houseowner.
- Parameters:
- agentHouseowner
The agent to share knowledge with.
- modify_agent_income(agent, old_system, new_system)[source]
Adjusts a houseowner’s weekly net income after a new system is installed.
The income is modified based on the difference in weekly running costs (fuel and opex) between the old and new heating systems.
- Parameters:
- agentHouseowner
The agent whose income is being modified.
- old_systemHeating_system
The previously installed heating system.
- new_systemHeating_system
The newly installed heating system.
- check_affordability(agent)[source]
Verifies if a houseowner can afford a new heating system.
Checks both the upfront installation cost against the agent’s budget (including loans) and the ongoing running costs against the agent’s income.
- Parameters:
- agentHouseowner
The agent whose affordability is being checked.
- Returns:
- bool
True if the agent can afford the system, False otherwise.
- organize_subsidies()[source]
Structures known subsidies into a dictionary for easy lookup. Sorts subsidies by the type of heating system they are applied to.