Skip to content

Optimization API changes

Ye Luo edited this page Aug 16, 2022 · 11 revisions

Using WFC as an example, SPO and functors are similar

class OptimizableObject
{
  IsOptimizing # this component is actively being optimized. ?? need this?
  void checkInVariablesExclusive(opt_variables_type& active)
  void resetParametersExclusive(const opt_variables_type& active)
}

checkInVariablesExclusive and resetParametersExclusive should be called outside TWF tree.

class WFC/SPO
{
  virtual isOptimizable()
  virtual extractOptimizableObjectRefs()
  void checkOutVariables(const opt_variables_type& active)
    # set up indices based on active. This affects the behavior of evaluateDerivatives.
}

use case

opt_obj_list = Psi.extractOptimizableObjectRefs()
# optionally filter opt_obj
foreach opt_obj
  opt_obj.checkInVariablesExclusive()
# all the optimized parameters should have been selected.
Psi.checkOutVariables(active)
Psi.evaluateDeriv
... generate new param
foreach opt_obj
  opt_obj.resetParametersExclusive()
``


How to handle RHF?
1. once resetParameters is called outside there won't be an issue of calling resetParameters twice.
2. MSD RHF?