We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.

Ansys Learning Forum Forums Discuss Simulation Photonics Multiple inputs inverse design Reply To: Multiple inputs inverse design

Ahmed.Bayoumi
Subscriber


When I use SuperOptimization to optimize for two monitors (through and cross ports), and use the "+" operator to add two base files (one where the source is in the upper arm, and one where the source is in the lower arm), I get this error:
Initializing super optimization
Checking for one forward simulation : One forward simulation is in progress
Traceback (most recent call last):
File "/../TopOpt_2D_2FOM.py", line 102, in
runSim(initial_cond, eps_min, eps_max, x_pos, y_pos, filter_R*1e-9)
File "/../TopOpt_2D_2FOM.py", line 74, in runSim
opt_total.run(working_dir = cur_path)
File "/../../lumericl/releases/R2021_1.4/api/python/lumopt/optimization.py", line 460, in run
self.initialize(working_dir=working_dir)
File "/../../lumericl/releases/R2021_1.4/api/python/lumopt/optimization.py", line 119, in initialize
self.one_forward = check_one_forward_sim(self.optimizations[0])
File "/../../lumericl/releases/R2021_1.4/api/python/lumopt/optimization.py", line 99, in check_one_forward_sim
if np.any(self.optimizations[k].wavelengths.asarray() != wavelengths_ref.asarray()):
AttributeError: 'SuperOptimization' object has no attribute 'wavelengths'

This is how I did it:

opt_up_1 = Optimization(base_script=base_script_top , wavelengths = wavelengths, fom=fom1 geometry=geometry, optimizer=optimizer, use_deps=False, hide_fdtd_cad=True plot_history=False, store_all_simulations=False)

opt_up_2 = Optimization(base_script=base_script_top , wavelengths = wavelengths, fom=fom2 geometry=geometry, optimizer=optimizer, use_deps=False, hide_fdtd_cad=True plot_history=False, store_all_simulations=False)

opt_bot_1 = Optimization(base_script=base_script_bot ,wavelengths = wavelengths, fom=fom1 geometry=geometry, optimizer=optimizer, use_deps=False, hide_fdtd_cad=True plot_history=False, store_all_simulations=False)

opt_bot_2 = Optimization(base_script=base_script_bot , wavelengths = wavelengths, fom=fom2 geometry=geometry, optimizer=optimizer, use_deps=False, hide_fdtd_cad=True plot_history=False, store_all_simulations=False)


opt_up_T=[opt_up_1,opt_up_2]
opt_bot_T = [opt_bot_1, opt_bot_2]
weights=[1,1]
super_opt_up = SuperOptimization(optimizations = opt_up_T, weights = weights)
super_opt_bot = SuperOptimization(optimizations = opt_bot_T, weights = weights)
opt_total = super_opt_up + super_opt_bot
######## RUN THE OPTIMIZER ########

opt_total.run
Thanks
Ahmed