public CountXYConstraint(String selectedVar, String countedVar, String operatorVar, CPInstance i) { this.selectedVar = selectedVar; this.countedVar = countedVar; this.operatorVar = operatorVar; lastVar = selectedVar; lastCount = countedVar; lastOP = operatorVar; Variable output = null; if (i.variableExists(countedVar)) { lastWasVar = true; isVar = true; output = i.getVarByName(countedVar); } else { lastWasVar = false; isVar = false; } base.variables = new List <Variable>(); if (output != null) { variables.Add(output); base.involvedVariables().Add(output); output.usedInConstraint(this); } }
public RouteConstraint(string lengthVar, int[][] distances, List <int> domain, CPInstance i) { this.lengthVar = lengthVar; this.distances = distances; this.domain = domain; lastLengthVar = lengthVar; lastDistances = distances; lastDomain = domain; Variable output = null; if (i.variableExists(lengthVar.Trim())) { lastWasVar = true; output = i.getVarByName(lengthVar.Trim()); } else { lastWasVar = false; } base.variables = new List <Variable>(); if (output != null) { variables.Add(output); base.involvedVariables().Add(output); output.usedInConstraint(this); } }