From 5a665cbbf6611b8f7dd2f19b3bf0e4be57fe998a Mon Sep 17 00:00:00 2001 From: ErinKuci <Erin.Kuci@ulg.ac.be> Date: Fri, 9 Nov 2018 22:16:16 +0100 Subject: [PATCH] unconstrained example --- Team25/shape.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Team25/shape.py b/Team25/shape.py index 35e0834..70b1dbf 100644 --- a/Team25/shape.py +++ b/Team25/shape.py @@ -133,7 +133,6 @@ while it <= maxIter and c.getString('shape/Action') != 'stop': # compute objective function and constraints c.runSubClient('myGetDP', mygetdp + '-solve GetPerformances') objective = np.sum(readSimpleTable(c.getPath('res_opt/w.txt'))) - constraints = np.array([np.sum(xFromMMA)/np.sum(upperBound)-1.0]) # generate the velocity field of each design variable getVelocityField(x) @@ -146,19 +145,17 @@ while it <= maxIter and c.getString('shape/Action') != 'stop': c.waitOnSubClients() grad_objective = np.asarray([np.sum(readSimpleTable(c.getPath('res_opt/Grad_w_wrt_dv_'+str(dv)+'.txt')))\ for dv in xrange(numVariables)]) - grad_constraints = np.ones(numVariables)/np.sum(upperBound) print('*'*50) print('iteration: ', it) print('change: ', change) print('current point:', xFromMMA) print('objective:', objective) - print('constraints:', constraints) - c.sendInfo('Optimization: it. {}, obj. {}, constr. {}'.format(it,objective,constraints[0])) + c.sendInfo('Optimization: it. {}, obj. {}'.format(it,objective)) # call MMA and update the current point - conveks.mma.setMoveLimits(lowerBound, upperBound, 1.0e-3) - conveks.mma.updateCurrentPoint(grad_objective,constraints,grad_constraints) + conveks.mma.setMoveLimits(lowerBound, upperBound, 0.1) + conveks.mma.updateCurrentPoint(grad_objective) change = conveks.mma.getDesignChange() it = conveks.mma.getOuterIteration() -- GitLab