Class COptQuestRegionVariable


public class COptQuestRegionVariable extends COptQuestManifoldVariable
A region variable. Its value is a point (x, y) in a plane polygon. Use a region variable when the decision is a location inside a region, such as a site inside a property boundary.

In every solution that the engine generates, the point is inside the polygon or on its boundary. The polygon can be non-convex. A point is inside by the even-odd rule, so a polygon whose edges cross itself is also accepted.

Variable names: <name>@x and <name>@y, the coordinates of the point, in the units of the polygon.

Give the vertices in either order, clockwise or counterclockwise. You do not need to repeat the first vertex at the end.

In most programs, you add this variable with OptQuestModel.AddRegionVariable 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

    • COptQuestRegionVariable

      public COptQuestRegionVariable(String name, double[][] polygon) throws COptQuestException
      Creates a region variable.
      Parameters:
      name - base name of the variable
      polygon - the vertices, one row {x, y} for each vertex; there must be at least three
      Throws:
      COptQuestException - if polygon is null, has fewer than three vertices or has a vertex with fewer than two coordinates, or if the polygon has no area
  • Method Details

    • getInputVariables

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

      The values of a region variable are in the list that getProjectedInputVariables() returns. That list has two variables, <name>@x and <name>@y.

      Returns:
      an empty list
    • getOutputVariables

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

      The values of a region variable are in the list that getProjectedInputVariables() returns. That list has two variables, <name>@x and <name>@y.

      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