Commit c7c08603 authored by Tobias MEGGENDORFER's avatar Tobias MEGGENDORFER
Browse files

Small changes

parent 6f636c55
......@@ -174,8 +174,8 @@
},
{
"actions": {
"A1": "b",
"A2": "b",
"A1": "a",
"A2": "a",
"A3": "b"
},
"to": "s8"
......
......@@ -167,12 +167,25 @@ public final class Main implements Callable<Void> {
.toList();
log.log(Level.INFO, () -> "Solving took %s overall".formatted(overall));
if (!solutionList.isEmpty()) {
writeIfPresent(writeDotSolution, solutionList, (list, stream) -> {
for (GameSolution<?> solution : list) {
DotWriter.writeSolution(solution, stream);
stream.println();
if (writeDotSolution != null) {
if (writeDotSolution.contains("%A"))
for (GameSolution<S> solution : solutionList) {
var destination = writeDotSolution.replaceAll("%A", game.agents().stream().sorted()
.map(solution.assignment()::map)
.map(Agent.Payoff::toString)
.collect(Collectors.joining()));
try(var stream = open(destination)) {
DotWriter.writeSolution(solution, stream);
}
} else {
writeIfPresent(writeDotSolution, solutionList, (list, stream) -> {
for (GameSolution<?> solution : list) {
DotWriter.writeSolution(solution, stream);
stream.println();
}
});
}
});
}
}
if (input.validationSet != null) {
validate(game, solutionList, input.validationSet);
......
......@@ -6,7 +6,7 @@ import java.util.Objects;
import java.util.stream.Collectors;
import owl.ltl.Formula;
public final class Agent {
public final class Agent implements Comparable<Agent> {
public enum Payoff {
WINNING, LOSING, UNDEFINED;
......@@ -53,6 +53,11 @@ public final class Agent {
return actions.values();
}
@Override
public int compareTo(Agent o) {
return name.compareTo(o.name);
}
public Action action(String name) {
return Objects.requireNonNull(actions.get(name));
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment