From 96f3477718481ba89803c8ebab2d7a8f5a0f5821 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Fri, 9 Dec 2022 12:30:11 +1300 Subject: [PATCH] [docs] clarify you can use index sets when setting the start value (#3148) --- docs/src/changelog.md | 2 ++ docs/src/manual/variables.md | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/docs/src/changelog.md b/docs/src/changelog.md index 122380a116f..2697218c8a7 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added Benders tutorial with in-place resolves (#3145) - Added more [Tips and tricks](@id linear_tips_and_tricks) for linear programs (#3144) + - Clarified documentation that `start` can depend on the indices of a + variable container (#3148) ## Version 1.5.0 (December 8, 2022) diff --git a/docs/src/manual/variables.md b/docs/src/manual/variables.md index 755cb115ca4..8d16a8a7882 100644 --- a/docs/src/manual/variables.md +++ b/docs/src/manual/variables.md @@ -608,6 +608,20 @@ julia> start_value(y) 2.0 ``` +The `start` keyword argument can depend on the indices of a variable container: + +```jldoctest; setup=:(model=Model()) +julia> @variable(model, z[i = 1:2], start = i^2) +2-element Vector{VariableRef}: + z[1] + z[2] + +julia> start_value.(z) +2-element Vector{Float64}: + 1.0 + 4.0 +``` + !!! warning Some solvers do not support start values. If a solver does not support start values, an `MathOptInterface.UnsupportedAttribute{MathOptInterface.VariablePrimalStart}`