Class Solution


  • public class Solution
    extends java.lang.Object
    An instance of this class contains a "solution" of Unit constraints. In essence, the solution represents the constraints between a set of Unit variables, and a set of Units. The table below illustrates this.
    Unit Constraints
    V1 V2 ... Vl
    C1 P11 P12 ... P1l U1
    C2 P21 P22 ... P2l U2
    : : : ... : :
    Ck Pk1 Pk2 ... Pkl Uk
    Here, the columns V1, V2, ..., Vl represent l variables. The columns C1, C2, ..., Ck represent k constraints. The U1, U2, ..., Uk on the right represent Units. The meaning of the ith row is that V1^Pi1 + V2^pi2 + .. +Vk^pik = Uk.

    Generally, this class is used by creating an instance that is derived from the Units specifications of a model. Then, a method is invoked that results in other instances being created that are transformations of the original instance. These transformed instances are equivalent, in a sense, to the original instance. The difference is that they provide a different perspective than that of the original instance. In particular, some of the transformed instances can be used to highlight inconsistencies not apparent in the original instance.

    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Rowland R Johnson
    Pt.AcceptedRating:
    Red (rowland)
    Pt.ProposedRating:
    Red (rowland)
    • Constructor Summary

      Constructors 
      Constructor Description
      Solution​(TypedCompositeActor model, java.lang.String[] vLabels, java.util.Vector constraints)
      Construct a Solution from a set of variables, and a set of constraints.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void annotateGraph()
      Annotates the model so that when it is displayed it will be color coded and have tooltips that will convey various aspects of the solution.
      Solution completeSolution()
      Search for a complete solution.
      Solution copy()
      Make a copy of this solution.
      java.lang.String getShortStateDesc()
      Get the state of the solution.
      java.lang.String getStateDesc()
      Get the state of the solution.
      java.lang.StringBuffer headerInfo()
      Create a human readable presentation of the parts of the solution that won't change as a result of the operations necessary to carry out the Gaussian elimination.
      java.util.Vector minimalSpanSolutions()
      Produce all of the minimal span solutions that can be generated from this instance.
      java.lang.StringBuffer stateInfo()
      The current state of the solver.
      void trace()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Solution

        public Solution​(TypedCompositeActor model,
                        java.lang.String[] vLabels,
                        java.util.Vector constraints)
                 throws IllegalActionException
        Construct a Solution from a set of variables, and a set of constraints.
        Parameters:
        model - The model that is the source of the variables and constraints.
        vLabels - The variables.
        constraints - The constraints.
        Throws:
        IllegalActionException - If there are problems with transforming a constraint to canonical form.
    • Method Detail

      • annotateGraph

        public void annotateGraph()
        Annotates the model so that when it is displayed it will be color coded and have tooltips that will convey various aspects of the solution.
      • completeSolution

        public Solution completeSolution()
        Search for a complete solution.
        Returns:
        The solution.
      • copy

        public Solution copy()
        Make a copy of this solution.
        Returns:
        The copy.
      • getShortStateDesc

        public java.lang.String getShortStateDesc()
        Get the state of the solution.
        Returns:
        The state of the solution.
      • getStateDesc

        public java.lang.String getStateDesc()
        Get the state of the solution.
        Returns:
        The state of the solution.
      • headerInfo

        public java.lang.StringBuffer headerInfo()
        Create a human readable presentation of the parts of the solution that won't change as a result of the operations necessary to carry out the Gaussian elimination. I.e. the variable names, and the constraints.
        Returns:
        A StringBuffer with a human readable presentation of the invariant parts of the solution.
      • minimalSpanSolutions

        public java.util.Vector minimalSpanSolutions()
        Produce all of the minimal span solutions that can be generated from this instance. A minimal span solution is one in which a minimal number of constraints that are connected yield an inconsistency.
        Returns:
        The vector of minimal span solutions.
      • stateInfo

        public java.lang.StringBuffer stateInfo()
        The current state of the solver. A StringBuffer is produced that shows the variables, done vector, P array, and A vector in a human readable arrangement.
        Returns:
        A StringBuffer with the state of the solver.
      • trace

        public void trace()