# Optimization algorithm using OpenStudio PAT or terminal

Hello everyone,

I have been learning OpenStudio for the last few days and I think I am finally understanding the whole idea. It is great! thanks for making it possible.

Anyway, I have been trying to figure out how to implement a real Optimization algorithm using OpenStudio. I mean, I know that PAT can actually run A LOT of simulations, but I am not sure I like the "randomness" of how measures are impleented (or I think they are implemented)... it seems to me that the "lets run all these models, and see what happens" approach can be enhanced.

I am thinking on something more like "lets apply these measures, run a simulation, check the results and then figure out what the next measure to try should be". Does that make any sense to you guys? Is it possible to do that from PAT itself (can it be scripted or something?) Is it possible to do it from Command line (Terminal) from the existing binaries?

`#this kind of code is what I am picturing`

`seed_model=load_osm("seed.osm")`

`measure_1=load_measure("measure)`

`iteration_1=apply_measure(seed_model, measure_1)`

`results_1=simulate(first_iteration)`

`measure_2=figure_out_next_measure_from_results(results_1)`

`#repeat for iteration 2 with measure 2`

THANKS VERY MUCH, I may be speaking nonsense, but I think OpenStudio is not far from allowing this, if it does not already does.

Here is a link to our Lare Scale Analysis documentation. That should get you started. I'll let @BrianLBall or someone else go into more detail on specific optimization algorithms that are available with the server.

Thanks, Dan and David.

I did not fully undertand the available documentation on Large Scale Analysis... however, I think I am already learning how to do it using Ruby scripts. It is kind of tricky at the beggining, but I am learning.

Bye!