Infrastructure

Functions to load a network from file

infrastructure.load_infrastructure_data(base_dir, ext_interdependency_dir=None, magnitude=6, sim_number=1, cost_scale=1.0, data_format='shelby_extended', extra_commodity=None)

This function reads the infrastructure network from file

Parameters
  • base_dir (str) – The address of the folder where the basic network information (topology, parameters, etc.) are stored

  • ext_interdependency_dir (str) – (only for old format of input data) The address of the file where the interdependency data are stored. The default in None.

  • magnitude (int) – (only for old format of input data) Magnitude of the initial damage scenario. The default is 6.

  • sim_number (int) – (only for old format of input data) The simulation number. The default is 1.

  • cost_scale (float) – The factor by which all cost values has to multiplied. The default is 1.0.

  • data_format (str) – The format of input data, which is either “shelby_old” (consistent with the output format of Xpress optimizing software employed by Andres Gonzalez) or “shelby_extended” (which is devised by Hesam Talebiyan). The default is “shelby_extended”.

  • extra_commodity – (only for extended format of input data) List of extra-commodities in the analysis. The default is None, which only considers a main commodity.

Returns

G – The networkx graph object that stores node, arc, and interdependency information

Return type

networkx.DiGraph

infrastructure.load_infrastructure_array_format_extended(base_dir, cost_scale=1.0, extra_commodity=None)

This function reads the infrastructure network from file in the extended format

Parameters
  • base_dir (str) – The address of the folder where the basic network information (topology, parameters, etc.) are stored

  • cost_scale (float) – The factor by which all cost values has to multiplied. The default is 1.0.

  • extra_commodity – (only for extended format of input data) List of extra-commodities in the analysis. The default is None, which only considers a main commodity.

Returns

G – The networkx graph object that stores node, arc, and interdependency information

Return type

networkx.DiGraph

infrastructure.load_synthetic_network(base_dir, topology='Random', config=6, sample=0, cost_scale=1.0)

This function reads a synthetic network from file

Parameters
  • base_dir (str) – The address of the folder where the basic network information (topology, parameters, etc.) are stored

  • topology (str) – Topology of the layers of the synthetic network. The default in ‘Random’.

  • config (int) – Configuration number of the initial damage scenario. The default is 6.

  • sample (int) – Sample number of the initial damage scenario. The default is 0.

  • cost_scale (float) – The factor by which all cost values has to multiplied. The default is 1.0.

Returns

  • G (networkx.DiGraph) – The networkx graph object that stores node, arc, and interdependency information

  • no_resource (int) – Number of resources available for restoration

  • list – List of layers of the synthetic network

infrastructure.load_infrastructure_array_format(base_dir, ext_interdependency_dir=None, magnitude=6, sim_number=1, cost_scale=1.0)

This function reads the infrastructure network from file in the old format

Parameters
  • base_dir (str) – The address of the folder where the basic network information (topology, parameters, etc.) are stored

  • ext_interdependency_dir (str) – The address of the file where the interdependency data are stored. The default in None.

  • magnitude (int) – Magnitude of the initial damage scenario. The default is 6.

  • sim_number (int) – The simulation number. The default is 1.

  • cost_scale (float) – The factor by which all cost values has to multiplied. The default is 1.0.

Returns

G – The networkx graph object that stores node, arc, and interdependency information

Return type

networkx.DiGraph

infrastructure.load_interdependencies(net_number, src_net_number, base_dir='../data/INDP_4-12-2016')

(only for old format of input data) This function reads interdependency data from file.

Parameters
  • net_number (int) – ID of the depender layer.

  • src_net_number (int) – ID of the dependee layer.

  • base_dir (src) – The address of the folder where the basic network information (topology, parameters, etc.) are stored

Returns

arcs – List of interdependencies as in arc format

Return type

list

Functions to load initial damage data from file

infrastructure.add_wu_failure_scenario(G, dam_dir, no_set=0, no_sce=0)

This function reads initial damage data from file in the WU format, and apply it to the infrastructure network. The damage data for this dataset comes in a format similar to the hazard maps from Jason Wu [Wu17], which consist of N sets (= samples) of M damage scenarios (= magnitudes). For shelby county, for example, N=50 and M=96.

Parameters
  • G (networkx.DiGraph) – The networkx graph object that stores node, arc, and interdependency information

  • dam_dir (str) – The address of the folder where the initial damage data are stored

  • no_set (int) – The number of the set of the initial damage scenario. The default is 0.

  • no_sce (int) – The number of the scenario of the initial damage scenario The default is 0.

Returns

Return type

None.

infrastructure.add_from_csv_failure_scenario(G, sample, dam_dir='')

