Building Optimization with Dask

This notebook uses Dask to parrallize the NSGAII alogrithm. Most of this notebook is copied from the “BuildingOptimization” notebook. But, this notebook will skip over concepts unrelated to Dask. Go to examples/Optimization/BuildingOptimization.ipynb for more details about the notebook.

Setup dask

To use Dask setup the scheduler and the workers by runnning the cell below. The client object is used to get and set various dask settings such as the number of workers.

If you’re running this notebook locally, you should be able to open the dashboard using the link provided by client.

import pandas as pd
from besos import eppy_funcs as ef
from besos.evaluator import EvaluatorEP
from besos.optimizer import NSGAII
from besos.parameters import RangeDescriptor, expand_plist, wwr
from besos.problem import EPProblem
from matplotlib import pyplot as plt

from dask.distributed import Client
client = Client()
client

Client

Cluster

  • Workers: 4
  • Cores: 16
  • Memory: 68.72 GB

Building Optimization setup

building = ef.get_building("in.idf")  # Load the E+ model in.idf
parameters = []
parameters = expand_plist(  # Use helper function to make parameter list
    {
        "Building 1": {"North Axis": (0, 359)}  # Name from IDF Building object
    }  # Change orientation from North
)

parameters.append(
    wwr(RangeDescriptor(0.1, 0.9))
)  # Add window-to-wall ratio as a parameter between 0.1 and 0.9 using a custom function
objectives = [
    "DistrictCooling:Facility",
    "DistrictHeating:Facility",
]  # Use Heating and Cooling (Ideal air loads) as objectives
problem = EPProblem(
    parameters, objectives
)  # Make a problem instance from the parameters and objectives

Set up EnergyPlus evaluator

The Energy Plus evaluator must have more then one process to enable multiprocessing. This disables the caching functionality of the evaluator which is incompatible with multiprocessing.

In this cell, a evaluator is created and one simulation is run as a test

