public abstract class Variable extends Term
| Modifier and Type | Field and Description |
|---|---|
private boolean |
isPositive
Whether this variables should be positive.
|
private double |
lowerBound
Bounds for the variables
|
private java.lang.String |
name
The name of the variable.
|
private double |
upperBound
Bounds for the variables
|
| Constructor and Description |
|---|
Variable(java.lang.String name)
Creates a new variable with the given name.
|
Variable(java.lang.String name,
boolean isPositive)
Creates a new variable with the given name.
|
Variable(java.lang.String name,
double lowerBound,
double upperBound)
Creates a new variable with the given name and bounds.
|
| Modifier and Type | Method and Description |
|---|---|
void |
collapseAssociativeOperations()
This method collapses all associative operations appearing
in this term, e.g.
|
Term |
derive(Variable v)
Differentiates the term with respect to the given variable.
|
boolean |
equals(java.lang.Object obj) |
void |
expandAssociativeOperations()
This method expands all associative operations appearing
in this term, e.g.
|
java.util.Set<AbsoluteValue> |
getAbsoluteValues()
Returns all absolute values of this term.
|
double |
getLowerBound()
Returns the lower bound of this variable.
|
java.util.Set<Maximum> |
getMaximums()
Returns all maximums of this term.
|
java.util.Set<Minimum> |
getMinimums()
Returns all minimums of this term.
|
java.lang.String |
getName()
Returns the name of this variable.
|
java.util.Set<Product> |
getProducts()
Returns all products of this term.
|
double |
getUpperBound()
Returns the upper bound of this variable.
|
java.util.Set<Variable> |
getVariables()
Returns all variables in this term.
|
int |
hashCode() |
boolean |
isContinuous(Variable v)
Checks whether this term is continuous in v.
|
boolean |
isPositive()
Checks whether this variables should be positive.
|
Term |
replaceTerm(Term toSubstitute,
Term substitution)
Replaces each occurrence of "toSubstitute" by "substitution" and
return the new term.
|
Term |
simplify()
Simplifies this term in an equivalent way:
- Replaces products that contain a zero by the constant zero - Removes a term one from products - Removes a term zero from sums - Aggregates constants in sums, products, and minimums - Evaluates functional terms on constants - Simplifies fractions where possible. |
Sum |
toLinearForm()
Converts this term into a linear normal form, i.e.
|
java.lang.String |
toString() |
Constant |
value()
Computes the actual value of this term if it contains no variables.
|
add, doubleValue, evaluateMatrix, evaluateVector, evaluateVector, isContinuous, isInteger, isLinear, min, minus, mult, replaceAllTerms, replaceAllTermsprivate java.lang.String name
private boolean isPositive
private double upperBound
private double lowerBound
public Variable(java.lang.String name)
name - the name of this variable.public Variable(java.lang.String name,
boolean isPositive)
name - the name of this variable.isPositive - whether this variables should be positive.public Variable(java.lang.String name,
double lowerBound,
double upperBound)
name - the name of this variable.lowerBound - the lower bound of the variable.upperBound - the upper bound of the variable.public boolean isPositive()
public double getUpperBound()
public double getLowerBound()
public Constant value()
Termpublic java.lang.String getName()
public java.util.Set<Variable> getVariables()
TermgetVariables in class Termpublic java.util.Set<Product> getProducts()
TermgetProducts in class Termpublic java.util.Set<Minimum> getMinimums()
TermgetMinimums in class Termpublic java.util.Set<Maximum> getMaximums()
TermgetMaximums in class Termpublic java.util.Set<AbsoluteValue> getAbsoluteValues()
TermgetAbsoluteValues in class Termpublic Term replaceTerm(Term toSubstitute, Term substitution)
TermreplaceTerm in class TermtoSubstitute - the term to be substitutedsubstitution - the new termpublic void collapseAssociativeOperations()
TermcollapseAssociativeOperations in class Termpublic void expandAssociativeOperations()
TermexpandAssociativeOperations in class Termpublic boolean isContinuous(Variable v)
TermisContinuous in class Termpublic Sum toLinearForm() throws java.lang.IllegalArgumentException
TermtoLinearForm in class Termjava.lang.IllegalArgumentException - if this term cannot be
converted into a linear normal form.public Term derive(Variable v)
Termpublic Term simplify()
Termpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object