Constraints in optimization

  • 21 April 2021
  • 1 reply

I want to optimize the design of a stacked lens that it's going to be 3D printed. Each layer (Rectangular Volume objects) has a constant refractive index, but by stacking them we create a GRIN lens effect. This will focus the light only in one direction. As a first step, I want for some specific input and focal length (I implement the specific focal length by defining the detector to be at a specific distance from the lens) to change the length and layer thickness.

When I ran an optimization, the length became negative, so I applied a constraint with NPGT for the thickness, here the Z Length of the rectangular object. But it still gets negative. Is there a way to apply contstraints in my input correctly? The layer thicknesses, namely the Y half width of the rectangular object, I also need them to be constraint between 0.1 and 0.3 mm, but I haven't implemented this yet, since not even the Z length constraint works for me.

Since this design focuses the light in y direction, my merit function operand for tight focus is NSDD for y distance from the centroid, I selected it to be approximately equal to the x distance of the input, but 0 is also fine. Even without optimization we can see that light focuses, but there are some outliers. I presume that the y distance value for the NSDD operand takes those into account. How can I disregard them, and say ok if 80% of the flux is within a specific y, the optimization works?


I attached my model.


Thank you.

1 reply

Userlevel 7
Badge +2

Hi Elizavet,

Thanks for attaching an archive of your model. It is still quite complex though, do you think you could come up with a simpler example, which demonstrates your problem? The reason why I'm asking is because I don't have time to let the optimization run, and visualize the issue.

If you've constrained a value to be positive, and it continues to become negative during optimization, you can try to increase the Weight of the operand. Try increasing it by multiples of 10, and look how it contributes to your Merit Function value. Eventually it should become so significant that the optimizer won't allow it to be negative. If it remains negative, perhaps you do not have enough degrees of freedom in your system to achieve this performance.

Does that make sense?

Take care,