@@ -132,18 +132,56 @@ function make_vector_data(cache::DLLCache; M=SparseArrays.SparseMatrixCSC{Float6
132132 completion_data = convert (VectorStandardFormData{M,V,T}, model_to_data (completion_model))
133133 return completion_data, y_sets, (p_ref, y_ref, ref_map)
134134end
135- function get_y (cache:: DLLCache )
136- return get_y (cache. dual_model, cache. decomposition)
135+
136+ """
137+ get_y(model::JuMP.Model)
138+
139+ Get the primal constraints corresponding to the `y` variables in the decomposition.
140+ """
141+ function get_y (model:: JuMP.Model )
142+ return get_cache (model). decomposition. y_ref
143+ end
144+
145+ """
146+ get_y_dual(model::JuMP.Model)
147+
148+ Get the dual variables corresponding to the `y` variables in the decomposition.
149+ These are VariableRefs belonging to the dual model, not the passed-in `model`.
150+ """
151+ function get_y_dual (model:: JuMP.Model )
152+ return get_y_dual (get_cache (model))
153+ end
154+ function get_y_dual (cache:: DLLCache )
155+ return get_y_dual (cache. dual_model, cache. decomposition)
137156end
138157
158+ """
159+ y_shape(model::JuMP.Model)
160+
161+ Get the shape of the `y` variables in the decomposition.
162+ This is a Vector{Int} where each entry is the number of dual variables for that constraint.
163+ """
164+ function y_shape (model:: JuMP.Model )
165+ return y_shape (get_cache (model))
166+ end
139167function y_shape (cache:: DLLCache )
140- return length .(get_y (cache. dual_model, cache. decomposition))
168+ return length .(get_y_dual (cache. dual_model, cache. decomposition))
141169end
142170
171+ """
172+ flatten_y(y::AbstractVector)
173+
174+ Flatten a vector of `y` variables into a single vector, i.e. Vector{Vector{Float64}} -> Vector{Float64}.
175+ """
143176function flatten_y (y:: AbstractVector )
144177 return reduce (vcat, y)
145178end
146179
180+ """
181+ unflatten_y(y::AbstractVector, y_shape::AbstractVector{Int})
182+
183+ Unflatten a vector of flattened `y` variables into a vector of vectors, i.e. Vector{Float64} -> Vector{Vector{Float64}}.
184+ """
147185function unflatten_y (y:: AbstractVector , y_shape:: AbstractVector{Int} )
148186 return [y[start_idx: start_idx + shape - 1 ] for (start_idx, shape) in enumerate (y_shape)]
149187end
0 commit comments