public class GeneralFunction extends Object implements FunctionTerm
Constructor and Description |
---|
GeneralFunction(boolean nonNegative,
boolean squared,
int maxSize,
boolean mergeConstants) |
Modifier and Type | Method and Description |
---|---|
void |
add(float value)
Add a constant to the sum.
|
void |
add(float coefficient,
FunctionTerm term)
Add a general term to the sum.
|
float |
getCoefficient(int index) |
float |
getConstant() |
FunctionTerm |
getTerm(int index) |
float |
getValue()
Returns the term's value
|
float |
getValue(float[] values)
Get the value of this sum, but using the values passed in place of non-constants for the term.
|
float |
getValue(GroundAtom replacementAtom,
float replacementValue)
Get the value of the sum, but replace the value of a single RVA with the given value.
|
boolean |
isConstant()
Returns whether the term is constant.
|
boolean |
isLinear()
Returns whether the term is linear.
|
boolean |
isNonNegative() |
boolean |
isSquared() |
void |
setNonNegative(boolean nonNegative) |
void |
setSquared(boolean squared) |
int |
size() |
String |
toString() |
public GeneralFunction(boolean nonNegative, boolean squared, int maxSize, boolean mergeConstants)
public float getConstant()
public boolean isSquared()
public boolean isNonNegative()
public boolean isLinear()
FunctionTerm
isLinear
in interface FunctionTerm
public boolean isConstant()
FunctionTerm
isConstant
in interface FunctionTerm
public void setSquared(boolean squared)
public void setNonNegative(boolean nonNegative)
public void add(float value)
public void add(float coefficient, FunctionTerm term)
public int size()
public float getCoefficient(int index)
public FunctionTerm getTerm(int index)
public float getValue()
FunctionTerm
getValue
in interface FunctionTerm
public float getValue(float[] values)
public float getValue(GroundAtom replacementAtom, float replacementValue)
Copyright © 2022 University of California, Santa Cruz. All rights reserved.