it.ssc.pl.milp.InternalConstraint 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;
final class InternalConstraint implements Cloneable,Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private static final Logger logger=SscLogger.getLogger();
public enum TYPE_CONSTR {EQ, LE, GE};
private double[] Ai;
private double bi;
private TYPE_CONSTR type;
private String name;
public InternalConstraint(int dimension) {
Ai=new double[dimension];
}
public double[] getAi() {
return Ai;
}
public void setAij(int j, Double aij) {
Ai[j]=aij;
}
public void setAi(double[] Ai) {
this.Ai=Ai;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getAij(int j) {
return Ai[j];
}
public void setBi(double bi) {
this.bi = bi;
}
public double getBi() {
return bi;
}
public TYPE_CONSTR getType() {
return type;
}
public ConsType getConsType() {
if(type==TYPE_CONSTR.EQ) return ConsType.EQ;
else if(type==TYPE_CONSTR.LE) return ConsType.LE;
else if(type==TYPE_CONSTR.GE) return ConsType.GE;
else return null;
}
public void setType(TYPE_CONSTR type) {
this.type = type;
}
public void standardize_b() {
if(bi < 0.0) {
bi=-bi;
for(int j=0;j