org.apache.commons.math3.optim.linear
public class LinearObjectiveFunction extends Object implements MultivariateFunction, OptimizationData, Serializable
A linear objective function has one the form:
c1x1 + ... cnxn + dThe ci and d are the coefficients of the equation, the xi are the coordinates of the current point.
Modifier and Type | Field and Description |
---|---|
private RealVector |
coefficients
Coefficients of the linear equation (ci).
|
private double |
constantTerm
Constant term of the linear equation.
|
private static long |
serialVersionUID
Serializable version identifier.
|
Constructor and Description |
---|
LinearObjectiveFunction(double[] coefficients,
double constantTerm) |
LinearObjectiveFunction(RealVector coefficients,
double constantTerm) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
RealVector |
getCoefficients()
Gets the coefficients of the linear equation being optimized.
|
double |
getConstantTerm()
Gets the constant of the linear equation being optimized.
|
int |
hashCode() |
private void |
readObject(ObjectInputStream ois)
Deserialize the instance.
|
double |
value(double[] point)
Computes the value of the linear equation at the current point.
|
double |
value(RealVector point)
Computes the value of the linear equation at the current point.
|
private void |
writeObject(ObjectOutputStream oos)
Serialize the instance.
|
private static final long serialVersionUID
private final transient RealVector coefficients
private final double constantTerm
public LinearObjectiveFunction(double[] coefficients, double constantTerm)
coefficients
- Coefficients for the linear equation being optimized.constantTerm
- Constant term of the linear equation.public LinearObjectiveFunction(RealVector coefficients, double constantTerm)
coefficients
- Coefficients for the linear equation being optimized.constantTerm
- Constant term of the linear equation.public RealVector getCoefficients()
public double getConstantTerm()
public double value(double[] point)
value
in interface MultivariateFunction
point
- Point at which linear equation must be evaluated.public double value(RealVector point)
point
- Point at which linear equation must be evaluated.private void writeObject(ObjectOutputStream oos) throws IOException
oos
- stream where object should be writtenIOException
- if object cannot be written to streamprivate void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException
ois
- stream from which the object should be readClassNotFoundException
- if a class in the stream cannot be foundIOException
- if object cannot be read from the streamCopyright (c) 2003-2013 Apache Software Foundation