Class COptQuestFourierVectorVariable


public class COptQuestFourierVectorVariable extends COptQuestManifoldVariable
A Fourier vector variable. Its value is a vector of length values that is a sum of the numFreq lowest-frequency cosine terms. Use a Fourier vector variable when the decision is a long profile that varies smoothly, such as a daily cycle.

The first term is a constant. The second term is half of a cosine wave across the whole vector. Each next term has one more half wave than the term before it, so the later terms have finer detail. With one term, every element has the same value. For element i, counted from 1, term k is cos(π k (i - 0.5) / length), where k counts from 0.

In every solution that the engine generates, every element is from min to max.

Variable names: <name>@1 to <name>@length, one for each element.

In most programs, you add this variable with OptQuestModel.AddFourierVectorVariable and read its values with OptQuestSolution.GetValue(String) and the generated names. Construct this class only when you add the variable with COptQuestOptimization.AddVariable(COptQuestVariable).

See Also:
  • OptQuestModel.AddFourierVectorVariable(String, int, int, double, double)
  • Constructor Details

    • COptQuestFourierVectorVariable

      public COptQuestFourierVectorVariable(String name, int length, int numFreq, double min, double max) throws COptQuestException
      Creates a Fourier vector variable.
      Parameters:
      name - base name of the variable
      length - number of elements; must be at least 1
      numFreq - number of cosine terms, including the constant term; the vector is smoother with fewer terms. A value less than 1 is used as 1, and a value greater than the number of elements is used as that number.
      min - lower bound of every element
      max - upper bound of every element
      Throws:
      COptQuestException - if an error occurs while the variable is created
  • Method Details

    • getInputVariables

      public List<COptQuestVariable> getInputVariables()
      Returns an empty list, because a Fourier vector variable has no ordinary input variables.

      The values of a Fourier vector variable are in the list that getProjectedInputVariables() returns. That list has the variables <name>@1 to <name>@length, one for each element.

      Returns:
      an empty list
    • getOutputVariables

      public List<COptQuestUserControlledVariable> getOutputVariables()
      Returns an empty list, because a Fourier vector variable has no output variables.

      The values of a Fourier vector variable are in the list that getProjectedInputVariables() returns. That list has the variables <name>@1 to <name>@length, one for each element.

      Returns:
      an empty list
    • getProjectedInputVariables

      public List<COptQuestUserControlledVariable> getProjectedInputVariables()
      Description copied from class: COptQuestManifoldVariable
      Returns the decision values of this manifold variable that are not ordinary decision variables.

      For example, an angle variable returns angle@theta, and a mixture variable returns one mix@<component> name for each component. In every solution that the engine generates, and in every suggested solution, these values are inside the set of the variable. Your evaluator reads them as inputs: OptQuestSolution.GetInputNames() returns them.

      A constraint that uses one of these names is checked after the evaluation, like a constraint on an output. Your evaluator can receive values that break the constraint, and the solution is then infeasible.

      Specified by:
      getProjectedInputVariables in class COptQuestManifoldVariable
      Returns:
      fixed-size or immutable list of these variables; never null