|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.mhhe.clrs2e.DifferenceConstraints
Class for solving a system of difference constraints, as defined in Section 24.4 of Introduction to Algorithms, Second edition.
| Nested Class Summary | |
static class |
DifferenceConstraints.BadConstraintException
Inner class for a bad constraint exception. |
private static class |
DifferenceConstraints.Constraint
Inner class for an individual constraint. |
| Field Summary | |
(package private) com.mhhe.clrs2e.SentinelDLL |
system
A list of the difference constraints. |
| Constructor Summary | |
DifferenceConstraints()
Creates an empty system of difference constraints. |
|
| Method Summary | |
void |
addConstraint(int j,
int i,
double b)
Adds a constraint xj - xi ≤ bk to the system of difference constraints. |
double[] |
findFeasibleSolution()
Finds a feasible solution to the system of difference constraints, if a feasible solution exists. |
java.lang.String |
toString()
Returns the String representation of this system
of difference constraints. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
com.mhhe.clrs2e.SentinelDLL system
| Constructor Detail |
public DifferenceConstraints()
| Method Detail |
public void addConstraint(int j,
int i,
double b)
j - Index for the variable xj. Must be
at least 1.i - Index for the variable xi. Must be
at least 1.b - Value of bk.
DifferenceConstraints.BadConstraintException - if either of i or
j is less than 1.public double[] findFeasibleSolution()
null, then there is
no feasible solution. Otherwise, the return value is an array
x[0..n], where x[0] is undefined and
for i = 1, 2, ..., n, the appropriate value of the
feasible solution is in x[i].public java.lang.String toString()
String representation of this system
of difference constraints.
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||