chiark
/
gitweb
/
~ianmdlvl
/
nlopt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
63fc088
)
simplify python test
author
jschueller
<julien.schueller@gmail.com>
Tue, 1 Sep 2015 08:21:23 +0000
(10:21 +0200)
committer
jschueller
<julien.schueller@gmail.com>
Tue, 1 Sep 2015 08:21:23 +0000
(10:21 +0200)
test/test_std.py
patch
|
blob
|
history
diff --git
a/test/test_std.py
b/test/test_std.py
index 3264c5d338e77688560efc9e1ccd62eb40425351..f7bfca625bd630dc5477bca42f880c6976ac4c61 100644
(file)
--- a/
test/test_std.py
+++ b/
test/test_std.py
@@
-1,15
+1,13
@@
#!/usr/bin/env python
#!/usr/bin/env python
+from __future__ import print_function
import nlopt
import numpy as np
import nlopt
import numpy as np
-print ('nlopt version='
+
nlopt.__version__)
+print ('nlopt version='
,
nlopt.__version__)
def f(x, grad):
def f(x, grad):
- F=x[0]
- L=x[1]
- E=x[2]
- I=x[3]
+ F, L, E, I = x
D=F*L**3/(3.*E*I)
return D
D=F*L**3/(3.*E*I)
return D
@@
-27,6
+25,6
@@
xopt = opt.optimize(x)
opt_val = opt.last_optimum_value()
result = opt.last_optimize_result()
opt_val = opt.last_optimum_value()
result = opt.last_optimize_result()
-print ('opt_result='
+str(result)
)
-print ('optimizer='
+str(xopt)
)
-print ('opt_val='
+str(opt_val)
)
+print ('opt_result='
, result
)
+print ('optimizer='
, xopt
)
+print ('opt_val='
, opt_val
)