problem in using script in figure of merit


Hi there

Recently I was using optimization algorithm in order to design a multi parameter optimization, however, I found a quite ridiculous error in using the script as my figure of merit.

Let me take the file in KB as an example,( , it runs smoothly as just downloaded. The problem occurs when I active the radio button “use figure of merit script”, and added the script “fom=R.T;” , intuitively I thought the script could get the same result as download file, however it never happens.

that’s all I’ve changed from the downloaded file.
when I run the optimization, the FOM value begin at a very low value(much lower than the initial FOM structure) and quickly converge to zero.

Similar error can also be found in our other work (Au_antenna-FOMscript-test - Copy.fsp (977.6 KB)

Could you shed some light on it?


Hi @haijie.zuo,

As I tested, indeed this feature performs as you described. I think there is a bug somewhere behind this. I’ve reported this and I will keep you posted about the fixing progress.

A possible work-around, even though I haven’t fully tested it yet, is to insert a sweep to the optimization and sweep for some non-related parameters (which will have no effect on the optimization result) and then inherit the result to the optimization from the sweep. The ‘user defined figure of merit’ seems to work properly when there is a sweep underneath the optimization.

Another way is to use a sweep or nested sweep instead and then use a script file to do the post processing. But this might be more time consuming than doing the optimization directly.

I hope this could help to some extent. Again, sorry about the problem and I will keep you in the loop about the bug fixing status :slight_smile:


There is a problem with using the figure of merit script, so another workaround in addition to the one mentioned by @gwang is instead of using the figure of merit script at all, instead use an analysis group script to collect the monitor data and calculate the result that you want. Then directly set up the optimization tool to collect the calculated result from the analysis group.


Thanks @gwang and @nlui , currently I’m trying matlab+lumerical FDTD for the optimization based on desktop. Hopefully it will give me some positive results.

Sorry for late reply.