double factor1, EleConnector var1,
double factor2, EleConnector var2,
double factor3, EleConnector var3,
String op, double limit) {
Linear linear = new Linear();
double limitCorrection = 0;
if (var1 != null) {
LPVariablePair c1 = variableMap.get(var1);
linear.add(factor1, c1.posVar());
linear.add(-factor1, c1.negVar());
limitCorrection += factor1 * var1.getPosXYZ().y;
}
if (var2 != null) {
LPVariablePair c2 = variableMap.get(var2);
linear.add(factor2, c2.posVar());
linear.add(-factor2, c2.negVar());
limitCorrection += factor2 * var2.getPosXYZ().y;
}
if (var3 != null) {
LPVariablePair c3 = variableMap.get(var3);
linear.add(factor3, c3.posVar());
linear.add(-factor3, c3.negVar());
limitCorrection += factor3 * var3.getPosXYZ().y;
}
problem.add(linear, op, limit - limitCorrection);