Class COptQuestSphericalRegionVariable


public class COptQuestSphericalRegionVariable extends COptQuestManifoldVariable
A spherical region variable. Its value is a point (latitude, longitude) in a polygon on the surface of the Earth. Use a spherical region variable when the decision is a location inside a geographic region, such as a sensor site inside a border.

In every solution that the engine generates, the point is inside the polygon or on its boundary. The edges of the polygon are great-circle arcs, not lines of constant latitude.

List the vertices clockwise, as on a map with north up: the region is on your right as you walk from each vertex to the next. This is the Esri rule for the outer ring of a polygon. The same vertices in counterclockwise order give the rest of the Earth. A region can enclose a pole, span more than 180 degrees of longitude, or be larger than a hemisphere. For a region around the North Pole, list the vertices from east to west. You do not need to repeat the first vertex at the end. The boundary must not cross itself.

Variable names:

  • <name>@theta: the latitude of the point, in degrees.
  • <name>@phi: the longitude of the point, in degrees, from -180 to 180.

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

    • COptQuestSphericalRegionVariable

      public COptQuestSphericalRegionVariable(String name, double[][] polygon) throws COptQuestException
      Creates a spherical region variable.
      Parameters:
      name - base name of the variable
      polygon - the vertices, one row {latitude, longitude} in degrees for each vertex, with the latitude first; there must be at least three
      Throws:
      COptQuestException - if polygon is null or has a vertex with fewer than two coordinates, a coordinate that is not finite or a latitude outside [-90, 90]; if it has fewer than three different vertices or two consecutive antipodal vertices; or if the boundary doubles back on itself or encloses no area
  • Method Details

    • getInputVariables

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

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

      Returns:
      an empty list
    • getOutputVariables

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

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

      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