Class COptQuestAngleVariable


public class COptQuestAngleVariable extends COptQuestManifoldVariable
An angle variable. Its value is an angle in degrees on an arc of the circle. Use an angle variable when the decision is a direction in a plane, such as a panel orientation or a turbine yaw.

In every solution that the engine generates, the angle is on the arc from minDeg to maxDeg. When the difference between maxDeg and minDeg is 360 or more, the arc is the full circle. Otherwise the arc goes from minDeg to maxDeg in the direction of increasing angle, so an arc with minDeg greater than maxDeg, such as 320 to 40, crosses 0.

Variable names: <name>@theta, the angle in degrees.

The engine reports the angle as its equivalent from 0 up to, but not including, 360, not in the range that you declare. For example, for an arc declared from -45 to 45, the engine reports -45 as 315. To compare the value with the declared bounds, add or subtract 360 until the value is at least minDeg and less than minDeg + 360. The value is then from minDeg to maxDeg. When minDeg is greater than maxDeg, compare the value with maxDeg + 360 instead of maxDeg. For example, on the arc from 320 to 40, a reported 10 becomes 370, which is from 320 to 400.

In most programs, you add this variable with OptQuestModel.AddAngleVariable 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:
  • Constructor Details

    • COptQuestAngleVariable

      public COptQuestAngleVariable(String name) throws COptQuestException
      Creates an angle variable on the full circle.
      Parameters:
      name - base name of the variable
      Throws:
      COptQuestException - if an error occurs while the variable is created
    • COptQuestAngleVariable

      public COptQuestAngleVariable(String name, double minDeg, double maxDeg) throws COptQuestException
      Creates an angle variable on the arc from minDeg to maxDeg.
      Parameters:
      name - base name of the variable
      minDeg - start of the arc, in degrees
      maxDeg - end of the arc, in degrees
      Throws:
      COptQuestException - if minDeg or maxDeg is NaN
  • Method Details

    • getInputVariables

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

      The value of an angle variable is in the list that getProjectedInputVariables() returns. That list has one variable, <name>@theta.

      Returns:
      an empty list
    • getOutputVariables

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

      The value of an angle variable is in the list that getProjectedInputVariables() returns. That list has one variable, <name>@theta.

      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