Skip to content
Snippets Groups Projects
Verified Commit 6d41621a authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Fix constructor for Sequence and add TR

parent cff56a38
No related branches found
No related tags found
No related merge requests found
module Sequences
import JuMP: Model
import ...BuildSequences: @global_model_constructor
import ...Variables: variables, start_time, duration, VariableType
import ...Variables: variables, start_time, duration, VariableType, get_free_variable
import ...BuildingBlocks: BuildingBlock, to_block
"""
......@@ -13,11 +13,19 @@ Represents a series of [`BuildingBlock`](@ref) objects run in turn.
struct Sequence <: BuildingBlock
model :: Model
blocks :: Vector{<:BuildingBlock}
TR :: VariableType
function Sequence(model::Model, blocks::Vector; TR=nothing)
new(
model,
to_block.(blocks),
get_free_variable(model, TR),
)
end
end
@global_model_constructor Sequence
Sequence(model::Model, blocks...) = return Sequence(model, to_block.([blocks...]))
Sequence(model::Model, blocks...; TR=nothing) = Sequence(model, [blocks...]; TR=TR)
Base.length(seq::Sequence) = length(seq)
Base.getindex(seq::Sequence, index) = seq[index]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment