In [44]:
from __future__ import print_function
%matplotlib inline
%load_ext autoreload
%autoreload 2
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import numpy as np
import tables as t
from collections import defaultdict
import os
from cyclopts import tools as tools
from cyclopts import cyclopts_io as cycio
from cyclopts import analysis
from cyclopts.analysis import Context
In [45]:
# configurable input
mod_kind = 'reqr' # rxtr or reqr or rand
frxtr = 0
dirname = 'size_study/base_{kind}_{frxtr}'.format(kind=mod_kind, frxtr=frxtr)
#dirname = 'small_{kind}_{frxtr}'.format(kind=mod_kind, frxtr=frxtr)
if mod_kind == 'rxtr':
species_module = "cyclopts.structured_species.request"
species_class = "StructuredRequest"
elif mod_kind == 'reqr':
species_module = "cyclopts.structured_species.supply"
species_class = "StructuredSupply"
elif mod_kind == 'rand':
species_module = "cyclopts.random_request_species"
species_class = "RandomRequest"
xchange = {'reqr': 'Back-End', 'rxtr': 'Front-End'}
base = '~/phd/cyclopts/structured_runs/'
family_module = "cyclopts.exchange_family"
family_class = "ResourceExchange"
fname = 'combined.h5'
#fullpath = os.path.join(os.path.expanduser(base), dirname, suffix)
fullpath = os.path.join(os.path.expanduser(base), dirname)
# context driver object
save = True
ctx = Context(os.path.join(fullpath, fname),
family_module, family_class, species_module, species_class,
save=save, savepath=fullpath)
In [46]:
title = 'Solution Times for {case} Case {kind} Exchanges'.format(case=case, kind=xchange[mod_kind])
ctx.four_pane_scatter('n_arcs', save=save, saveall=save, title=title)
ctx.four_pane_scatter('n_constrs', save=save, saveall=save, title=title)
ctx.four_pane_scatter('pref_flow', save=save, saveall=save, title=title)
In [47]:
cparam = 'f_fc'
title = 'Fuel Cycle Effects on Solution Times'
ctx.three_pane_color_scatter('n_arcs', cparam, save=save, title=title)
ctx.three_pane_color_scatter('n_constrs', cparam, save=save, title=title)
ctx.three_pane_color_scatter('pref_flow', cparam, save=save, title=title)
In [ ]:
cparam = 'f_loc'
title = 'Location Fidelity Effects on Solution Times'
ctx.three_pane_color_scatter('n_arcs', cparam, save=save, title=title)
ctx.three_pane_color_scatter('n_constrs', cparam, save=save, title=title)
ctx.three_pane_color_scatter('pref_flow', cparam, save=save, title=title)
In [ ]:
cparam = 'r_l_c'
title = 'Commodity and Location Preference Weight Effects on Solution Times'
ctx.three_pane_color_scatter('n_arcs', cparam, save=save, title=title)
ctx.three_pane_color_scatter('n_constrs', cparam, save=save, title=title)
ctx.three_pane_color_scatter('pref_flow', cparam, save=save, title=title)
In [ ]:
if mod_kind == 'rxtr' or mod_kind == 'rand':
cparam = 'r_inv_proc'
title = 'Constraint RHS Weight Effects on Solution Times'
ctx.three_pane_color_scatter('n_arcs', cparam, save=save, title=title)
ctx.three_pane_color_scatter('n_constrs', cparam, save=save, title=title)
ctx.three_pane_color_scatter('pref_flow', cparam, save=save, title=title)
In [ ]: