it.ssc.pl.milp.ObjectiveFunctionImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsr331-ssc Show documentation
Show all versions of jsr331-ssc Show documentation
This is a JSR331 interface for SSC (Software for the Calculation of the Simplex) is a java library for solving linear programming problems v. 3.0.1.
SSC was designed and developed by Stefano Scarioli.
The newest version!
package it.ssc.pl.milp;
import it.ssc.log.SscLogger;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;
class ObjectiveFunctionImpl implements Cloneable, ObjectiveFunction,Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private static final Logger logger=SscLogger.getLogger();
private double[] C;
private TARGET_FO type= TARGET_FO.MAX;
public ObjectiveFunctionImpl(int dimension) {
C=new double[dimension];
}
public void setCj(int j, double cj) {
//System.out.println("VALUE Cj "+cj);
C[j]=cj;
}
public double getCj(int j) {
return C[j];
}
public TARGET_FO getType() {
return type;
}
public void setType(TARGET_FO type) {
this.type = type;
}
public void standardize() {
if(this.type==TARGET_FO.MIN) {
this.type=TARGET_FO.MAX;
for(int j=0;j