evaluatorEP = EvaluatorEP(
    problem, building
)  # outputdir must exist; E+ files will be written there
runs = pd.DataFrame.from_dict(
    {"0": [180, 0.5]}, orient="index"
)  # Make a dataframe of runs with one entry for South and 50% glazing
outputs = evaluatorEP.df_apply(runs)  # Run this as a test
outputs
HBox(children=(FloatProgress(value=0.0, description='Executing', max=1.0, style=ProgressStyle(description_widt…
DistrictCooling:Facility DistrictHeating:Facility
0 3.233564e+09 4.931726e+09

Run the Genetic Algorithm

Run the genetic algorithm. Because the evaluator was created with more then one process the algorithm will also use multiprocessing For each iteration of the algorithm, the evaluator will be run in parrallel for each worker available (indicated by the Dask client objct).

You might also see a bunch of warnings along the lines of “..full garbage collections…”. I’m not sure exactly what’s causing them, but restarting the workers from time to time will help minimize the warnings ~ goh.

%%time
results = NSGAII(
    evaluatorEP, evaluations=20, population_size=50
)  # Run the optimizer using this evaluator for a population size of 20 for 10 generations
results
distributed.utils_perf - WARNING - full garbage collections took 45% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 47% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
CPU times: user 1min 3s, sys: 4.18 s, total: 1min 7s
Wall time: 4min 7s
North Axis RangeDescriptor [0.1, 0.9] DistrictCooling:Facility DistrictHeating:Facility violation pareto-optimal
0 185.776100 0.353001 3.299008e+09 4.145587e+09 0 False
1 302.616278 0.357080 4.492382e+09 3.178236e+09 0 False
2 357.881573 0.417220 4.252703e+09 2.971660e+09 0 False
3 318.789198 0.619431 4.515414e+09 4.113096e+09 0 False
4 116.627308 0.255334 3.945018e+09 3.406040e+09 0 False
5 179.041881 0.346952 3.289769e+09 4.090404e+09 0 True
6 292.348133 0.230552 4.464996e+09 2.697558e+09 0 False
7 63.405971 0.681622 4.464229e+09 4.845231e+09 0 False
8 159.302732 0.884252 3.304519e+09 7.042295e+09 0 False
9 233.319645 0.531068 3.862126e+09 4.928508e+09 0 False
10 317.393564 0.267833 4.466553e+09 2.607315e+09 0 False
11 283.461306 0.152892 4.434478e+09 2.417877e+09 0 True
12 99.583825 0.435070 4.138238e+09 4.144357e+09 0 False
13 49.225132 0.349209 4.377286e+09 3.092534e+09 0 False
14 288.472688 0.382792 4.465241e+09 3.448346e+09 0 False
15 329.108271 0.645800 4.456009e+09 4.099000e+09 0 False
16 50.195915 0.866635 4.551903e+09 5.479289e+09 0 False
17 210.572506 0.888632 3.471494e+09 6.994228e+09 0 False
18 184.454098 0.518929 3.236251e+09 5.036662e+09 0 True
19 174.267016 0.427074 3.264280e+09 4.545811e+09 0 True
20 252.540733 0.656217 4.181011e+09 5.321051e+09 0 False
21 302.201466 0.896391 4.672628e+09 5.594312e+09 0 False
22 124.382733 0.494536 3.825302e+09 4.767670e+09 0 False
23 119.974415 0.592035 3.894867e+09 5.239706e+09 0 False
24 178.476627 0.753352 3.180076e+09 6.324077e+09 0 True
25 269.798520 0.863290 4.477345e+09 6.060096e+09 0 False
26 133.641054 0.231303 3.741608e+09 3.380020e+09 0 True
27 66.694455 0.332381 4.357801e+09 3.231942e+09 0 False
28 261.276399 0.864170 4.366523e+09 6.217055e+09 0 False
29 158.620394 0.785458 3.316553e+09 6.445114e+09 0 False
30 33.185551 0.559418 4.364980e+09 3.834610e+09 0 False
31 138.406173 0.517423 3.620525e+09 4.974065e+09 0 False
32 9.524386 0.363510 4.252663e+09 2.788570e+09 0 False
33 257.454524 0.838579 4.302356e+09 6.155393e+09 0 False
34 48.913051 0.625470 4.440216e+09 4.334366e+09 0 False
35 89.665634 0.368049 4.226979e+09 3.718817e+09 0 False
36 262.186543 0.892571 4.389137e+09 6.331728e+09 0 False
37 337.080151 0.738259 4.417115e+09 4.404907e+09 0 False
38 335.123754 0.457393 4.378106e+09 3.251594e+09 0 False
39 35.568998 0.369149 4.346453e+09 3.052242e+09 0 False
40 118.222619 0.111268 3.972710e+09 2.642617e+09 0 True
41 194.870262 0.269097 3.398012e+09 3.661537e+09 0 True
42 268.644059 0.289389 4.326958e+09 3.253844e+09 0 False
43 259.373814 0.109784 4.265041e+09 2.456193e+09 0 True
44 143.579972 0.880771 3.538785e+09 6.927461e+09 0 False
45 327.351965 0.320933 4.421512e+09 2.715070e+09 0 False
46 57.293770 0.251815 4.372450e+09 2.759303e+09 0 False
47 30.016000 0.731106 4.398072e+09 4.538127e+09 0 False
48 357.390705 0.424253 4.253470e+09 3.019063e+09 0 False
49 351.282493 0.806708 4.333586e+09 4.619043e+09 0 False

Compare with sequential processing. The performance difference will be greater if your machine has more cores.

%%time
evaluatorEP = EvaluatorEP(problem, building)

results2 = NSGAII(
    evaluatorEP, evaluations=20, population_size=50
)  # Run the optimizer using this evaluator for a population size of 20 for 10 generations
results2
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 48% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 49% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 51% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
distributed.utils_perf - WARNING - full garbage collections took 50% CPU time recently (threshold: 10%)
CPU times: user 1min 8s, sys: 4.16 s, total: 1min 12s
Wall time: 4min 15s
North Axis RangeDescriptor [0.1, 0.9] DistrictCooling:Facility DistrictHeating:Facility violation pareto-optimal
0 135.878440 0.482178 3.660522e+09 4.762800e+09 0 False
1 47.076682 0.112137 4.393010e+09 2.010078e+09 0 False
2 139.493753 0.123566 3.724126e+09 2.802771e+09 0 True
3 241.508884 0.380535 3.994330e+09 4.014440e+09 0 False
4 235.344160 0.217869 3.936100e+09 3.223223e+09 0 False
5 210.173345 0.223443 3.589242e+09 3.366236e+09 0 True
6 226.066092 0.784308 3.743001e+09 6.280228e+09 0 False
7 4.845519 0.112575 4.314000e+09 1.735766e+09 0 True
8 244.913777 0.300808 4.049611e+09 3.580451e+09 0 False
9 310.942611 0.796864 4.614292e+09 5.026246e+09 0 False
10 167.586632 0.504777 3.274791e+09 4.949670e+09 0 True
11 274.675446 0.428415 4.390682e+09 3.855448e+09 0 False
12 155.760700 0.642617 3.365027e+09 5.688621e+09 0 False
13 275.012669 0.290556 4.379124e+09 3.177993e+09 0 False
14 188.442750 0.811415 3.201725e+09 6.646730e+09 0 True
15 135.793694 0.750514 3.660092e+09 6.199627e+09 0 False
16 171.368925 0.726102 3.205939e+09 6.167401e+09 0 True
17 275.020951 0.786473 4.500315e+09 5.595977e+09 0 False
18 218.949469 0.181659 3.724017e+09 3.118466e+09 0 True
19 294.615153 0.592069 4.539597e+09 4.360452e+09 0 False
20 46.864371 0.480544 4.395941e+09 3.675910e+09 0 False
21 212.879935 0.603185 3.523357e+09 5.412081e+09 0 False
22 59.703312 0.531362 4.417345e+09 4.102048e+09 0 False
23 159.225752 0.716507 3.314900e+09 6.076146e+09 0 False
24 96.636762 0.609308 4.208709e+09 5.031277e+09 0 False
25 111.653628 0.325606 3.996102e+09 3.736321e+09 0 False
26 151.942820 0.413124 3.456445e+09 4.442461e+09 0 False
27 164.977461 0.471978 3.302327e+09 4.800078e+09 0 False
28 146.876015 0.642863 3.487380e+09 5.666127e+09 0 False
29 303.959970 0.157904 4.487392e+09 2.248160e+09 0 False
30 80.946776 0.166976 4.292556e+09 2.615003e+09 0 True
31 145.490326 0.244747 3.591753e+09 3.500246e+09 0 False
32 47.449670 0.753030 4.490556e+09 4.912754e+09 0 False
33 320.821333 0.129496 4.472129e+09 1.973319e+09 0 False
34 2.119135 0.833631 4.309120e+09 4.724811e+09 0 False
35 244.983999 0.460957 4.044639e+09 4.423490e+09 0 False
36 132.290847 0.507013 3.710810e+09 4.847994e+09 0 False
37 117.746415 0.447451 3.915885e+09 4.431408e+09 0 False
38 269.901267 0.573885 4.382207e+09 4.655296e+09 0 False
39 166.858560 0.467514 3.290263e+09 4.753637e+09 0 True
40 235.329999 0.243263 3.927699e+09 3.366563e+09 0 False
41 294.779461 0.481248 4.506510e+09 3.833744e+09 0 False
42 55.168484 0.724602 4.490092e+09 4.911757e+09 0 False
43 62.251587 0.643478 4.449207e+09 4.631263e+09 0 False
44 267.357960 0.805955 4.424201e+09 5.799198e+09 0 False
45 169.187637 0.560899 3.248898e+09 5.268111e+09 0 True
46 232.765170 0.698067 3.859027e+09 5.804894e+09 0 False
47 332.524144 0.523795 4.405087e+09 3.543372e+09 0 False
48 192.781915 0.293097 3.368587e+09 3.800395e+09 0 True
49 313.359648 0.605986 4.532765e+09 4.126499e+09 0 False
optres = results.loc[
    results["pareto-optimal"] == True, :
]  # Get only the optimal results
plt.plot(
    results["DistrictCooling:Facility"], results["DistrictHeating:Facility"], "x"
)  # Plot all results in the background
plt.plot(
    optres["DistrictCooling:Facility"], optres["DistrictHeating:Facility"], "ro"
)  # Plot optimal results in red
plt.xlabel("Cooling demand")
plt.ylabel("Heating demand")
Text(0, 0.5, 'Heating demand')
../../_images/BuildingOptimizationWithDask_13_1.png

Visualize the results

optres = optres.sort_values("DistrictCooling:Facility")  # Sort by the first objective
optresplot = optres.drop(columns="violation")  # Remove the constraint violation column
ax = optresplot.plot.bar(
    subplots=True, legend=None, figsize=(10, 10)
)  # Plot the variable values of each of the optimal solutions
/usr/local/lib/python3.7/dist-packages/pandas/plotting/_matplotlib/tools.py:307: MatplotlibDeprecationWarning:
The rowNum attribute was deprecated in Matplotlib 3.2 and will be removed two minor releases later. Use ax.get_subplotspec().rowspan.start instead.
  layout[ax.rowNum, ax.colNum] = ax.get_visible()
/usr/local/lib/python3.7/dist-packages/pandas/plotting/_matplotlib/tools.py:307: MatplotlibDeprecationWarning:
The colNum attribute was deprecated in Matplotlib 3.2 and will be removed two minor releases later. Use ax.get_subplotspec().colspan.start instead.
  layout[ax.rowNum, ax.colNum] = ax.get_visible()
/usr/local/lib/python3.7/dist-packages/pandas/plotting/_matplotlib/tools.py:313: MatplotlibDeprecationWarning:
The rowNum attribute was deprecated in Matplotlib 3.2 and will be removed two minor releases later. Use ax.get_subplotspec().rowspan.start instead.
  if not layout[ax.rowNum + 1, ax.colNum]:
/usr/local/lib/python3.7/dist-packages/pandas/plotting/_matplotlib/tools.py:313: MatplotlibDeprecationWarning:
The colNum attribute was deprecated in Matplotlib 3.2 and will be removed two minor releases later. Use ax.get_subplotspec().colspan.start instead.
  if not layout[ax.rowNum + 1, ax.colNum]:
../../_images/BuildingOptimizationWithDask_15_1.png
client.restart()
distributed.nanny - WARNING - Restarting worker
distributed.nanny - WARNING - Restarting worker
distributed.nanny - WARNING - Restarting worker
distributed.nanny - WARNING - Restarting worker

Client

Cluster

  • Workers: 4
  • Cores: 16
  • Memory: 68.72 GB