Class CompositeOptimizer

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, HandlesInternalLinks

    public class CompositeOptimizer
    extends ReflectComposite
    This actor implements a composite optimizer that optimizes a function provided as an SDF model in the inner composite. To use the composite optimizer, construct an SDF model on the inside that operates on the x input to output two values: (i) an intermediate result, that is a function of x and possibly other inputs and (ii) a double array containing the values of the constraints, calculated for the specific x input.

    In the case that the objective function is only a function of x, the trigger input should be used to start a new optimization round.

    The variable named "maxEvaluations" can be used to limit the number of evaluations. Specifically, the inside SDF model will be fired at most maxEvaluations times. There may be several reasons it is fired less than this number. The iteration may terminate due to any of the following reasons: (i) convergence criteria met (ii) user requests termination (iii) the roundoff errors become damaging, especially if the function is not smooth, and no optimal value can be found under given constraints (iv) maximum number of evaluations are reached.

    This actor is properly viewed as a "higher-order component" in that its contained actor is a parameter that specifies how to operate on input arrays. It is inspired by the higher-order functions of functional languages, but unlike those, the contained actor need not be functional. That is, it can have state.

    Current implementation uses Cobyla as the solver. Cobyla implements the trust-region-reflective algorithm and performs a type of gradient descent optimization, ideal for objective functions that are non-convex and/or with unknown gradient.

    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Ilge Akkaya, Edward A. Lee
    Pt.AcceptedRating:
    Pt.ProposedRating:
    Red (ilgea)
    • Field Detail

      • rhoBeg

        public Parameter rhoBeg
        The expert parameter that denotes the beginning step-size.
      • rhoEnd

        public Parameter rhoEnd
        The expert parameter that denotes the final step-size.
      • reusePreviousResult

        public Parameter reusePreviousResult
        The expert parameter that decides whether to reuse previous result as the initial value.
      • maxEvaluations

        public Parameter maxEvaluations
        Maximum number of function evaluations per iteration.
      • mode

        public Parameter mode
        Optimization mode. ( min or max)
      • timeHorizon

        public Parameter timeHorizon
        Time horizon over which f(x) is optimized. Not implemented at the moment.
      • dimensionOfOptimizationSpace

        public Parameter dimensionOfOptimizationSpace
        The dimension of optimization space. Also equal to the length of the optimization variable array, x.
      • numberOfConstraints

        public Parameter numberOfConstraints
        Number of constraints checked at each evaluation. The expected type of constraints is a double array with length numberOfConstraints.
      • optimalValue

        public TypedIOPort optimalValue
        Optimal Value
    • Method Detail

      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Description copied from class: ReflectComposite
        Clone the object into the specified workspace. This overrides the base class to set up the associations in the mirror ports and to set a flag indicating that cloning is complete.
        Overrides:
        clone in class ReflectComposite
        Parameters:
        workspace - The workspace for the new object.
        Returns:
        A new NamedObj.
        Throws:
        java.lang.CloneNotSupportedException - If any of the attributes cannot be cloned.
        See Also:
        CompositeEntity.exportMoML(Writer, int, String)