Changeset 15553 for branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GQAPInstance.cs
- Timestamp:
- 12/20/17 15:41:27 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GQAPInstance.cs
r15510 r15553 191 191 192 192 public Evaluation Evaluate(IntegerVector assignment) { 193 returnEvaluateIntegerVector(assignment, Demands, Capacities,193 var evaluation = EvaluateIntegerVector(assignment, Demands, Capacities, 194 194 InstallationCosts, Weights, Distances); 195 return evaluation; 195 196 } 196 197 … … 217 218 } 218 219 220 public GQAPSolution ToEvaluatedSolution(IntegerVector assignment) { 221 var evaluation = EvaluateIntegerVector(assignment, Demands, Capacities, 222 InstallationCosts, Weights, Distances); 223 return new GQAPSolution(assignment, evaluation); 224 } 225 226 public bool IsFeasible(IntegerVector assignment) { 227 int len = assignment.Length; 228 var utilization = new double[Capacities.Length]; 229 for (var equip = 0; equip < len; equip++) { 230 var loc = assignment[equip]; 231 utilization[loc] += Demands[equip]; 232 if (utilization[loc] > Capacities[loc]) 233 return false; 234 } 235 return true; 236 } 237 219 238 public double ToSingleObjective(Evaluation fitness) { 220 239 return fitness.IsFeasible
Note: See TracChangeset
for help on using the changeset viewer.