Fixed issue with missing prev

This commit is contained in:
Andrew Lalis 2021-03-02 00:15:46 +01:00
parent 7207eeb6c2
commit 89a8e533b2
1 changed files with 5 additions and 5 deletions

View File

@ -7,10 +7,7 @@ import org.apache.commons.csv.CSVPrinter;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Comparator; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class HumanTaskDistributor { public class HumanTaskDistributor {
@ -24,7 +21,9 @@ public class HumanTaskDistributor {
FileParser fileParser = new FileParser(); FileParser fileParser = new FileParser();
Map<Human, Float> nameWeightMap = fileParser.parseHumanList(cmd.getOptionValue("hl")); Map<Human, Float> nameWeightMap = fileParser.parseHumanList(cmd.getOptionValue("hl"));
Set<Task> tasks = fileParser.parseTaskList(cmd.getOptionValue("tl")); Set<Task> tasks = fileParser.parseTaskList(cmd.getOptionValue("tl"));
List<Map<Human, Set<Task>>> previousDistributions = fileParser.parsePreviousTaskDistributions(cmd.getOptionValues("prev")); String[] previousDistributionPaths = cmd.getOptionValues("prev");
if (previousDistributionPaths == null) previousDistributionPaths = new String[0];
List<Map<Human, Set<Task>>> previousDistributions = fileParser.parsePreviousTaskDistributions(previousDistributionPaths);
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
Map<Human, Set<Task>> taskDistributions = new Distributor().generateDistribution(nameWeightMap, tasks, previousDistributions); Map<Human, Set<Task>> taskDistributions = new Distributor().generateDistribution(nameWeightMap, tasks, previousDistributions);
@ -53,6 +52,7 @@ public class HumanTaskDistributor {
} catch (Exception e) { } catch (Exception e) {
System.err.println("Error: " + e.getMessage()); System.err.println("Error: " + e.getMessage());
e.printStackTrace();
HelpFormatter hf = new HelpFormatter(); HelpFormatter hf = new HelpFormatter();
hf.printHelp("HumanTaskDistributor", options); hf.printHelp("HumanTaskDistributor", options);
System.exit(1); System.exit(1);