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
e2303384
Verified
Commit
e2303384
authored
1 year ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Fix variable conversion
parent
99ee9e21
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/building_blocks.jl
+11
-7
11 additions, 7 deletions
src/building_blocks.jl
with
11 additions
and
7 deletions
src/building_blocks.jl
+
11
−
7
View file @
e2303384
...
@@ -258,14 +258,18 @@ function set_simple_constraints!(model::Model, block::BuildingBlock, kwargs)
...
@@ -258,14 +258,18 @@ function set_simple_constraints!(model::Model, block::BuildingBlock, kwargs)
invert_value
(
value
)
=
value
invert_value
(
value
)
=
value
for
(
key
,
value
)
in
kwargs
for
(
key
,
value
)
in
kwargs
if
key
==
:
qval
if
key
in
keys
(
to_funcs
)
apply_simple_constraint!
(
model
,
qval_square
(
block
),
value
isa
VariableType
?
value
^
2
:
value
)
elseif
key
==
:
slice_thickness
&&
:
inverse_slice_thickness
in
keys
(
to_funcs
)
apply_simple_constraint!
(
model
,
inverse_slice_thickness
(
block
),
invert_value
(
value
))
elseif
key
==
:
bandwidth
&&
:
inverse_bandwidth
in
keys
(
to_funcs
)
apply_simple_constraint!
(
model
,
inverse_bandwidth
(
block
),
invert_value
(
value
))
else
apply_simple_constraint!
(
model
,
to_funcs
[
key
](
block
),
value
)
apply_simple_constraint!
(
model
,
to_funcs
[
key
](
block
),
value
)
else
if
key
==
:
qval
apply_simple_constraint!
(
model
,
to_funcs
[
:
qval_square
](
block
),
value
isa
VariableType
?
value
^
2
:
value
)
elseif
key
==
:
slice_thickness
&&
:
inverse_slice_thickness
in
keys
(
to_funcs
)
apply_simple_constraint!
(
model
,
to_funcs
[
:
inverse_slice_thickness
](
block
),
invert_value
(
value
))
elseif
key
==
:
bandwidth
&&
:
inverse_bandwidth
in
keys
(
to_funcs
)
apply_simple_constraint!
(
model
,
to_funcs
[
:
inverse_bandwidth
](
block
),
invert_value
(
value
))
else
error
(
"Trying to set an unrecognised variable
$
key."
)
end
end
end
end
end
nothing
nothing
...
...
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