edu.hawaii.ics.yucheng
Class JadeSolver.SolutionMatrix

java.lang.Object
  extended by edu.hawaii.ics.yucheng.Matrix<java.lang.Boolean>
      extended by edu.hawaii.ics.yucheng.JadeSolver.SolutionMatrix
Enclosing class:
JadeSolver

 class JadeSolver.SolutionMatrix
extends Matrix<java.lang.Boolean>

A solution matrix, which is a matrix with v rows and v columns that holds booleans indicating whether or not vertices are connected.


Constructor Summary
  JadeSolver.SolutionMatrix(JadeSolver.GraphData g)
          Initializes a new instance of the class based on the number of vertices in a graph.
private JadeSolver.SolutionMatrix(JadeSolver.SolutionMatrix m)
          Initializes a new instance of the class based on the specified matrix.
 
Method Summary
 JadeSolver.SolutionMatrix clone()
          Returns a clone of the solution matrix.
private  java.util.Collection<Edge> getEdges()
          Returns the edges in the collection.
 GraphSolution getSolution()
          Returns a partial solution, i.e.
 GraphSolution getSolution(JadeSolver.VertexNode root, float weight)
          Returns a solution with a root vertex selection and a weight.
 boolean isMarked(int a, int b)
          Returns true if an item in the matrix is marked true.
 void mark(int a, int b)
          Marks two vertices to define an edge.
 void mark(JadeSolver.VertexNode a, JadeSolver.VertexNode b)
          Marks two vertices to define an edge.
 void reset()
          Un-marks all vertices.
 void set(int a, int b, java.lang.Boolean value)
          Sets a value in the matrix.
 
Methods inherited from class edu.hawaii.ics.yucheng.Matrix
columns, get, rows, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JadeSolver.SolutionMatrix

public JadeSolver.SolutionMatrix(JadeSolver.GraphData g)
Initializes a new instance of the class based on the number of vertices in a graph.

Parameters:
g - A graph.

JadeSolver.SolutionMatrix

private JadeSolver.SolutionMatrix(JadeSolver.SolutionMatrix m)
Initializes a new instance of the class based on the specified matrix.

Parameters:
m - The matrix.
Method Detail

clone

public JadeSolver.SolutionMatrix clone()
Returns a clone of the solution matrix.

Overrides:
clone in class Matrix<java.lang.Boolean>
Returns:
A clone of the solution matrix.

getEdges

private java.util.Collection<Edge> getEdges()
Returns the edges in the collection.

Returns:
The edges.

getSolution

public GraphSolution getSolution()
Returns a partial solution, i.e. no root node and no weight.

Returns:
A partial solution.

getSolution

public GraphSolution getSolution(JadeSolver.VertexNode root,
                                 float weight)
Returns a solution with a root vertex selection and a weight.

Parameters:
root - The root vertex.
weight - The total weight.
Returns:
The solution.

isMarked

public boolean isMarked(int a,
                        int b)
Returns true if an item in the matrix is marked true.

Parameters:
a - The first vertex.
b - The second vertex.
Returns:
True indicates the vertices edge is marked.

mark

public void mark(int a,
                 int b)
Marks two vertices to define an edge.

Parameters:
a - One vertex.
b - Another vertex.

mark

public void mark(JadeSolver.VertexNode a,
                 JadeSolver.VertexNode b)
Marks two vertices to define an edge.

Parameters:
a - One vertex.
b - Another vertex.

reset

public void reset()
Un-marks all vertices.


set

public void set(int a,
                int b,
                java.lang.Boolean value)
Sets a value in the matrix. The values are mirrored so edges can be defined in any order.

Overrides:
set in class Matrix<java.lang.Boolean>
Parameters:
a - One vertex
b - Another vertex.
value - The value.