Optimization with script variables



I want to use the optimization routines in Lumerical. Generally, you need to define one or more parameters to optimize and a figure of merit.
The problem is now that I use scripts to set up my geometry. I define some variables at the beginning of the script and with these few variables, the script automatically calculates the positions and sizes of all objects in my simulation. Is it possible to optimize one of these script variables?

An example: Imagine you want to optimize the dimensions of a structure and another structure shall always be at a fixed position relative to the first structure. It’s easy to write a script which places the structures correctly, but in an optimization, you can select only isolated geometric parameters of one structure. I need to select/optimize a variable that influences more than one geometric parameter of more than one structure.
Is this possible?

Thanks, Philipp


If I understand you correctly, you would create your structure using StructureGroup, where you can define your parameters that you want to optimize, and put these parameters into the optimizer.



In principle yes, but I can’t add sources and monitors to a structure group.



You might also try AnalysisGroup. The structure that you can find in the following link has multiple sources.





thank you very much, I moved now the whole scripting for the construction and the analysis into this analysis group and it works perfectly.