Skip to content

Commit

Permalink
reinstate fad_limits_fine policy
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaspayette committed Dec 7, 2023
1 parent e967812 commit bf7d5ea
Showing 1 changed file with 36 additions and 26 deletions.
62 changes: 36 additions & 26 deletions epo/src/main/java/uk/ac/ox/poseidon/epo/PolicyRuns.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import java.nio.file.Paths;
import java.util.List;
import java.util.Map.Entry;
import java.util.stream.IntStream;

import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.collect.ImmutableMap.toImmutableMap;
import static java.util.stream.Collectors.toList;

public class PolicyRuns {

Expand All @@ -31,30 +32,35 @@ public static void main(final String[] args) {
final List<Integer> yearsActive = ImmutableList.of(2023);
final ImmutableList<Double> proportions = ImmutableList.of(0.75, 0.50, 0.25, 0.10, 0.0);
final ImmutableMap<String, List<Policy<EpoScenario<?>>>> policies = ImmutableMap.of(
"global_object_set_limits", new GlobalObjectSetLimit(
yearsActive,
// 8729 FAD + 4003 OFS in 2022:
proportions.stream().map(p -> (int) (p * (8729 + 4003))).collect(toList())
),
"fad_limits", new ActiveFadLimitsPolicies(
// "global_object_set_limits", new GlobalObjectSetLimit(
// yearsActive,
// // 8729 FAD + 4003 OFS in 2022:
// proportions.stream().map(p -> (int) (p * (8729 + 4003))).collect(toList())
// ),
// "fad_limits", new ActiveFadLimitsPolicies(
// yearsActive,
// 2022,
// proportions
// ),
"fad_limits_fine", new ActiveFadLimitsPolicies(
yearsActive,
2022,
proportions
),
"extended_closures", new ExtendedClosurePolicies(
yearsActive,
ImmutableList.of(5, 15, 30)
),
"el_corralito", new ExtendedElCorralitoPolicy(
yearsActive,
-5, 5, -120,
ImmutableList.of(5, 15, 30)
),
"western_closure", new WesternClosure(
yearsActive,
-120,
ImmutableList.of(5, 15, 30)
IntStream.rangeClosed(1, 20).mapToObj(i -> i * 0.05).collect(toImmutableList())
)
// "extended_closures", new ExtendedClosurePolicies(
// yearsActive,
// ImmutableList.of(5, 15, 30)
// ),
// "el_corralito", new ExtendedElCorralitoPolicy(
// yearsActive,
// -5, 5, -120,
// ImmutableList.of(5, 15, 30)
// ),
// "western_closure", new WesternClosure(
// yearsActive,
// -120,
// ImmutableList.of(5, 15, 30)
// )
)
.entrySet()
.stream()
Expand All @@ -63,7 +69,7 @@ public static void main(final String[] args) {
entry -> entry.getValue().getWithDefault()
));

final int numberOfRunsPerPolicy = 5;
final int numberOfRunsPerPolicy = 2;
final int numberOfPolicies = policies.values().stream().mapToInt(List::size).sum();
System.out.printf(
"About to run %d policies %d times (%d total runs)\n",
Expand All @@ -77,18 +83,22 @@ public static void main(final String[] args) {
.stream()
.parallel()
.forEach(entry -> {
final Path outputFolder = baseOutputFolder.resolve(entry.getKey());
String policyName = entry.getKey();
final Path outputFolder = baseOutputFolder.resolve(policyName);
final Runner<EpoPathPlannerAbundanceScenario> runner =
new Runner<>(EpoPathPlannerAbundanceScenario.class, baseScenario, outputFolder)
.setPolicies(entry.getValue())
.setParallel(true)
.setWriteScenarioToFile(true)
.requestFisherYearlyData()
.requestFisherDailyData()
.registerRowProvider("spatial_closures.csv", RectangularAreaExtractor::new)
.registerRowProvider("yearly_results.csv", YearlyResultsRowProvider::new)
.requestFisherYearlyData();
if (!policyName.equals("fad_limits_fine")) {
runner
.requestFisherDailyData()
.registerRowProvider("sim_trip_events.csv", PurseSeineTripLogger::new)
.registerRowProvider("sim_action_events.csv", PurseSeineActionsLogger::new);
}
runner.run(3, numberOfRunsPerPolicy);
});
}
Expand Down

0 comments on commit bf7d5ea

Please sign in to comment.