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, replaceAllTerms
private 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()
Term
public java.lang.String getName()
public java.util.Set<Variable> getVariables()
Term
getVariables
in class Term
public java.util.Set<Product> getProducts()
Term
getProducts
in class Term
public java.util.Set<Minimum> getMinimums()
Term
getMinimums
in class Term
public java.util.Set<Maximum> getMaximums()
Term
getMaximums
in class Term
public java.util.Set<AbsoluteValue> getAbsoluteValues()
Term
getAbsoluteValues
in class Term
public Term replaceTerm(Term toSubstitute, Term substitution)
Term
replaceTerm
in class Term
toSubstitute
- the term to be substitutedsubstitution
- the new termpublic void collapseAssociativeOperations()
Term
collapseAssociativeOperations
in class Term
public void expandAssociativeOperations()
Term
expandAssociativeOperations
in class Term
public boolean isContinuous(Variable v)
Term
isContinuous
in class Term
public Sum toLinearForm() throws java.lang.IllegalArgumentException
Term
toLinearForm
in class Term
java.lang.IllegalArgumentException
- if this term cannot be
converted into a linear normal form.public Term derive(Variable v)
Term
public Term simplify()
Term
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object