HydrOGEnMod

HydrOGEnMod.build_complementarity_modelFunction
build_complementarity_model(data::ModelData, BIG = 1e+6, logfile = "")

Build a JuMP model with complementarity extension from the underlying model data.

A logfile and upper bounds on variables can be specified.

Examples

julia> using HydrOGEnMod
julia> data = get_HydrOGEnMod_data("path/to/my/data");
julia> model = build_complementarity_model(data);
source
HydrOGEnMod.build_optimization_modelFunction
build_optimization_model(data::ModelData, BIG = 1e+6, logfile = "")

Build a JuMP optimization model (QP) from the underlying model data.

A logfile and upper bounds on variables can be specified.

Examples

julia> using HydrOGEnMod
julia> data = get_HydrOGEnMod_data("path/to/my/data");
julia> model = build_optimization_model(data);
source
HydrOGEnMod.get_HydrOGEnMod_dataMethod
get_HydrOGEnMod_data(data; logfile = "")

Get model data from the specified data path.

A file where to write the log records can be specified via keyword arguments.

Examples

julia> using HydrOGEnMod
julia> data = get_HydrOGEnMod_data("path/to/my/data");
source
HydrOGEnMod.plot_model_nodesMethod
plot_model_nodes(arcs::Vector{TransportArc}; nodes_path = joinpath(@__DIR__, "maps", "WB_countries_Admin0_modified.geojson"), disputed_path = joinpath(@__DIR__, "maps", "WB_Admin0_disputed_areas_modified.geojson"), centroids_path = joinpath(@__DIR__, "maps", "centroids.csv"), colorscheme = :seaborn_colorblind6, unassigned_color = :gray85, strokecolor = :black, strokewidth = 0.1, linewidth = 0.2, linecolor = :black, rasterize = false, save_path = "")

Plot the passed arcs into the model node map.

Separate method implemented for also passing arc values.

Keyword Arguments

  • nodes_path = joinpath(@__DIR__, "maps", "WB_countries_Admin0_modified.geojson"): Path where to find model nodes geojson file.
  • disputed_path = joinpath(@__DIR__, "maps", "WB_Admin0_disputed_areas_modified.geojson"): Path where to find disputed areas geojson file.
  • centroids_path = joinpath(@__DIR__, "maps", "centroids.csv"): Path where to find model region centroids file.
  • colorscheme = :seaborn_colorblind6: Colorscheme for the model regions.
  • unassigned_color = :gray85: Colorscheme for unassigned and disputed regions.
  • strokecolor = :black: Strokecolor around regions.
  • strokewidth = 0.1: Strokewidth around regions.
  • linewidth = 0.2: Arc linewidth connecting nodes.
  • linecolor = :black: Color of arcs connecting nodes.
  • rasterize = false: Rasterization.
  • save_path = "": Where to save the resulting graphic. Ending of filename automatically implies file format.
source
HydrOGEnMod.plot_model_nodesMethod
plot_model_nodes(; nodes_path = joinpath(@__DIR__, "maps", "WB_countries_Admin0_modified.geojson"), disputed_path = joinpath(@__DIR__, "maps", "WB_Admin0_disputed_areas_modified.geojson"), colorscheme = :seaborn_colorblind6, unassigned_color = :gray85, strokecolor = :black, strokewidth = 0.1, rasterize = false, legend_title = "Node Names", save_path = "",)

Plot an overview of the model nodes.

Only active, if no positional argument is passed.

Keyword Arguments

  • nodes_path = joinpath(@__DIR__, "maps", "WB_countries_Admin0_modified.geojson"): Path where to find model nodes geojson file.
  • disputed_path = joinpath(@__DIR__, "maps", "WB_Admin0_disputed_areas_modified.geojson"): Path where to find disputed areas geojson file.
  • colorscheme = :seaborn_colorblind6: Colorscheme for the model regions.
  • unassigned_color = :gray85: Colorscheme for unassigned and disputed regions.
  • strokecolor = :black: Strokecolor around regions.
  • strokewidth = 0.1: Strokewidth around regions.
  • rasterize = false: Rasterization.
  • legend_title = "Node Names": Title of the legend.
  • save_path = "": Where to save the resulting graphic. Ending of filename automatically implies file format.
source
HydrOGEnMod.plot_model_nodesMethod
plot_model_nodes(container::JuMP.Containers.DenseAxisArray{T,N,Ax,L}; nodes_path = joinpath(@__DIR__, "maps", "WB_countries_Admin0_modified.geojson"), disputed_path = joinpath(@__DIR__, "maps", "WB_Admin0_disputed_areas_modified.geojson"), colorscheme = :plasma, unassigned_color = :gray85, strokecolor = :black, strokewidth = 0.1, rasterize = false, save_path = "") where {T,N,Ax,L<:NTuple{N,JuMP.Containers._AxisLookup}}

Plot the values inside container into the model node map.

Separate methods implemented for DenseAxisArray and SparseAxisArray.

Keyword Arguments

  • nodes_path = joinpath(@__DIR__, "maps", "WB_countries_Admin0_modified.geojson"): Path where to find model nodes geojson file.
  • disputed_path = joinpath(@__DIR__, "maps", "WB_Admin0_disputed_areas_modified.geojson"): Path where to find disputed areas geojson file.
  • colorscheme = :plasma: Colorscheme for the model regions.
  • unassigned_color = :gray85: Colorscheme for unassigned and disputed regions.
  • strokecolor = :black: Strokecolor around regions.
  • strokewidth = 0.1: Strokewidth around regions.
  • rasterize = false: Rasterization.
  • save_path = "": Where to save the resulting graphic. Ending of filename automatically implies file format.
source
HydrOGEnMod.plot_model_nodesMethod
plot_model_nodes(container::JuMP.Containers.SparseAxisArray{T,N,K}; nodes_path = joinpath(@__DIR__, "maps", "WB_countries_Admin0_modified.geojson"), disputed_path = joinpath(@__DIR__, "maps", "WB_Admin0_disputed_areas_modified.geojson"), colorscheme = :plasma, unassigned_color = :gray85, strokecolor = :black, strokewidth = 0.1, rasterize = false, save_path = "")

Plot the values inside container into the model node map.

Separate methods implemented for DenseAxisArray and SparseAxisArray.

Keyword Arguments

  • nodes_path = joinpath(@__DIR__, "maps", "WB_countries_Admin0_modified.geojson"): Path where to find model nodes geojson file.
  • disputed_path = joinpath(@__DIR__, "maps", "WB_Admin0_disputed_areas_modified.geojson"): Path where to find disputed areas geojson file.
  • colorscheme = :plasma: Colorscheme for the model regions.
  • unassigned_color = :gray85: Colorscheme for unassigned and disputed regions.
  • strokecolor = :black: Strokecolor around regions.
  • strokewidth = 0.1: Strokewidth around regions.
  • rasterize = false: Rasterization.
  • save_path = "": Where to save the resulting graphic. Ending of filename automatically implies file format.
source
HydrOGEnMod.plot_model_nodesMethod
plot_model_nodes(container::JuMP.Containers.DenseAxisArray{T,N,Ax,L}, arcs::Vector{TransportArc}; nodes_path = joinpath(@__DIR__, "maps", "WB_countries_Admin0_modified.geojson"), disputed_path = joinpath(@__DIR__, "maps", "WB_Admin0_disputed_areas_modified.geojson"), centroids_path = joinpath(@__DIR__, "maps", "centroids.csv"), colorscheme = :seaborn_colorblind6, unassigned_color = :gray85, strokecolor = :black, strokewidth = 0.1, linewidth = 1, linecolorscheme = :plasma, rasterize = false, largestvalues = 10, save_path = "") where {T,N,Ax,L<:NTuple{N,JuMP.Containers._AxisLookup}}

Plot the passed arcs with coloring corresponding to given values in the container into the model node map.

Separate method implemented for just plotting normal values.

Keyword Arguments

  • nodes_path = joinpath(@__DIR__, "maps", "WB_countries_Admin0_modified.geojson"): Path where to find model nodes geojson file.
  • disputed_path = joinpath(@__DIR__, "maps", "WB_Admin0_disputed_areas_modified.geojson"): Path where to find disputed areas geojson file.
  • centroids_path = joinpath(@__DIR__, "maps", "centroids.csv"): Path where to find model region centroids file.
  • colorscheme = :seaborn_colorblind6: Colorscheme for the model regions.
  • unassigned_color = :gray85: Colorscheme for unassigned and disputed regions.
  • strokecolor = :black: Strokecolor around regions.
  • strokewidth = 0.1: Strokewidth around regions.
  • linewidth = 1: Arc linewidth connecting nodes.
  • linecolorscheme = :plasma: Colorscheme for coloring arcs connecting regions based on container values.
  • rasterize = false: Rasterization.
  • largestvalues = 10: The n largest arc values and equal to select.
  • minval = 1: The smallest value to include in the arc plot.
  • save_path = "": Where to save the resulting graphic. Ending of filename automatically implies file format.
source
HydrOGEnMod.solve_mcpMethod
solve_mcp(model::Model; logfile = "", kwargs...)

Solve a JuMP model with complementarity extension using the PATH solver.

A logfile can be specified, and solver specific options can be passed.

Examples

julia> using HydrOGEnMod
julia> data = get_HydrOGEnMod_data("path/to/my/data");
julia> model = build_complementarity_model(data);
julia> solve_mcp(model; output = "no", time_limit = 5);
source
HydrOGEnMod.write_csvMethod
write_csv(datadir, data::ModelData; logfile = "")

Write model data to a specific directory.

A logfile can be specified.

Examples

julia> using HydrOGEnMod
julia> data = get_HydrOGEnMod_data("path/to/my/data");
julia> write_csv("path/to/my/dir",data);
source
HydrOGEnMod.write_csvMethod
write_csv(resultsfile, model::Model; logfile = "")

Write model results to a specific directory.

A logfile can be specified.

Examples

julia> data = get_HydrOGEnMod_data("path/to/my/data");
julia> model = build_optimization_model(data);
julia> optimize!(model, Ipopt.Optimizer);
julia> write_csv("path/to/my/dir", model);
source
JuMP.optimize!Method
optimize!(model::Model, optimizer; options..., logfile = "")

Solve a JuMP Model with the given optimizer.

A logfile can be specified, and solver specific options can be passed.

Examples

julia> using HydrOGEnMod
julia> using Ipopt
julia> data = get_HydrOGEnMod_data("path/to/my/data");
julia> model = build_optimization_model(data);
julia> optimize!(model, Ipopt.Optimizer, "max_wall_time" => 1e-5)
source