InfrastructureModels Library
Overview
The core functionalities provided by InfrastructureModels are organized into the following files in the src directory,
core/base.jl- tools for building, accessing and optimizing InfrastructureModels mathematical modelscore/constraint.jl- abstract mathematical constraints that occur across many types of InfrastructureModelscore/data.jl- tools for working with data dictionaries that conform to the InfrastructureModels data standardscore/export.jl- an internal tool for only exporting functions that do not begin with_core/ref.jl- tools for working with reference dictionaries (ref) that conform to the InfrastructureModels standardscore/relaxation_scheme.jl- abstract mathematical constraints implementing convex relaxations of functions that occur across many types of InfrastructureModelscore/solution.jl- tools for building optimization result dictionaries in the InfrastructureModels standard formatio/matlab.jl- basic tools for parsing matlab files for reading standard infrastructure data formats, such as the Matpower data format
API Reference
Below is a complete list of all components of InfrastructureModels with documentation strings when available. Following the JuMP developer style guide, items beginning with _ are for InfrastructureModels internal use only, while other elements are exported for use and extension by other packages.
InfrastructureModels.AbstractInfrastructureModel — Type
root of the infrastructure model formulation type hierarchy
InfrastructureModels.InitializeInfrastructureModel — Method
Constructor for an InfrastructureModels modeling object, where the infrastructure type it must be specified a priori.
InfrastructureModels.InitializeInfrastructureModel — Method
Constructor for an InfrastructureModels modeling object, where data is assumed to in a multi-infrastructure network data format.
InfrastructureModels._bold — Method
Makes a string bold in the terminal
InfrastructureModels._compare_numbers — Method
tests if two numbers are equal, up to floating point precision
InfrastructureModels._extract_matlab_assignment — Method
breaks up matlab strings of the form 'name = value;'
InfrastructureModels._grey — Method
Makes a string grey in the terminal, does not seem to work well on Windows terminals more info can be found at https://en.wikipedia.org/wiki/ANSIescapecode
InfrastructureModels._initialize_dict_from_ref — Method
Initialize an empty dictionary with a structure similar to ref.
InfrastructureModels._iscomponentdict — Method
Attempts to determine if the given data is a component dictionary
InfrastructureModels._populate_ref_global_keys! — Function
Populate the portion of refs corresponding to global keys.
InfrastructureModels._populate_ref_it! — Method
Populate the portion of refs for a specific infrastructure type.
InfrastructureModels._type_array — Method
Attempts to determine the type of an array of strings extracted from a matlab file
InfrastructureModels._type_value — Method
Attempts to determine the type of a string extracted from a matlab file
InfrastructureModels._update_data! — Method
recursive call of updatedata
InfrastructureModels._update_data_timepoint! — Method
recursive call of updatedata
InfrastructureModels.apply! — Method
Apply the function func!, which modifies data for a specific infrastructure, it. Here, apply_to_subnetworks specifies whether or not func! should be applied to all subnetworks in a multinetwork dataset.
InfrastructureModels.apply! — Method
Apply the function func!, which modifies ref using data for a specific infrastructure, it. Here, apply_to_subnetworks specifies whether or not func! should be applied to all subnetworks in a multinetwork dataset.
InfrastructureModels.apply! — Method
Apply the function func!, which modifies ref for a specific infrastructure, it. Here, apply_to_subnetworks specifies whether or not func! should be applied to all subnetworks in a multinetwork dataset.
InfrastructureModels.arrays_to_dicts! — Method
turns top level arrays into dicts
InfrastructureModels.build_ref — Method
Builds a ref object without the need to initialize an AbstractInfrastructureModel, where it specifies the infrastructure type.
InfrastructureModels.build_ref — Method
Builds a ref object without the need to initialize an AbstractInfrastructureModel, where the data is assumed to be in a multi-infrastructure format.
InfrastructureModels.check_type — Method
Checks if the given value is of a given type, if not tries to make it that type
InfrastructureModels.compare_dict — Method
tests if two dicts are equal, up to floating point precision
InfrastructureModels.component_table — Method
builds a table of component data
InfrastructureModels.constraint_bounds_on_off — Method
Given a continuous variable x and a binary variable z, sets x to 0.0 when z is 0. Requires that 0.0 is in the domain of x.
InfrastructureModels.float2string — Method
converts a float value into a string of fixed precision
sprintf would do the job but this work around is needed because sprintf cannot take format strings during runtime
InfrastructureModels.get_data — Method
Apply the getter function func, which operates on data for a specific infrastructure, it. Here, apply_to_subnetworks specifies whether or not func should be applied to all subnetworks in a multinetwork dataset. If so, a dictionary of retrieved data using func is returned, indexed by the indices of the multinetwork. Otherwise, a single value is returned.
InfrastructureModels.get_num_networks — Method
gets the number of networks that could exist provided the base data
InfrastructureModels.has_time_series — Method
checks if a given dataset has a time series component
InfrastructureModels.ismultiinfrastructure — Method
checks if a given network data is a multinetwork
InfrastructureModels.ismultinetwork — Method
checks if a given network data is a multinetwork
InfrastructureModels.load_timepoint! — Method
loads a single time point from a time_series data block into the current network
InfrastructureModels.logger_config! — Method
logger_config!(level::String)Set the logging level within PowerModels. level must be one of "error", "warn", "info", or "debug".
InfrastructureModels.make_multinetwork — Method
turns a single network and a time_series data block into a multi-network
InfrastructureModels.print_summary — Method
prints the text summary for a data dictionary to stdout
InfrastructureModels.ref_initialize — Function
Given a data dictionary following the InfrastructureModels multi-infrastructure conventions, build and return an initial "ref" dictionary, converting strings to symbols and component keys to integers. The global keys argument specifies which keys should remain in the root of the dictionary when building the multi-infrastructure dataset.
InfrastructureModels.ref_initialize — Function
Given a data dictionary following the Infrastructure Models conventions, builds an initial "ref" dictionary converting strings to symbols and component keys to integers. The global keys argument specifies which keys should remain in the root of dictionary when building a multi-network
InfrastructureModels.relaxation_complex_product — Method
constraint: c^2 <= a*b
InfrastructureModels.relaxation_complex_product — Method
constraint: c^2 + d^2 <= a*b
InfrastructureModels.relaxation_complex_product_conic — Method
a conic encoding of constraint: c^2 <= a*b
InfrastructureModels.relaxation_complex_product_conic — Method
a conic encoding of constraint: c^2 + d^2 <= a*b
InfrastructureModels.relaxation_complex_product_conic_on_off — Method
on/off variant of relaxationcomplexproduct controlled by indicator variable z in the conic form
InfrastructureModels.relaxation_complex_product_conic_on_off — Method
on/off variant of relaxationcomplexproduct controlled by indicator variable z in the conic form
InfrastructureModels.relaxation_complex_product_on_off — Method
on/off variant of relaxationcomplexproduct controlled by indicator variable z, variant with a fixed value of z
InfrastructureModels.relaxation_complex_product_on_off — Method
on/off variant of relaxationcomplexproduct controlled by indicator variable z
InfrastructureModels.relaxation_complex_product_on_off — Method
on/off variant of relaxationcomplexproduct controlled by indicator variable z
InfrastructureModels.relaxation_equality_on_off — Method
an on/off variant of x == y, controlled by the indicator variable z
InfrastructureModels.relaxation_equality_on_off — Method
an on/off variant of x == y, controlled by the indicator variable z, a variant for fixed z
InfrastructureModels.relaxation_product — Method
general relaxation of binlinear term (McCormick)
z >= JuMP.lower_bound(x)*y + JuMP.lower_bound(y)*x - JuMP.lower_bound(x)*JuMP.lower_bound(y)
z >= JuMP.upper_bound(x)*y + JuMP.upper_bound(y)*x - JuMP.upper_bound(x)*JuMP.upper_bound(y)
z <= JuMP.lower_bound(x)*y + JuMP.upper_bound(y)*x - JuMP.lower_bound(x)*JuMP.upper_bound(y)
z <= JuMP.upper_bound(x)*y + JuMP.lower_bound(y)*x - JuMP.upper_bound(x)*JuMP.lower_bound(y)InfrastructureModels.relaxation_product_on_off — Method
On/Off variant of a relaxed binlinear term (McCormick) requires that all variables (x,y,z) go to zero with ind Variant where ind is a fixed value and not a variable
InfrastructureModels.relaxation_product_on_off — Method
On/Off variant of a relaxed binlinear term (McCormick) requires that all variables (x,y,z) go to zero with ind
InfrastructureModels.relaxation_sqr — Method
general relaxation of a square term
x^2 <= y <= (JuMP.upper_bound(x)+JuMP.lower_bound(x))*x - JuMP.upper_bound(x)*JuMP.lower_bound(x)InfrastructureModels.relaxation_trilinear — Method
convex hull relaxation of trilinear term
w₁ = JuMP.lower_bound(x)*JuMP.lower_bound(y)*JuMP.lower_bound(z)
w₂ = JuMP.lower_bound(x)*JuMP.lower_bound(y)*JuMP.upper_bound(z)
w₃ = JuMP.lower_bound(x)*JuMP.upper_bound(y)*JuMP.lower_bound(z)
w₄ = JuMP.lower_bound(x)*JuMP.upper_bound(y)*JuMP.upper_bound(z)
w₅ = JuMP.upper_bound(x)*JuMP.lower_bound(y)*JuMP.lower_bound(z)
w₆ = JuMP.upper_bound(x)*JuMP.lower_bound(y)*JuMP.upper_bound(z)
w₇ = JuMP.upper_bound(x)*JuMP.upper_bound(y)*JuMP.lower_bound(z)
w₈ = JuMP.upper_bound(x)*JuMP.upper_bound(y)*JuMP.upper_bound(z)
w = λ₁*w₁ + λ₂*w₂ + λ₃*w₃ + λ₄*w₄ + λ₅*w₅ + λ₆*w₆ + λ₇*w₇ + λ₈*w₈
x = (λ₁ + λ₂ + λ₃ + λ₄)*JuMP.lower_bound(x) + (λ₅ + λ₆ + λ₇ + λ₈)*JuMP.upper_bound(x)
y = (λ₁ + λ₂ + λ₅ + λ₆)*JuMP.lower_bound(y) + (λ₃ + λ₄ + λ₇ + λ₈)*JuMP.upper_bound(y)
z = (λ₁ + λ₃ + λ₅ + λ₇)*JuMP.lower_bound(z) + (λ₂ + λ₄ + λ₆ + λ₈)*JuMP.upper_bound(z)
λ₁ + λ₂ + λ₃ + λ₄ + λ₅ + λ₆ + λ₇ + λ₈ = 1InfrastructureModels.replicate — Method
Transforms a single network into a multinetwork with several deepcopies of the original network
InfrastructureModels.row_to_dict — Method
takes a row from a matrix and assigns the values names
InfrastructureModels.row_to_typed_dict — Method
takes a row from a matrix and assigns the values names and types
InfrastructureModels.silence — Method
silence()Silence logging within InfrastructureModels.
This is equivalent to calling logger_config!("error").
InfrastructureModels.sol_component_fixed — Method
given a constant value, builds the standard component-wise solution structure
InfrastructureModels.sol_component_value — Method
given a variable that is indexed by component ids, builds the standard solution structure
InfrastructureModels.sol_component_value_edge — Method
maps asymmetric edge variables into components
InfrastructureModels.summary — Method
prints the text summary for a data dictionary to IO
InfrastructureModels.update_data! — Method
recursively applies new_data to data, overwriting information
InfrastructureModels.value2string — Method
converts a float to a string, using float_precision cutoff
InfrastructureModels.value2string — Method
converts any value to a string
InfrastructureModels.value2string — Method
converts any value to a string, summarizes arrays
InfrastructureModels.value2string — Method
converts any value to a string, summarizes dicts
InfrastructureModels.variable_domain — Method
Computes the valid domain of a given JuMP variable taking into account bounds and the varaible's implicit bounds (e.g. binary).
InfrastructureModels.@def — Macro
The def macro is used to build other macros that can insert the same block of julia code into different parts of a program. In InfrastructureModels packages this is macro is used to generate a standard set of fields inside a model type hierarchy.
InfrastructureModels.@im_fields — Macro
a macro for adding the standard InfrastructureModels fields to a type definition