Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MRIBuilder.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michiel Cottaar
MRIBuilder.jl
Commits
b6adda30
Verified
Commit
b6adda30
authored
1 year ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Allow scanner to be passed on to sequence
parent
90f75bd0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/containers/sequences.jl
+13
-5
13 additions, 5 deletions
src/containers/sequences.jl
with
13 additions
and
5 deletions
src/containers/sequences.jl
+
13
−
5
View file @
b6adda30
...
@@ -2,32 +2,40 @@ module Sequences
...
@@ -2,32 +2,40 @@ module Sequences
import
JuMP
:
Model
,
@constraint
import
JuMP
:
Model
,
@constraint
import
...
BuildSequences
:
@global_model_constructor
import
...
BuildSequences
:
@global_model_constructor
import
...
Variables
:
variables
,
start_time
,
duration
,
VariableType
,
get_free_variable
,
TR
import
...
Variables
:
variables
,
start_time
,
duration
,
VariableType
,
get_free_variable
,
TR
import
...
BuildingBlocks
:
BuildingBlock
,
ContainerBlock
,
to_block
,
get_children_blocks
import
...
BuildingBlocks
:
BuildingBlock
,
ContainerBlock
,
to_block
,
get_children_blocks
,
scanner_constraints!
"""
"""
Sequence(building_blocks...)
Sequence(building_blocks...
; TR=nothing, scanner=nothing
)
Sequence([building_blocks])
Sequence([building_blocks]
; TR=nothing, scanner=nothing
)
Represents a series of [`BuildingBlock`](@ref) objects run in turn.
Represents a series of [`BuildingBlock`](@ref) objects run in turn.
Providing a [`Scanner`](@ref) will lead to [`scanner_constraints!`](@ref) to be called on all building blocks.
## Variables
- [`TR`](@ref): repetition time of sequence in ms.
"""
"""
struct
Sequence
<:
ContainerBlock
struct
Sequence
<:
ContainerBlock
model
::
Model
model
::
Model
blocks
::
Vector
{
<:
BuildingBlock
}
blocks
::
Vector
{
<:
BuildingBlock
}
TR
::
VariableType
TR
::
VariableType
function
Sequence
(
model
::
Model
,
blocks
::
AbstractVector
;
TR
=
nothing
)
function
Sequence
(
model
::
Model
,
blocks
::
AbstractVector
;
TR
=
nothing
,
scanner
=
nothing
)
seq
=
new
(
seq
=
new
(
model
,
model
,
to_block
.
(
blocks
),
to_block
.
(
blocks
),
get_free_variable
(
model
,
TR
),
get_free_variable
(
model
,
TR
),
)
)
@constraint
model
seq
.
TR
>=
duration
(
seq
)
@constraint
model
seq
.
TR
>=
duration
(
seq
)
if
!
isnothing
(
scanner
)
scanner_constraints!
(
model
,
seq
,
scanner
)
end
return
seq
return
seq
end
end
end
end
@global_model_constructor
Sequence
@global_model_constructor
Sequence
Sequence
(
model
::
Model
,
blocks
...
;
TR
=
nothing
)
=
Sequence
(
model
,
[
blocks
...
];
TR
=
TR
)
Sequence
(
model
::
Model
,
blocks
...
;
TR
=
nothing
,
scanner
=
nothing
)
=
Sequence
(
model
,
[
blocks
...
];
TR
=
TR
,
scanner
=
scanner
)
Base
.
length
(
seq
::
Sequence
)
=
length
(
seq
.
blocks
)
Base
.
length
(
seq
::
Sequence
)
=
length
(
seq
.
blocks
)
Base
.
getindex
(
seq
::
Sequence
,
index
)
=
seq
.
blocks
[
index
]
Base
.
getindex
(
seq
::
Sequence
,
index
)
=
seq
.
blocks
[
index
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment