Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tutorials
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
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
conveks
tutorials
Commits
b2393276
Commit
b2393276
authored
6 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
optlab -> conveks
parent
af63cbcf
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
Lbracket/topo.py
+17
-17
17 additions, 17 deletions
Lbracket/topo.py
Team25/shape.py
+17
-17
17 additions, 17 deletions
Team25/shape.py
with
34 additions
and
34 deletions
Lbracket/topo.py
+
17
−
17
View file @
b2393276
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#
#
import
numpy
as
np
import
numpy
as
np
import
optlab
import
conveks
import
onelab
import
onelab
c
=
onelab
.
client
(
__file__
)
c
=
onelab
.
client
(
__file__
)
...
@@ -110,20 +110,20 @@ lowerBound = 0.001*np.ones(numVariables)
...
@@ -110,20 +110,20 @@ lowerBound = 0.001*np.ones(numVariables)
upperBound
=
np
.
ones
(
numVariables
)
upperBound
=
np
.
ones
(
numVariables
)
# Initialize the MMA optimizer
# Initialize the MMA optimizer
optlab
.
mma
.
initialize
(
x
,
lowerBound
,
upperBound
)
conveks
.
mma
.
initialize
(
x
,
lowerBound
,
upperBound
)
# Set appropriate options for MMA
# Set appropriate options for MMA
optlab
.
mma
.
option
.
setNumber
(
'
General.Verbosity
'
,
4
)
conveks
.
mma
.
option
.
setNumber
(
'
General.Verbosity
'
,
4
)
optlab
.
mma
.
option
.
setNumber
(
'
General.SaveHistory
'
,
0
)
conveks
.
mma
.
option
.
setNumber
(
'
General.SaveHistory
'
,
0
)
optlab
.
mma
.
option
.
setNumber
(
'
SubProblem.isRobustMoveLimit
'
,
1
)
conveks
.
mma
.
option
.
setNumber
(
'
SubProblem.isRobustMoveLimit
'
,
1
)
optlab
.
mma
.
option
.
setNumber
(
'
SubProblem.isRobustAsymptotes
'
,
1
)
conveks
.
mma
.
option
.
setNumber
(
'
SubProblem.isRobustAsymptotes
'
,
1
)
optlab
.
mma
.
option
.
setNumber
(
'
SubProblem.type
'
,
0
)
conveks
.
mma
.
option
.
setNumber
(
'
SubProblem.type
'
,
0
)
optlab
.
mma
.
option
.
setNumber
(
'
SubProblem.addConvexity
'
,
1
)
conveks
.
mma
.
option
.
setNumber
(
'
SubProblem.addConvexity
'
,
1
)
optlab
.
mma
.
option
.
setNumber
(
'
SubProblem.asymptotesRmax
'
,
100.0
)
conveks
.
mma
.
option
.
setNumber
(
'
SubProblem.asymptotesRmax
'
,
100.0
)
optlab
.
mma
.
option
.
setNumber
(
'
SubProblem.asymptotesRmin
'
,
0.001
)
conveks
.
mma
.
option
.
setNumber
(
'
SubProblem.asymptotesRmin
'
,
0.001
)
# Get iteration count (here it will be 1 - could be different in case of restart)
# Get iteration count (here it will be 1 - could be different in case of restart)
it
=
optlab
.
mma
.
getOuterIteration
()
it
=
conveks
.
mma
.
getOuterIteration
()
change
=
1.0
change
=
1.0
while
change
>
maxChange
and
it
<=
maxIter
and
c
.
getString
(
'
topo/Action
'
)
!=
'
stop
'
:
while
change
>
maxChange
and
it
<=
maxIter
and
c
.
getString
(
'
topo/Action
'
)
!=
'
stop
'
:
...
@@ -134,7 +134,7 @@ while change > maxChange and it <= maxIter and c.getString('topo/Action') != 'st
...
@@ -134,7 +134,7 @@ while change > maxChange and it <= maxIter and c.getString('topo/Action') != 'st
attributes
=
{
'
Highlight
'
:
'
LightYellow
'
})
attributes
=
{
'
Highlight
'
:
'
LightYellow
'
})
# get (copy of) current point
# get (copy of) current point
x
=
np
.
array
(
optlab
.
mma
.
getCurrentPoint
())
x
=
np
.
array
(
conveks
.
mma
.
getCurrentPoint
())
if
filtering
:
if
filtering
:
setElementTable
(
'
Optimization/Results/filterInput
'
,
elements
,
x
)
setElementTable
(
'
Optimization/Results/filterInput
'
,
elements
,
x
)
...
@@ -183,10 +183,10 @@ while change > maxChange and it <= maxIter and c.getString('topo/Action') != 'st
...
@@ -183,10 +183,10 @@ while change > maxChange and it <= maxIter and c.getString('topo/Action') != 'st
c
.
sendInfo
(
'
Optimization: it. {}, obj. {}, constr. {}, change {}
'
.
format
(
it
,
objective
,
constraints
[
0
],
change
))
c
.
sendInfo
(
'
Optimization: it. {}, obj. {}, constr. {}, change {}
'
.
format
(
it
,
objective
,
constraints
[
0
],
change
))
# call MMA and update the current point
# call MMA and update the current point
optlab
.
mma
.
setMoveLimits
(
lowerBound
,
upperBound
,
0.1
)
conveks
.
mma
.
setMoveLimits
(
lowerBound
,
upperBound
,
0.1
)
optlab
.
mma
.
updateCurrentPoint
(
constraints
,
grad_objective
,
grad_constraints
)
conveks
.
mma
.
updateCurrentPoint
(
constraints
,
grad_objective
,
grad_constraints
)
change
=
optlab
.
mma
.
getDesignChange
()
change
=
conveks
.
mma
.
getDesignChange
()
it
=
optlab
.
mma
.
getOuterIteration
()
it
=
conveks
.
mma
.
getOuterIteration
()
# This should be called at the end
# This should be called at the end
optlab
.
mma
.
finalize
()
conveks
.
mma
.
finalize
()
This diff is collapsed.
Click to expand it.
Team25/shape.py
+
17
−
17
View file @
b2393276
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#
#
import
numpy
as
np
import
numpy
as
np
import
optlab
import
conveks
import
onelab
import
onelab
c
=
onelab
.
client
(
__file__
)
c
=
onelab
.
client
(
__file__
)
...
@@ -102,20 +102,20 @@ for label, var in x.iteritems():
...
@@ -102,20 +102,20 @@ for label, var in x.iteritems():
upperBound
[
label
]
=
var
[
3
]
upperBound
[
label
]
=
var
[
3
]
# Initialize the MMA optimizer
# Initialize the MMA optimizer
optlab
.
mma
.
initialize
(
initialPoint
,
lowerBound
,
upperBound
)
conveks
.
mma
.
initialize
(
initialPoint
,
lowerBound
,
upperBound
)
# Set some options for MMA
# Set some options for MMA
optlab
.
mma
.
option
.
setNumber
(
'
General.Verbosity
'
,
4
)
conveks
.
mma
.
option
.
setNumber
(
'
General.Verbosity
'
,
4
)
optlab
.
mma
.
option
.
setNumber
(
'
General.SaveHistory
'
,
0
)
conveks
.
mma
.
option
.
setNumber
(
'
General.SaveHistory
'
,
0
)
optlab
.
mma
.
option
.
setNumber
(
'
SubProblem.isRobustMoveLimit
'
,
1
)
conveks
.
mma
.
option
.
setNumber
(
'
SubProblem.isRobustMoveLimit
'
,
1
)
optlab
.
mma
.
option
.
setNumber
(
'
SubProblem.isRobustAsymptotes
'
,
1
)
conveks
.
mma
.
option
.
setNumber
(
'
SubProblem.isRobustAsymptotes
'
,
1
)
optlab
.
mma
.
option
.
setNumber
(
'
SubProblem.type
'
,
0
)
conveks
.
mma
.
option
.
setNumber
(
'
SubProblem.type
'
,
0
)
optlab
.
mma
.
option
.
setNumber
(
'
SubProblem.addConvexity
'
,
0
)
conveks
.
mma
.
option
.
setNumber
(
'
SubProblem.addConvexity
'
,
0
)
optlab
.
mma
.
option
.
setNumber
(
'
SubProblem.asymptotesRmax
'
,
100.0
)
conveks
.
mma
.
option
.
setNumber
(
'
SubProblem.asymptotesRmax
'
,
100.0
)
optlab
.
mma
.
option
.
setNumber
(
'
SubProblem.asymptotesRmin
'
,
0.001
)
conveks
.
mma
.
option
.
setNumber
(
'
SubProblem.asymptotesRmin
'
,
0.001
)
# Get iteration count (here it will be 1 - could be different in case of restart)
# Get iteration count (here it will be 1 - could be different in case of restart)
it
=
optlab
.
mma
.
getOuterIteration
()
it
=
conveks
.
mma
.
getOuterIteration
()
change
=
1.0
change
=
1.0
while
it
<=
maxIter
and
c
.
getString
(
'
shape/Action
'
)
!=
'
stop
'
:
while
it
<=
maxIter
and
c
.
getString
(
'
shape/Action
'
)
!=
'
stop
'
:
...
@@ -124,7 +124,7 @@ while it <= maxIter and c.getString('shape/Action') != 'stop':
...
@@ -124,7 +124,7 @@ while it <= maxIter and c.getString('shape/Action') != 'stop':
attributes
=
{
'
Highlight
'
:
'
LightYellow
'
})
attributes
=
{
'
Highlight
'
:
'
LightYellow
'
})
# get (copy of) current point
# get (copy of) current point
xFromMMA
=
np
.
array
(
optlab
.
mma
.
getCurrentPoint
())
xFromMMA
=
np
.
array
(
conveks
.
mma
.
getCurrentPoint
())
# send the current point to GetDP model
# send the current point to GetDP model
for
label
,
var
in
x
.
iteritems
():
for
label
,
var
in
x
.
iteritems
():
...
@@ -171,10 +171,10 @@ while it <= maxIter and c.getString('shape/Action') != 'stop':
...
@@ -171,10 +171,10 @@ while it <= maxIter and c.getString('shape/Action') != 'stop':
c
.
sendInfo
(
'
Optimization: it. {}, obj. {}, constr. {}
'
.
format
(
it
,
objective
,
constraints
[
0
]))
c
.
sendInfo
(
'
Optimization: it. {}, obj. {}, constr. {}
'
.
format
(
it
,
objective
,
constraints
[
0
]))
# call MMA and update the current point
# call MMA and update the current point
optlab
.
mma
.
setMoveLimits
(
lowerBound
,
upperBound
,
1.0e-4
)
conveks
.
mma
.
setMoveLimits
(
lowerBound
,
upperBound
,
1.0e-4
)
optlab
.
mma
.
updateCurrentPoint
(
constraints
,
grad_objective
,
grad_constraints
)
conveks
.
mma
.
updateCurrentPoint
(
constraints
,
grad_objective
,
grad_constraints
)
change
=
optlab
.
mma
.
getDesignChange
()
change
=
conveks
.
mma
.
getDesignChange
()
it
=
optlab
.
mma
.
getOuterIteration
()
it
=
conveks
.
mma
.
getOuterIteration
()
# This should be called at the end
# This should be called at the end
optlab
.
mma
.
finalize
()
conveks
.
mma
.
finalize
()
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