|
|
<!DOCTYPE html>
|
|
|
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>API Reference · UnitCommitment.jl</title><meta name="title" content="API Reference · UnitCommitment.jl"/><meta property="og:title" content="API Reference · UnitCommitment.jl"/><meta property="twitter:title" content="API Reference · UnitCommitment.jl"/><meta name="description" content="Documentation for UnitCommitment.jl."/><meta property="og:description" content="Documentation for UnitCommitment.jl."/><meta property="twitter:description" content="Documentation for UnitCommitment.jl."/><script data-outdated-warner src="../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../search_index.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script><link href="../assets/custom.css" rel="stylesheet" type="text/css"/></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="../">UnitCommitment.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../">Home</a></li><li><span class="tocitem">Tutorials</span><ul><li><a class="tocitem" href="../tutorials/usage/">Getting started</a></li><li><a class="tocitem" href="../tutorials/customizing/">Model customization</a></li><li><a class="tocitem" href="../tutorials/lmp/">Locational Marginal Prices</a></li><li><a class="tocitem" href="../tutorials/market/">Market Clearing</a></li><li><a class="tocitem" href="../tutorials/decomposition/">Decomposition methods</a></li></ul></li><li><span class="tocitem">User guide</span><ul><li><a class="tocitem" href="../guides/problem/">Problem definition</a></li><li><a class="tocitem" href="../guides/format/">JSON data format</a></li><li><a class="tocitem" href="../guides/instances/">Benchmark instances</a></li></ul></li><li class="is-active"><a class="tocitem" href>API Reference</a><ul class="internal"><li><a class="tocitem" href="#Read-data,-build-model-and-optimize"><span>Read data, build model & optimize</span></a></li><li><a class="tocitem" href="#Locational-Marginal-Prices"><span>Locational Marginal Prices</span></a></li><li><a class="tocitem" href="#Modify-instance"><span>Modify instance</span></a></li><li><a class="tocitem" href="#Formulations"><span>Formulations</span></a></li><li><a class="tocitem" href="#Solution-Methods"><span>Solution Methods</span></a></li><li><a class="tocitem" href="#Randomization-Methods"><span>Randomization Methods</span></a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>API Reference</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>API Reference</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/ANL-CEEESA/UnitCommitment.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/dev/docs/src/api.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="API-Reference"><a class="docs-heading-anchor" href="#API-Reference">API Reference</a><a id="API-Reference-1"></a><a class="docs-heading-anchor-permalink" href="#API-Reference" title="Permalink"></a></h1><h2 id="Read-data,-build-model-and-optimize"><a class="docs-heading-anchor" href="#Read-data,-build-model-and-optimize">Read data, build model & optimize</a><a id="Read-data,-build-model-and-optimize-1"></a><a class="docs-heading-anchor-permalink" href="#Read-data,-build-model-and-optimize" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.read" href="#UnitCommitment.read"><code>UnitCommitment.read</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">read(path::AbstractString)::UnitCommitmentInstance</code></pre><p>Read a deterministic test case from the given file. The file may be gzipped.</p><p><strong>Example</strong></p><pre><code class="language-julia hljs">instance = UnitCommitment.read("s1.json.gz")</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/instance/read.jl#L59-L69">source</a></section><section><div><pre><code class="language-julia hljs">read(path::Vector{String})::UnitCommitmentInstance</code></pre><p>Read a stochastic unit commitment instance from the given files. Each file describes a scenario. The files may be gzipped.</p><p><strong>Example</strong></p><pre><code class="language-julia hljs">instance = UnitCommitment.read(["s1.json.gz", "s2.json.gz"])</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/instance/read.jl#L81-L92">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.read_benchmark" href="#UnitCommitment.read_benchmark"><code>UnitCommitment.read_benchmark</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">read_benchmark(name::AbstractString)::UnitCommitmentInstance</code></pre><p>Read one of the benchmark instances included in the package. See <a href="../guides/instances/">Instances</a> for the entire list of benchmark instances available.</p><p><strong>Example</strong></p><pre><code class="language-julia hljs">instance = UnitCommitment.read_benchmark("matpower/case3375wp/2017-02-01")</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/instance/read.jl#L13-L23">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.build_model" href="#UnitCommitment.build_model"><code>UnitCommitment.build_model</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">function build_model(;
|
|
|
instance::UnitCommitmentInstance,
|
|
|
optimizer = nothing,
|
|
|
formulation = Formulation(),
|
|
|
variable_names::Bool = false,
|
|
|
)::JuMP.Model</code></pre><p>Build the JuMP model corresponding to the given unit commitment instance.</p><p><strong>Arguments</strong></p><ul><li><code>instance</code>: the instance.</li><li><code>optimizer</code>: the optimizer factory that should be attached to this model (e.g. Cbc.Optimizer). If not provided, no optimizer will be attached.</li><li><code>formulation</code>: the MIP formulation to use. By default, uses a formulation that combines modeling components from different publications that provides good performance across a wide variety of instances. An alternative formulation may also be provided.</li><li><code>variable_names</code>: if true, set variable and constraint names. Important if the model is going to be exported to an MPS file. For large models, this can take significant time, so it's disabled by default.</li></ul><p><strong>Examples</strong></p><pre><code class="language-julia hljs"># Read benchmark instance
|
|
|
instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01")
|
|
|
|
|
|
# Construct model (using state-of-the-art defaults)
|
|
|
model = UnitCommitment.build_model(
|
|
|
instance = instance,
|
|
|
optimizer = Cbc.Optimizer,
|
|
|
)
|
|
|
|
|
|
# Construct model (using customized formulation)
|
|
|
model = UnitCommitment.build_model(
|
|
|
instance = instance,
|
|
|
optimizer = Cbc.Optimizer,
|
|
|
formulation = Formulation(
|
|
|
pwl_costs = KnuOstWat2018.PwlCosts(),
|
|
|
ramping = MorLatRam2013.Ramping(),
|
|
|
startup_costs = MorLatRam2013.StartupCosts(),
|
|
|
transmission = ShiftFactorsFormulation(
|
|
|
isf_cutoff = 0.005,
|
|
|
lodf_cutoff = 0.001,
|
|
|
),
|
|
|
),
|
|
|
)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/model/build.jl#L8-L65">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.optimize!" href="#UnitCommitment.optimize!"><code>UnitCommitment.optimize!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">optimize!(model::JuMP.Model)::Nothing</code></pre><p>Solve the given unit commitment model. Unlike <code>JuMP.optimize!</code>, this uses more advanced methods to accelerate the solution process and to enforce transmission and N-1 security constraints.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/solution/optimize.jl#L5-L11">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.solution" href="#UnitCommitment.solution"><code>UnitCommitment.solution</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">solution(model::JuMP.Model)::OrderedDict</code></pre><p>Extracts the optimal solution from the UC.jl model. The model must be solved beforehand.</p><p><strong>Example</strong></p><pre><code class="language-julia hljs">UnitCommitment.optimize!(model)
|
|
|
solution = UnitCommitment.solution(model)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/solution/solution.jl#L5-L16">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.validate" href="#UnitCommitment.validate"><code>UnitCommitment.validate</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">validate(instance, solution)::Bool</code></pre><p>Verifies that the given solution is feasible for the problem. If feasible, silently returns true. In infeasible, returns false and prints the validation errors to the screen.</p><p>This function is implemented independently from the optimization model in <code>model.jl</code>, and therefore can be used to verify that the model is indeed producing valid solutions. It can also be used to verify the solutions produced by other optimization packages.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/validation/validate.jl#L15-L26">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.write" href="#UnitCommitment.write"><code>UnitCommitment.write</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">write(filename::AbstractString, solution::AbstractDict)::Nothing</code></pre><p>Write the given solution to a JSON file.</p><p><strong>Example</strong></p><pre><code class="language-julia hljs">solution = UnitCommitment.solution(model)
|
|
|
UnitCommitment.write("/tmp/output.json", solution)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/solution/write.jl#L5-L16">source</a></section></article><h2 id="Locational-Marginal-Prices"><a class="docs-heading-anchor" href="#Locational-Marginal-Prices">Locational Marginal Prices</a><a id="Locational-Marginal-Prices-1"></a><a class="docs-heading-anchor-permalink" href="#Locational-Marginal-Prices" title="Permalink"></a></h2><h3 id="Conventional-LMPs"><a class="docs-heading-anchor" href="#Conventional-LMPs">Conventional LMPs</a><a id="Conventional-LMPs-1"></a><a class="docs-heading-anchor-permalink" href="#Conventional-LMPs" title="Permalink"></a></h3><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.compute_lmp-Tuple{Model, UnitCommitment.ConventionalLMP}" href="#UnitCommitment.compute_lmp-Tuple{Model, UnitCommitment.ConventionalLMP}"><code>UnitCommitment.compute_lmp</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">function compute_lmp(
|
|
|
model::JuMP.Model,
|
|
|
method::ConventionalLMP;
|
|
|
optimizer,
|
|
|
)::OrderedDict{Tuple{String,String,Int},Float64}</code></pre><p>Calculates conventional locational marginal prices of the given unit commitment instance. Returns a dictionary mapping <code>(bus_name, time)</code> to the marginal price.</p><p><strong>Arguments</strong></p><ul><li><p><code>model</code>: the UnitCommitment model, must be solved before calling this function.</p></li><li><p><code>method</code>: the LMP method.</p></li><li><p><code>optimizer</code>: the optimizer for solving the LP problem.</p></li></ul><p><strong>Examples</strong></p><pre><code class="language-julia hljs">using UnitCommitment
|
|
|
using HiGHS
|
|
|
|
|
|
import UnitCommitment: ConventionalLMP
|
|
|
|
|
|
# Read benchmark instance
|
|
|
instance = UnitCommitment.read_benchmark("matpower/case118/2018-01-01")
|
|
|
|
|
|
# Build the model
|
|
|
model = UnitCommitment.build_model(
|
|
|
instance = instance,
|
|
|
optimizer = HiGHS.Optimizer,
|
|
|
)
|
|
|
|
|
|
# Optimize the model
|
|
|
UnitCommitment.optimize!(model)
|
|
|
|
|
|
# Compute the LMPs using the conventional method
|
|
|
lmp = UnitCommitment.compute_lmp(
|
|
|
model,
|
|
|
ConventionalLMP(),
|
|
|
optimizer = HiGHS.Optimizer,
|
|
|
)
|
|
|
|
|
|
# Access the LMPs
|
|
|
# Example: "s1" is the scenario name, "b1" is the bus name, 1 is the first time slot
|
|
|
@show lmp["s1", "b1", 1]</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/lmp/conventional.jl#L7-L61">source</a></section></article><h3 id="Approximated-Extended-LMPs"><a class="docs-heading-anchor" href="#Approximated-Extended-LMPs">Approximated Extended LMPs</a><a id="Approximated-Extended-LMPs-1"></a><a class="docs-heading-anchor-permalink" href="#Approximated-Extended-LMPs" title="Permalink"></a></h3><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.AELMP" href="#UnitCommitment.AELMP"><code>UnitCommitment.AELMP</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">struct AELMP <: PricingMethod
|
|
|
allow_offline_participation::Bool = true
|
|
|
consider_startup_costs::Bool = true
|
|
|
end</code></pre><p>Approximate Extended LMPs.</p><p><strong>Arguments</strong></p><ul><li><code>allow_offline_participation</code>: If true, offline assets are allowed to participate in pricing.</li><li><code>consider_startup_costs</code>: If true, the start-up costs are averaged over each unit production; otherwise the production costs stay the same.</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/lmp/structs.jl#L9-L24">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.compute_lmp-Tuple{Model, UnitCommitment.AELMP}" href="#UnitCommitment.compute_lmp-Tuple{Model, UnitCommitment.AELMP}"><code>UnitCommitment.compute_lmp</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">function compute_lmp(
|
|
|
model::JuMP.Model,
|
|
|
method::AELMP;
|
|
|
optimizer,
|
|
|
)::OrderedDict{Tuple{String,Int},Float64}</code></pre><p>Calculates the approximate extended locational marginal prices of the given unit commitment instance.</p><p>The AELPM does the following three things:</p><pre><code class="nohighlight hljs">1. It sets the minimum power output of each generator to zero
|
|
|
2. It averages the start-up cost over the offer blocks for each generator
|
|
|
3. It relaxes all integrality constraints</code></pre><p>Returns a dictionary mapping <code>(bus_name, time)</code> to the marginal price.</p><p>WARNING: This approximation method is not fully developed. The implementation is based on MISO Phase I only.</p><ol><li>It only supports Fast Start resources. More specifically, the minimum up/down time has to be zero.</li><li>The method does NOT support time-varying start-up costs.</li><li>An asset is considered offline if it is never on throughout all time periods. </li><li>The method does NOT support multiple scenarios.</li></ol><p><strong>Arguments</strong></p><ul><li><p><code>model</code>: the UnitCommitment model, must be solved before calling this function if offline participation is not allowed.</p></li><li><p><code>method</code>: the AELMP method.</p></li><li><p><code>optimizer</code>: the optimizer for solving the LP problem.</p></li></ul><p><strong>Examples</strong></p><pre><code class="language-julia hljs">using UnitCommitment
|
|
|
using HiGHS
|
|
|
|
|
|
import UnitCommitment: AELMP
|
|
|
|
|
|
# Read benchmark instance
|
|
|
instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01")
|
|
|
|
|
|
# Build the model
|
|
|
model = UnitCommitment.build_model(
|
|
|
instance = instance,
|
|
|
optimizer = HiGHS.Optimizer,
|
|
|
)
|
|
|
|
|
|
# Optimize the model
|
|
|
UnitCommitment.optimize!(model)
|
|
|
|
|
|
# Compute the AELMPs
|
|
|
aelmp = UnitCommitment.compute_lmp(
|
|
|
model,
|
|
|
AELMP(
|
|
|
allow_offline_participation = false,
|
|
|
consider_startup_costs = true
|
|
|
),
|
|
|
optimizer = HiGHS.Optimizer
|
|
|
)
|
|
|
|
|
|
# Access the AELMPs
|
|
|
# Example: "s1" is the scenario name, "b1" is the bus name, 1 is the first time slot
|
|
|
# Note: although scenario is supported, the query still keeps the scenario keys for consistency.
|
|
|
@show aelmp["s1", "b1", 1]</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/lmp/aelmp.jl#L7-L79">source</a></section></article><h2 id="Modify-instance"><a class="docs-heading-anchor" href="#Modify-instance">Modify instance</a><a id="Modify-instance-1"></a><a class="docs-heading-anchor-permalink" href="#Modify-instance" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.slice" href="#UnitCommitment.slice"><code>UnitCommitment.slice</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">slice(instance, range)</code></pre><p>Creates a new instance, with only a subset of the time periods. This function does not modify the provided instance. The initial conditions are also not modified.</p><p><strong>Example</strong></p><pre><code class="language-julia hljs"># Build a 2-hour UC instance
|
|
|
instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01")
|
|
|
modified = UnitCommitment.slice(instance, 1:2)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/transform/slice.jl#L5-L20">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.randomize!-Tuple{UnitCommitmentInstance}" href="#UnitCommitment.randomize!-Tuple{UnitCommitmentInstance}"><code>UnitCommitment.randomize!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">function randomize!(
|
|
|
instance::UnitCommitmentInstance;
|
|
|
method = UnitCommitment.XavQiuAhm2021.Randomization();
|
|
|
rng = MersenneTwister(),
|
|
|
)::Nothing</code></pre><p>Randomizes instance parameters according to the provided randomization method.</p><p><strong>Example</strong></p><pre><code class="language-julia hljs">instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01")
|
|
|
UnitCommitment.randomize!(instance)
|
|
|
model = UnitCommitment.build_model(; instance)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/transform/randomize/XavQiuAhm2021.jl#L234-L251">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.generate_initial_conditions!" href="#UnitCommitment.generate_initial_conditions!"><code>UnitCommitment.generate_initial_conditions!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">generate_initial_conditions!(instance, optimizer)</code></pre><p>Generates feasible initial conditions for the given instance, by constructing and solving a single-period mixed-integer optimization problem, using the given optimizer. The instance is modified in-place.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/transform/initcond.jl#L7-L13">source</a></section></article><h2 id="Formulations"><a class="docs-heading-anchor" href="#Formulations">Formulations</a><a id="Formulations-1"></a><a class="docs-heading-anchor-permalink" href="#Formulations" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.Formulation" href="#UnitCommitment.Formulation"><code>UnitCommitment.Formulation</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">struct Formulation
|
|
|
prod_vars::ProductionVarsFormulation
|
|
|
pwl_costs::PiecewiseLinearCostsFormulation
|
|
|
ramping::RampingFormulation
|
|
|
startup_costs::StartupCostsFormulation
|
|
|
status_vars::StatusVarsFormulation
|
|
|
transmission::TransmissionFormulation
|
|
|
end</code></pre><p>Struct provided to <code>build_model</code> that holds various formulation components.</p><p><strong>Fields</strong></p><ul><li><code>prod_vars</code>: Formulation for the production decision variables</li><li><code>pwl_costs</code>: Formulation for the piecewise linear costs</li><li><code>ramping</code>: Formulation for ramping constraints</li><li><code>startup_costs</code>: Formulation for time-dependent start-up costs</li><li><code>status_vars</code>: Formulation for the status variables (e.g. <code>is_on</code>, <code>is_off</code>)</li><li><code>transmission</code>: Formulation for transmission and N-1 security constraints</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/model/formulations/base/structs.jl#L12-L32">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.ShiftFactorsFormulation" href="#UnitCommitment.ShiftFactorsFormulation"><code>UnitCommitment.ShiftFactorsFormulation</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">struct ShiftFactorsFormulation <: TransmissionFormulation
|
|
|
isf_cutoff::Float64 = 0.005
|
|
|
lodf_cutoff::Float64 = 0.001
|
|
|
precomputed_isf=nothing
|
|
|
precomputed_lodf=nothing
|
|
|
end</code></pre><p>Transmission formulation based on Injection Shift Factors (ISF) and Line Outage Distribution Factors (LODF). Constraints are enforced in a lazy way.</p><p><strong>Arguments</strong></p><ul><li><code>precomputed_isf</code>: the injection shift factors matrix. If not provided, it will be computed.</li><li><code>precomputed_lodf</code>: the line outage distribution factors matrix. If not provided, it will be computed.</li><li><code>isf_cutoff</code>: the cutoff that should be applied to the ISF matrix. Entries with magnitude smaller than this value will be set to zero.</li><li><code>lodf_cutoff</code>: the cutoff that should be applied to the LODF matrix. Entries with magnitude smaller than this value will be set to zero.</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/model/formulations/base/structs.jl#L60-L84">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.ArrCon2000" href="#UnitCommitment.ArrCon2000"><code>UnitCommitment.ArrCon2000</code></a> — <span class="docstring-category">Module</span></header><section><div><p>Formulation described in:</p><pre><code class="nohighlight hljs">Arroyo, J. M., & Conejo, A. J. (2000). Optimal response of a thermal unit
|
|
|
to an electricity spot market. IEEE Transactions on power systems, 15(3),
|
|
|
1098-1104. DOI: https://doi.org/10.1109/59.871739</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/model/formulations/ArrCon2000/structs.jl#L5-L11">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.CarArr2006" href="#UnitCommitment.CarArr2006"><code>UnitCommitment.CarArr2006</code></a> — <span class="docstring-category">Module</span></header><section><div><p>Formulation described in:</p><pre><code class="nohighlight hljs">Carrión, M., & Arroyo, J. M. (2006). A computationally efficient
|
|
|
mixed-integer linear formulation for the thermal unit commitment problem.
|
|
|
IEEE Transactions on power systems, 21(3), 1371-1378.
|
|
|
DOI: https://doi.org/10.1109/TPWRS.2006.876672</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/model/formulations/CarArr2006/structs.jl#L5-L12">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.DamKucRajAta2016" href="#UnitCommitment.DamKucRajAta2016"><code>UnitCommitment.DamKucRajAta2016</code></a> — <span class="docstring-category">Module</span></header><section><div><p>Formulation described in:</p><pre><code class="nohighlight hljs">Damcı-Kurt, P., Küçükyavuz, S., Rajan, D., & Atamtürk, A. (2016). A polyhedral
|
|
|
study of production ramping. Mathematical Programming, 158(1), 175-205.
|
|
|
DOI: https://doi.org/10.1007/s10107-015-0919-9</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/model/formulations/DamKucRajAta2016/structs.jl#L5-L11">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.Gar1962" href="#UnitCommitment.Gar1962"><code>UnitCommitment.Gar1962</code></a> — <span class="docstring-category">Module</span></header><section><div><p>Formulation described in:</p><pre><code class="nohighlight hljs">Garver, L. L. (1962). Power generation scheduling by integer
|
|
|
programming-development of theory. Transactions of the American Institute
|
|
|
of Electrical Engineers. Part III: Power Apparatus and Systems, 81(3), 730-734.
|
|
|
DOI: https://doi.org/10.1109/AIEEPAS.1962.4501405</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/model/formulations/Gar1962/structs.jl#L5-L13">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.KnuOstWat2018" href="#UnitCommitment.KnuOstWat2018"><code>UnitCommitment.KnuOstWat2018</code></a> — <span class="docstring-category">Module</span></header><section><div><p>Formulation described in:</p><pre><code class="nohighlight hljs">Knueven, B., Ostrowski, J., & Watson, J. P. (2018). Exploiting identical
|
|
|
generators in unit commitment. IEEE Transactions on Power Systems, 33(4),
|
|
|
4496-4507. DOI: https://doi.org/10.1109/TPWRS.2017.2783850</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/model/formulations/KnuOstWat2018/structs.jl#L5-L11">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.MorLatRam2013" href="#UnitCommitment.MorLatRam2013"><code>UnitCommitment.MorLatRam2013</code></a> — <span class="docstring-category">Module</span></header><section><div><p>Formulation described in:</p><pre><code class="nohighlight hljs">Morales-España, G., Latorre, J. M., & Ramos, A. (2013). Tight and compact
|
|
|
MILP formulation for the thermal unit commitment problem. IEEE Transactions
|
|
|
on Power Systems, 28(4), 4897-4908. DOI: https://doi.org/10.1109/TPWRS.2013.2251373</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/model/formulations/MorLatRam2013/structs.jl#L5-L11">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.PanGua2016" href="#UnitCommitment.PanGua2016"><code>UnitCommitment.PanGua2016</code></a> — <span class="docstring-category">Module</span></header><section><div><p>Formulation described in:</p><pre><code class="nohighlight hljs">Pan, K., & Guan, Y. (2016). Strong formulations for multistage stochastic
|
|
|
self-scheduling unit commitment. Operations Research, 64(6), 1482-1498.
|
|
|
DOI: https://doi.org/10.1287/opre.2016.1520</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/model/formulations/PanGua2016/structs.jl#L5-L11">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.WanHob2016" href="#UnitCommitment.WanHob2016"><code>UnitCommitment.WanHob2016</code></a> — <span class="docstring-category">Module</span></header><section><div><p>Formulation described in:</p><pre><code class="nohighlight hljs">B. Wang and B. F. Hobbs, "Real-Time Markets for Flexiramp: A Stochastic
|
|
|
Unit Commitment-Based Analysis," in IEEE Transactions on Power Systems,
|
|
|
vol. 31, no. 2, pp. 846-860, March 2016, doi: 10.1109/TPWRS.2015.2411268.</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/model/formulations/WanHob2016/structs.jl#L5-L11">source</a></section></article><h2 id="Solution-Methods"><a class="docs-heading-anchor" href="#Solution-Methods">Solution Methods</a><a id="Solution-Methods-1"></a><a class="docs-heading-anchor-permalink" href="#Solution-Methods" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.XavQiuWanThi2019.Method" href="#UnitCommitment.XavQiuWanThi2019.Method"><code>UnitCommitment.XavQiuWanThi2019.Method</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">mutable struct Method
|
|
|
time_limit::Float64
|
|
|
gap_limit::Float64
|
|
|
two_phase_gap::Bool
|
|
|
max_violations_per_line::Int
|
|
|
max_violations_per_period::Int
|
|
|
end</code></pre><p>Lazy constraint solution method described in:</p><pre><code class="nohighlight hljs">Xavier, A. S., Qiu, F., Wang, F., & Thimmapuram, P. R. (2019). Transmission
|
|
|
constraint filtering in large-scale security-constrained unit commitment.
|
|
|
IEEE Transactions on Power Systems, 34(3), 2457-2460.
|
|
|
DOI: https://doi.org/10.1109/TPWRS.2019.2892620</code></pre><p><strong>Fields</strong></p><ul><li><code>time_limit</code>: the time limit over the entire optimization procedure.</li><li><code>gap_limit</code>: the desired relative optimality gap. Only used when <code>two_phase_gap=true</code>.</li><li><code>two_phase_gap</code>: if true, solve the problem with large gap tolerance first, then reduce the gap tolerance when no further violated constraints are found.</li><li><code>max_violations_per_line</code>: maximum number of violated transmission constraints to add to the formulation per transmission line.</li><li><code>max_violations_per_period</code>: maximum number of violated transmission constraints to add to the formulation per time period.</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/solution/methods/XavQiuWanThi2019/structs.jl#L7-L40">source</a></section></article><h2 id="Randomization-Methods"><a class="docs-heading-anchor" href="#Randomization-Methods">Randomization Methods</a><a id="Randomization-Methods-1"></a><a class="docs-heading-anchor-permalink" href="#Randomization-Methods" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="UnitCommitment.XavQiuAhm2021.Randomization" href="#UnitCommitment.XavQiuAhm2021.Randomization"><code>UnitCommitment.XavQiuAhm2021.Randomization</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">struct Randomization
|
|
|
cost = Uniform(0.95, 1.05)
|
|
|
load_profile_mu = [...]
|
|
|
load_profile_sigma = [...]
|
|
|
load_share = Uniform(0.90, 1.10)
|
|
|
peak_load = Uniform(0.6 * 0.925, 0.6 * 1.075)
|
|
|
randomize_costs = true
|
|
|
randomize_load_profile = true
|
|
|
randomize_load_share = true
|
|
|
end</code></pre><p>Randomization method that changes: (1) production and startup costs, (2) share of load coming from each bus, (3) peak system load, and (4) temporal load profile, as follows:</p><ol><li><p><strong>Production and startup costs:</strong> For each unit <code>u</code>, the vectors <code>u.min_power_cost</code> and <code>u.cost_segments</code> are multiplied by a constant <code>α[u]</code> sampled from the provided <code>cost</code> distribution. If <code>randomize_costs</code> is false, skips this step.</p></li><li><p><strong>Load share:</strong> For each bus <code>b</code> and time <code>t</code>, the value <code>b.load[t]</code> is multiplied by <code>(β[b] * b.load[t]) / sum(β[b2] * b2.load[t] for b2 in buses)</code>, where <code>β[b]</code> is sampled from the provided <code>load_share</code> distribution. If <code>randomize_load_share</code> is false, skips this step.</p></li><li><p><strong>Peak system load and temporal load profile:</strong> Sets the peak load to <code>ρ * C</code>, where <code>ρ</code> is sampled from <code>peak_load</code> and <code>C</code> is the maximum system capacity, at any time. Also scales the loads of all buses, so that <code>system_load[t+1]</code> becomes equal to <code>system_load[t] * γ[t]</code>, where <code>γ[t]</code> is sampled from <code>Normal(load_profile_mu[t], load_profile_sigma[t])</code>.</p><p>The system load for the first time period is set so that the peak load matches <code>ρ * C</code>. If <code>load_profile_sigma</code> and <code>load_profile_mu</code> have fewer elements than <code>instance.time</code>, wraps around. If <code>randomize_load_profile</code> is false, skips this step.</p></li></ol><p>The default parameters were obtained based on an analysis of publicly available bid and hourly data from PJM, corresponding to the month of January, 2017. For more details, see Section 4.2 of the paper.</p><p><strong>References</strong></p><ul><li><strong>Xavier, Álinson S., Feng Qiu, and Shabbir Ahmed.</strong> <em>"Learning to solve large-scale security-constrained unit commitment problems."</em> INFORMS Journal on Computing 33.2 (2021): 739-756. DOI: 10.1287/ijoc.2020.0976</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://github.com/ANL-CEEESA/UnitCommitment.jl/blob/c638aaf4ecb0e2655e7c190c2efd6d09bcbd3abd/src/transform/randomize/XavQiuAhm2021.jl#L11-L59">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../guides/instances/">« Benchmark instances</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Tuesday 21 May 2024 10:28">Tuesday 21 May 2024</span>. Using Julia version 1.10.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
|