Created
July 31, 2015 18:21
-
-
Save dhadka/1620bdf57e7c8ea94eec to your computer and use it in GitHub Desktop.
SALib with Executioner Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from executioner.salib import * | |
| from SALib.sample import saltelli | |
| from SALib.analyze import sobol | |
| problem = { | |
| 'num_vars': 11, | |
| 'names': ['x1', 'x2', 'x3', 'x4', 'x5', 'x6', 'x7', 'x8', 'x9', 'x10', 'x11'], | |
| 'bounds': [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], | |
| [0, 1], [0, 1], [0, 1]] | |
| } | |
| with Executioner() as executioner: | |
| executioner.onStart(Execute("python dtlz2.py")) | |
| executioner.add(WriteInput("${x1} ${x2} ${x3} ${x4} ${x5} ${x6} ${x7} ${x8} ${x9} ${x10} ${x11}\n")) | |
| executioner.add(ParseLine(type=float, name="y")) | |
| executioner.onComplete(WriteInput("\n")) # send empty line to terminate process | |
| samples = saltelli.sample(problem, 1000, calc_second_order=True) | |
| Y = executioner.evaluateBatch(SALibSamples(problem, samples)) | |
| Y1 = convert_to_numpy(Y, "y", index=0) | |
| sobol.analyze(problem, Y1, print_to_console=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment