This example shows how the smart home framework can be used to develop a community of connected smart homes. We utilise the Optimisation toolkit to compute an optimal solution for the community where agents exchange energy in order to reduce their battery usage (while maintaining their utilities). Finally, we show how the Visualisation toolkit can be used to quickly plot the optimisation results.
- Populate a smart community:
int population =10; AgentsFactory agentsPool = new AgentsFactory(); MyAgent[] agents = agentsPool.getAgents(population);
- Each agent optimises for its own utility
for (int i = 0; i < population; i++) { MyAgent agent = agents[i]; MaxUtilOptModel optimiser = new MaxUtilOptModel("optID", agent); agent.addOptInfo(optID, optimiser.optimise()); }
- Connect agents to form a community
for (int i = 0; i < population; i++) agents[i].setConnected(true);
- Now let agents exchange electricity to reduce the overall battery usage of the community
MinimizeBatteryUsage comOpt = new MinimizeBatteryUsage(agents); comOpt.optimise();
- Visualise the communal optimisation results
new CommunityVisualiser(comOpt); //See Figure 2 below.
Figure 2 demonstrates the use of visualisation toolkit to show the reduction of overall battery usage (via exchange of energy between smart homes) in a smart community.