This function reads initial damage data from file in the from_csv format, and apply it to the infrastructure network. This format only consider one magnitude value (0), and there can be as many as samples form that magnitude.

Parameters
  • G (networkx.DiGraph) – The networkx graph object that stores node, arc, and interdependency information

  • sample (int) – Sample number of the initial damage scenario,

  • dam_dir (str) – The address of the folder where the initial damage data are stored

Returns

Return type

None.

infrastructure.add_synthetic_failure_scenario(G, dam_dir, topology='Random', config=0, sample=0)

This function reads initial damage data from file for a synthetic network.

Parameters
  • G (networkx.DiGraph) – The networkx graph object that stores node, arc, and interdependency information.

  • dam_dir (str) – The address of the folder where the initial damage data are stored.

  • topology (str) – Topology of the layers of the synthetic network. The default in ‘Random’.

  • config (int) – Configuration number of the initial damage scenario. The default is 6.

  • sample (int) – Sample number of the initial damage scenario. The default is 0.

Returns

Return type

None.

infrastructure.add_failure_scenario(G, dam_dir, magnitude=6, v=3, sim_number=1)

This function reads initial damage data from file in the ANDRES format, and apply it to the infrastructure network

Parameters
  • G (networkx.DiGraph) – The networkx graph object that stores node, arc, and interdependency information

  • dam_dir (str) – The address of the folder where the initial damage data are stored

  • magnitude (int) – Magnitude of the initial damage scenario. The default is 6.

  • v (int) – Number of the resources in the analysis. The default is 3.

  • sim_number (int) – The simulation number. The default is 1.

Returns

Return type

None.

Classes to define a network and its elements

class infrastructure.InfrastructureNetwork(id)

Stores information of the infrastructure network

G

The networkx graph object that stores node, arc, and interdependency information

Type

networkx.DiGraph

S

List of geographical spaces on which the network lays

Type

list

id

Id of the network

Type

int

class infrastructure.InfrastructureNode(id, net_id, local_id='')

This class models a node in an infrastructure network

id

Node id

Type

int

net_id

The id of the layer of the network to which the node belong

Type

int

local_id

Local node id

Type

int

failure_probability

Failure probability of the node

Type

float

functionality

Functionality state of the node

Type

bool

repaired

If the node is repaired or not

Type

bool

reconstruction_cost

Reconstruction cost of the node

Type

float

oversupply_penalty

Penalty per supply unit of the main commodity that is not used for the the node

Type

float

undersupply_penalty

Penalty per demand unit of the main commodity that is not satisfied for the the node

Type

float

demand

Demand or supply value of the main commodity assigned to the node

Type

float

space

The id of the geographical space where the node is

Type

int

resource_usage

The dictionary that shows how many resource (of each resource type) is employed to repair the node

Type

dict

extra_com

The dictionary that shows demand, oversupply_penalty, and undersupply_penalty corresponding to commodities other than the main commodity

Type

dict

class infrastructure.InfrastructureArc(source, dest, layer, is_interdep=False)

This class models an arc in an infrastructure network

source

Start (or head) node id

Type

int

dest

End (or tail) node id

Type

int

layer

The id of the layer of the network to which the arc belong

Type

int

failure_probability

Failure probability of the arc

Type

float

functionality

Functionality state of the node

Type

bool

repaired

If the arc is repaired or not

Type

bool

flow_cost

Unit cost of sending the main commodity through the arc

Type

float

reconstruction_cost

Reconstruction cost of the arc

Type

float

capacity

Maximum volume of the commodities that the arc can carry

Type

float

space

The id of the geographical space where the arc is

Type

int

resource_usage

The dictionary that shows how many resource (of each resource type) is employed to repair the arc

Type

dict

extra_com

The dictionary that shows flow_cost corresponding to commodities other than the main commodity

Type

dict

is_interdep

If arc represent a normal arc (that carry commodity within a single layer) or physical interdependency between nodes from different layers

Type

bool

class infrastructure.InfrastructureInterdepArc(source, dest, source_layer, dest_layer, gamma)

This class models a physical interdependency between nodes from two different layers. This class inherits from InfrastructureArc, where source attributes corresponds to the dependee node, and dest corresponds to the depender node. The depender node is non-functional if the corresponding dependee node is non-functional.

source_layer

The id of the layer where the dependee node is

Type

int

dest_layer

The id of the layer where the depender node is

Type

int

gamma

The strength of the dependency, which is a number between 0 and 1.

Type

float

class infrastructure.InfrastructureSpace(id, cost)

This class models a geographical space.

id

The id of the space

Type

int

cost

The cost of preparing the space for a repair action

Type

float