Changeset 338 for branches/alta/mystic-0.2a1/test_constraints_cvxopt_qp.py
- Timestamp:
- 07/21/10 09:10:59 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/alta/mystic-0.2a1/test_constraints_cvxopt_qp.py
r334 r338 36 36 x + y == 1.0}, {x, y}] 37 37 Solution: {1.875, {x -> 0.25, y -> 0.75}} 38 39 OpenOpt code and results: 40 ------------------------- 41 from FuncDesigner import * 42 from openopt import NLP 43 x1, x2 = oovars ('x1', 'x2') 44 f = 2.*x1**2 + x2**2 + x1*x2 + x1 + x2 45 constraints = [x1 >= 0.0, x2 >= 0.0, x1 + x2 == 1.0] 46 x0 = {x1:1.,x2: 1.} 47 problem = NLP(f, x0, constraints=constraints) 48 soln = problem.solve('ralg') 49 print soln.xf 50 Solution: {x1: array([ 0.2500267]), x2: array([ 0.7499733])} 38 51 """ 39 52
Note: See TracChangeset
for help on using the changeset viewer.