brandondube / dygdug

1 stars 5 forks source link

EFC governors / control strategies #12

Open brandondube opened 2 years ago

brandondube commented 2 years ago

In more general theory, sometimes you might see the term "governor" for something that regulates a control or optimization process. "Control strategies" is also somewhat common terminology to describe the process of "kicking" beta once in a while. The interface now is last_wfe, last_field = e.step() where last_wfe is the DM map (this will necessarily change when there are multiple DMs) and last_field is the intensity of the E-field at the beginning of the step.

This interface is already somewhat awkward, since after a step happens you have information about the input state to the step, but there is not so much that can be done about it; step() doesn't know about the field that comes next.

Anyway, if you want to do beta kicking, you have to write code something like this:

for i in tqdm(range(50)):
    if (i != 0 and ((i % 5) == 0)):
        efc.beta = -5
        efc.regularize_control_matrix()
        just_kicked = True
    else:
        if just_kicked:
            efc.beta = -2.5
            efc.regularize_control_matrix()
            just_kicked = False

    wfe, fld = efc.step()

This is error prone, for example missing the i!=0 clause will kick beta on iter 0. We should make governors for common cases, so that user can just do something like b = BetaKicker(every=5); b.run(e) to kick beta every 5 iterations, or some other set of initializers e.g., b = BetaKicker(on_iter=[5,10,20,40,80].

This hypothetical beta kicker should know about the EFC interface.