From b23932769009f3b19888aa39b63be800758c5c63 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sat, 15 Sep 2018 11:58:48 +0200 Subject: [PATCH] optlab -> conveks --- Lbracket/topo.py | 34 +++++++++++++++++----------------- Team25/shape.py | 34 +++++++++++++++++----------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Lbracket/topo.py b/Lbracket/topo.py index a75d9f8..0207b85 100644 --- a/Lbracket/topo.py +++ b/Lbracket/topo.py @@ -3,7 +3,7 @@ # import numpy as np -import optlab +import conveks import onelab c = onelab.client(__file__) @@ -110,20 +110,20 @@ lowerBound = 0.001*np.ones(numVariables) upperBound = np.ones(numVariables) # Initialize the MMA optimizer -optlab.mma.initialize(x, lowerBound, upperBound) +conveks.mma.initialize(x, lowerBound, upperBound) # Set appropriate options for MMA -optlab.mma.option.setNumber('General.Verbosity', 4) -optlab.mma.option.setNumber('General.SaveHistory', 0) -optlab.mma.option.setNumber('SubProblem.isRobustMoveLimit', 1) -optlab.mma.option.setNumber('SubProblem.isRobustAsymptotes', 1) -optlab.mma.option.setNumber('SubProblem.type', 0) -optlab.mma.option.setNumber('SubProblem.addConvexity', 1) -optlab.mma.option.setNumber('SubProblem.asymptotesRmax', 100.0) -optlab.mma.option.setNumber('SubProblem.asymptotesRmin', 0.001) +conveks.mma.option.setNumber('General.Verbosity', 4) +conveks.mma.option.setNumber('General.SaveHistory', 0) +conveks.mma.option.setNumber('SubProblem.isRobustMoveLimit', 1) +conveks.mma.option.setNumber('SubProblem.isRobustAsymptotes', 1) +conveks.mma.option.setNumber('SubProblem.type', 0) +conveks.mma.option.setNumber('SubProblem.addConvexity', 1) +conveks.mma.option.setNumber('SubProblem.asymptotesRmax', 100.0) +conveks.mma.option.setNumber('SubProblem.asymptotesRmin', 0.001) # 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 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 attributes={'Highlight':'LightYellow'}) # get (copy of) current point - x = np.array(optlab.mma.getCurrentPoint()) + x = np.array(conveks.mma.getCurrentPoint()) if filtering: setElementTable('Optimization/Results/filterInput', elements, x) @@ -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)) # call MMA and update the current point - optlab.mma.setMoveLimits(lowerBound, upperBound, 0.1) - optlab.mma.updateCurrentPoint(constraints, grad_objective, grad_constraints) - change = optlab.mma.getDesignChange() - it = optlab.mma.getOuterIteration() + conveks.mma.setMoveLimits(lowerBound, upperBound, 0.1) + conveks.mma.updateCurrentPoint(constraints, grad_objective, grad_constraints) + change = conveks.mma.getDesignChange() + it = conveks.mma.getOuterIteration() # This should be called at the end -optlab.mma.finalize() +conveks.mma.finalize() diff --git a/Team25/shape.py b/Team25/shape.py index 60a61af..95d57ec 100644 --- a/Team25/shape.py +++ b/Team25/shape.py @@ -3,7 +3,7 @@ # import numpy as np -import optlab +import conveks import onelab c = onelab.client(__file__) @@ -102,20 +102,20 @@ for label, var in x.iteritems(): upperBound[label] = var[3] # Initialize the MMA optimizer -optlab.mma.initialize(initialPoint, lowerBound, upperBound) +conveks.mma.initialize(initialPoint, lowerBound, upperBound) # Set some options for MMA -optlab.mma.option.setNumber('General.Verbosity', 4) -optlab.mma.option.setNumber('General.SaveHistory', 0) -optlab.mma.option.setNumber('SubProblem.isRobustMoveLimit', 1) -optlab.mma.option.setNumber('SubProblem.isRobustAsymptotes', 1) -optlab.mma.option.setNumber('SubProblem.type', 0) -optlab.mma.option.setNumber('SubProblem.addConvexity', 0) -optlab.mma.option.setNumber('SubProblem.asymptotesRmax', 100.0) -optlab.mma.option.setNumber('SubProblem.asymptotesRmin', 0.001) +conveks.mma.option.setNumber('General.Verbosity', 4) +conveks.mma.option.setNumber('General.SaveHistory', 0) +conveks.mma.option.setNumber('SubProblem.isRobustMoveLimit', 1) +conveks.mma.option.setNumber('SubProblem.isRobustAsymptotes', 1) +conveks.mma.option.setNumber('SubProblem.type', 0) +conveks.mma.option.setNumber('SubProblem.addConvexity', 0) +conveks.mma.option.setNumber('SubProblem.asymptotesRmax', 100.0) +conveks.mma.option.setNumber('SubProblem.asymptotesRmin', 0.001) # 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 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'}) # get (copy of) current point - xFromMMA = np.array(optlab.mma.getCurrentPoint()) + xFromMMA = np.array(conveks.mma.getCurrentPoint()) # send the current point to GetDP model for label, var in x.iteritems(): @@ -171,10 +171,10 @@ while it <= maxIter and c.getString('shape/Action') != 'stop': c.sendInfo('Optimization: it. {}, obj. {}, constr. {}'.format(it,objective,constraints[0])) # call MMA and update the current point - optlab.mma.setMoveLimits(lowerBound, upperBound, 1.0e-4) - optlab.mma.updateCurrentPoint(constraints,grad_objective,grad_constraints) - change = optlab.mma.getDesignChange() - it = optlab.mma.getOuterIteration() + conveks.mma.setMoveLimits(lowerBound, upperBound, 1.0e-4) + conveks.mma.updateCurrentPoint(constraints,grad_objective,grad_constraints) + change = conveks.mma.getDesignChange() + it = conveks.mma.getOuterIteration() # This should be called at the end -optlab.mma.finalize() +conveks.mma.finalize() -- GitLab