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
591439e6
Verified
Commit
591439e6
authored
1 year ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Remove InsertedBuildingBlocks
parent
eda9a521
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/containers/sequences.jl
+0
-1
0 additions, 1 deletion
src/containers/sequences.jl
src/inserted_building_blocks.jl
+0
-64
0 additions, 64 deletions
src/inserted_building_blocks.jl
with
0 additions
and
65 deletions
src/containers/sequences.jl
+
0
−
1
View file @
591439e6
...
...
@@ -3,7 +3,6 @@ import JuMP: Model
import
...
GlobalModel
:
@global_model_constructor
import
...
Variables
:
variables
,
start_time
,
duration
,
VariableType
import
...
BuildingBlocks
:
BuildingBlock
import
...
InsertedBuildingBlocks
:
InsertedBuildingBlock
"""
Sequence(building_blocks...)
...
...
This diff is collapsed.
Click to expand it.
src/inserted_building_blocks.jl
deleted
100644 → 0
+
0
−
64
View file @
eda9a521
module
InsertedBuildingBlocks
import
Printf
:
@sprintf
import
JuMP
:
owner_model
,
has_values
,
Model
import
..
GlobalModel
:
@global_model_constructor
import
..
Variables
:
Variables
,
duration
,
start_time
,
variables
,
end_time
,
get_free_variable
import
..
BuildingBlocks
:
BuildingBlock
,
internal_print
"""
InsertedBuildingBlock(building_block; start_time=nothing)
InsertedBuildingBlock(building_block, index)
Represents a specific insertion of the [`BuildingBlock`](@ref) object within a larger sequence.
If `index` is set an existing [`InsertedBuildingBlock`](@ref) is returned. Otherwise, a new one is created with the given `start_time` as constraint.
"""
struct
InsertedBuildingBlock
{
T
<:
BuildingBlock
}
bb
::
T
index
::
Int
function
InsertedBuildingBlock
(
bb
,
index
)
if
index
<
1
||
index
>
length
(
bb
)
error
(
"
$
index is out of range for
$
bb"
)
end
return
new
{
typeof
(
bb
)}(
bb
,
index
)
end
end
owner_model
(
inserted
::
InsertedBuildingBlock
)
=
owner_model
(
inserted
.
bb
)
has_values
(
inserted
::
InsertedBuildingBlock
)
=
has_values
(
owner_model
(
inserted
))
@global_model_constructor
InsertedBuildingBlock
function
InsertedBuildingBlock
(
model
::
Model
,
bb
::
BuildingBlock
;
start_time
=
nothing
)
index
=
length
(
bb
.
start_time
)
+
1
push!
(
bb
.
start_time
,
get_free_variable
(
model
,
start_time
))
InsertedBuildingBlock
(
bb
,
index
)
end
function
Base.show
(
io
::
IO
,
inserted
::
InsertedBuildingBlock
)
print
(
io
,
string
(
typeof
(
block
)),
"("
)
if
has_values
(
inserted
)
if
iszero
(
value
(
duration
(
block
)))
print
(
io
,
"time="
,
@sprintf
(
"%.3f"
,
value
(
start_time
(
block
))),
", "
)
else
print
(
io
,
"time="
,
@sprintf
(
"%.3f"
,
value
(
start_time
(
block
))),
"-"
,
@sprintf
(
"%.3f"
,
value
(
end_time
(
block
))),
", "
)
end
end
internal_print
(
io
,
inserted
.
bb
)
print
(
io
,
")"
)
end
for
func
in
variables
()
if
func
in
(
start_time
,
end_time
)
continue
end
@eval
Variables
.$
(
nameof
(
func
))(
inserted
::
InsertedBuildingBlock
,
args
...
;
kwargs
...
)
=
Variables
.$
(
nameof
(
func
))(
inserted
.
bb
,
args
...
;
kwargs
...
)
end
end
\ No newline at end of file
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