`[all packages] [package ] [class hierarchy] [index]`

# public class Solution

(source file: Solution.java)

    java.lang.Object
       |
       +----Solution

The pure class interface.

    public class Solution

  A class which solves a set of constraints.

  The algorithm is a simple 2-pass dynamic program.

  In the first pass, we minimize all of the variables, and find the maximum horizontal and maximum vertical variables.

  In the second pass, we maximize all of the variables, using the previously found maxima as upper bounds.

  This gives two values for each variable: a minimum and a maximum. We just average the two to give a result.

  This algorithm sometimes produces sub-optimal results (sometimes it can result in pretty extreme diagonals) but most times it produces reasonable graphs. It runs in linear time in the number of variables.

  Author:
    Alan Jeffrey
  Version: v1.0 1998/06/02
  See also:
    Constraints

##

Solution(Constraints)
  Build a solution to a constraint set.

##

C
  The constraints solved.
hMax
  The largest value of any horizontal variable.
vMax
  The largest value of any horizontal variable.

##

maximal(int)
  Find the maximum value associated with a variable.
minimal(int)
  Find the minimum value associated with a variable.
value(int)
  Find the average value associated with a variable.

##

Solution

    public Solution(Constraints C);

  Build a solution to a constraint set.

##

C

    public Constraints C;

  The constraints solved.

hMax

    public int hMax;

  The largest value of any horizontal variable.

vMax

    public int vMax;

  The largest value of any horizontal variable.

##

minimal

    public int minimal(int x);

  Find the minimum value associated with a variable.

  Parameters:
    x - the variable number to look up.
  Returns:
    the value of the variable.
  Throws:
    ArrayIndexOutOfBoundsException -if the variable number is not a valid index.

maximal

    public int maximal(int x);

  Find the maximum value associated with a variable.

  Parameters:
    x - the variable number to look up.
  Returns:
    the value of the variable.
  Throws:
    ArrayIndexOutOfBoundsException -if the variable number is not a valid index.

value

    public int value(int x);

  Find the average value associated with a variable.

  Parameters:
    x - the variable number to look up.
  Returns:
    the value of the variable.
  Throws:
    ArrayIndexOutOfBoundsException -if the variable number is not a valid index.

`[all packages] [package ] [class hierarchy] [index]`

###### Solution.html