List of usage examples for org.apache.commons.math.optimization.linear LinearConstraint LinearConstraint
public LinearConstraint(final RealVector lhsCoefficients, final double lhsConstant, final Relationship relationship, final RealVector rhsCoefficients, final double rhsConstant)
From source file:fi.smaa.libror.UTAGMSSolver.java
private List<LinearConstraint> buildMonotonousConstraints(int critIndex) { List<LinearConstraint> constList = new ArrayList<LinearConstraint>(); RealVector levels = model.getPerfMatrix().getLevels()[critIndex]; for (int i = 0; i < levels.getDimension() - 1; i++) { double[] lhs = new double[getNrLPVariables()]; double[] rhs = new double[getNrLPVariables()]; lhs[getConstraintOffset(critIndex) + i] = 1.0; rhs[getConstraintOffset(critIndex) + i + 1] = 1.0; if (strictValueFunctions) { lhs[lhs.length - 1] = 1.0; // epsilon }/*from w ww . j a v a2 s . c o m*/ constList.add(new LinearConstraint(lhs, 0.0, Relationship.LEQ, rhs, 0.0)); } return constList; }
From source file:fi.smaa.libror.UTAGMSSolver.java
/** * a is strictly preferred to b (v(a) >= v(b) + epsilon) * @param a/*from www . j a va2 s . co m*/ * @param b * @return */ private LinearConstraint buildStrictlyPreferredConstraint(int a, int b) { double[] lhsVars = new double[getNrLPVariables()]; double[] rhsVars = new double[getNrLPVariables()]; setVarsPositive(lhsVars, a); setVarsPositive(rhsVars, b); // set epsilon rhsVars[rhsVars.length - 1] = 1.0; return new LinearConstraint(lhsVars, 0.0, Relationship.GEQ, rhsVars, 0.0); }
From source file:fi.smaa.libror.UTAGMSSolver.java
private LinearConstraint buildWeaklyPreferredConstraint(int a, int b) { double[] lhsVars = new double[getNrLPVariables()]; double[] rhsVars = new double[getNrLPVariables()]; setVarsPositive(lhsVars, a);//from w w w .j a v a 2 s . com setVarsPositive(rhsVars, b); return new LinearConstraint(lhsVars, 0.0, Relationship.GEQ, rhsVars, 0.0); }