Mercurial > hg > nsaunier > traffic-intelligence
annotate scripts/nomad/optimize-with-nomad.py @ 1209:2064e52019db
work on TTC for BEV
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 26 Apr 2023 23:36:32 -0400 |
| parents | 7117a31555c1 |
| children |
| rev | line source |
|---|---|
|
1186
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
1 import os |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
2 import argparse |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
3 |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
4 parser = argparse.ArgumentParser(description='The program is used to select the type of tracking to run with ' |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
5 'tracking-mota.py with NOMAD', |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
6 epilog='''NOMAD - A blackbox optimization software: |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
7 C. Audet, S. Le Digabel, C. Tribes and V. Rochon Montplaisir. The NOMAD project. |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
8 Software available at https://www.gerad.ca/nomad. |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
9 |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
10 S. Le Digabel. Algorithm 909: NOMAD: Nonlinear Optimization with the MADS algorithm. |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
11 ACM Transactions on Mathematical Software, 37(4):44:1–44:15, 2011.''', |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
12 formatter_class=argparse.RawDescriptionHelpFormatter) |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
13 |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
14 parser.add_argument('-t', dest='intersections', nargs = '*', type = str, help='name of the intersection for which ' |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
15 'the optimization is meant to be ran', |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
16 required=True) |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
17 parser.add_argument('--optimize-grouping-only', dest='optimizeGroupingOnly', |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
18 help='optimize only the grouping parameters and not the ones associated with feature tracking', |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
19 action='store_true') |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
20 |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
21 args = parser.parse_args() |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
22 |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
23 with open('arguments.txt', 'w') as f: |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
24 f.write(str(args.intersections)) |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
25 f.write("\n") |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
26 f.write(str(args.optimizeGroupingOnly)) |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
27 |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
28 os.system('nomad nomad-parameters.txt initial-parameters.txt') |
|
7117a31555c1
Etienne Beauchamp s work on optimization with Nomad software
Nicolas Saunier <nicolas.saunier@polymtl.ca>
parents:
diff
changeset
|
29 |
