Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
TOPFARM
TopFarm2
Commits
cd0c9fcd
Commit
cd0c9fcd
authored
Nov 30, 2021
by
Mikkel Friis-Møller
Browse files
added bathymetry.ipynb
parent
cba70b20
Pipeline
#27975
passed with stages
in 14 minutes and 29 seconds
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
topfarm/constraint_components/penalty_component.py
View file @
cd0c9fcd
from
openmdao.core.explicitcomponent
import
ExplicitComponent
from
openmdao.drivers.genetic_algorithm_driver
import
SimpleGADriver
from
topfarm.constraint_components.post_constraint
import
PostConstraint
import
numpy
as
np
...
...
@@ -34,6 +35,8 @@ class PostPenaltyComponent(ExplicitComponent):
if
isinstance
(
comp
[
1
],
dict
):
# for key in comp[1]:
self
.
add_input
(
comp
[
0
],
val
=
comp
[
1
][
next
(
iter
(
comp
[
1
]))])
elif
isinstance
(
comp
,
PostConstraint
):
self
.
add_input
(
comp
.
key
,
val
=
comp
.
upper
)
else
:
self
.
add_input
(
comp
[
0
],
val
=
np
.
zeros
(
max
([
len
(
np
.
atleast_1d
(
c
))
for
c
in
comp
[
1
:]])))
self
.
add_output
(
'post_penalty'
,
val
=
0.0
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment