diff scripts/nomad/optimize-with-nomad.py @ 1186:7117a31555c1

Etienne Beauchamp s work on optimization with Nomad software
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 21 Jun 2022 17:06:06 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/nomad/optimize-with-nomad.py	Tue Jun 21 17:06:06 2022 -0400
@@ -0,0 +1,29 @@
+import os
+import argparse
+
+parser = argparse.ArgumentParser(description='The program is used to select the type of tracking to run with '
+                                             'tracking-mota.py with NOMAD',
+                                 epilog='''NOMAD - A blackbox optimization software: 
+                                 C. Audet, S. Le Digabel, C. Tribes and V. Rochon Montplaisir. The NOMAD project. 
+                                 Software available at https://www.gerad.ca/nomad.
+                                 
+                                 S. Le Digabel. Algorithm 909: NOMAD: Nonlinear Optimization with the MADS algorithm. 
+                                 ACM Transactions on Mathematical Software, 37(4):44:1–44:15, 2011.''',
+                                 formatter_class=argparse.RawDescriptionHelpFormatter)
+
+parser.add_argument('-t', dest='intersections', nargs = '*', type = str, help='name of the intersection for which '
+                                                    'the optimization is meant to be ran',
+                    required=True)
+parser.add_argument('--optimize-grouping-only', dest='optimizeGroupingOnly',
+                    help='optimize only the grouping parameters and not the ones associated with feature tracking',
+                    action='store_true')
+
+args = parser.parse_args()
+
+with open('arguments.txt', 'w') as f:
+    f.write(str(args.intersections))
+    f.write("\n")
+    f.write(str(args.optimizeGroupingOnly))
+
+os.system('nomad nomad-parameters.txt initial-parameters.txt')
+