23
23
import lombok .Setter ;
24
24
import sim .engine .Steppable ;
25
25
import sim .util .Int2D ;
26
+ import tech .tablesaw .api .Table ;
26
27
import uk .ac .ox .poseidon .agents .behaviours .BackToInitialBehaviourFactory ;
27
28
import uk .ac .ox .poseidon .agents .behaviours .WaitBehaviourFactory ;
28
29
import uk .ac .ox .poseidon .agents .behaviours .choices .BestOptionsFromFriendsSupplierFactory ;
39
40
import uk .ac .ox .poseidon .agents .registers .Register ;
40
41
import uk .ac .ox .poseidon .agents .registers .RegisterFactory ;
41
42
import uk .ac .ox .poseidon .agents .registers .RegisteringFactory ;
43
+ import uk .ac .ox .poseidon .agents .tables .FishingActionListenerTableFactory ;
42
44
import uk .ac .ox .poseidon .agents .vessels .RandomHomePortFactory ;
43
45
import uk .ac .ox .poseidon .agents .vessels .VesselFactory ;
44
46
import uk .ac .ox .poseidon .agents .vessels .VesselScopeFactory ;
50
52
import uk .ac .ox .poseidon .core .Factory ;
51
53
import uk .ac .ox .poseidon .core .GlobalScopeFactory ;
52
54
import uk .ac .ox .poseidon .core .Scenario ;
53
- import uk .ac .ox .poseidon .core .Simulation ;
54
55
import uk .ac .ox .poseidon .core .schedule .ScheduledRepeatingFactory ;
55
56
import uk .ac .ox .poseidon .core .schedule .SteppableSequenceFactory ;
56
57
import uk .ac .ox .poseidon .core .suppliers .PoissonIntSupplierFactory ;
72
73
73
74
import java .nio .file .Path ;
74
75
import java .time .LocalDate ;
76
+ import java .time .Period ;
75
77
import java .util .List ;
78
+ import java .util .function .Supplier ;
76
79
77
80
@ SuppressWarnings ("MagicNumber" )
78
81
@ Getter
@@ -84,9 +87,9 @@ public class BasicScenario extends Scenario {
84
87
private Factory <? extends Species > speciesA = new SpeciesFactory ("A" );
85
88
private Factory <? extends Species > speciesB = new SpeciesFactory ("B" );
86
89
private Factory <? extends BiomassDiffusionRule > biomassDiffusionRule =
87
- new SmoothBiomassDiffusionRuleFactory (0.001 , 0.01 );
90
+ new SmoothBiomassDiffusionRuleFactory (0.01 , 0.01 );
88
91
private Factory <? extends BiomassGrowthRule > biomassGrowthRule =
89
- new LogisticGrowthRuleFactory (0.7 );
92
+ new LogisticGrowthRuleFactory (0.1 );
90
93
91
94
private GlobalScopeFactory <? extends GridExtent > gridExtent =
92
95
new GridExtentFactory (
@@ -97,6 +100,8 @@ public class BasicScenario extends Scenario {
97
100
-5 ,
98
101
5
99
102
);
103
+ private Factory <? extends Supplier <Table >> catchTable =
104
+ new FishingActionListenerTableFactory (gridExtent );
100
105
private Factory <? extends VesselField > vesselField = new VesselFieldFactory (gridExtent );
101
106
private Factory <? extends Distance > distance = new EquirectangularDistanceFactory (gridExtent );
102
107
private Factory <? extends BathymetricGrid > bathymetricGrid =
@@ -117,7 +122,6 @@ public class BasicScenario extends Scenario {
117
122
3 ,
118
123
2
119
124
);
120
-
121
125
private Factory <? extends GridPathFinder > pathFinder =
122
126
new DefaultPathFinderFactory (
123
127
bathymetricGrid ,
@@ -200,20 +204,20 @@ public class BasicScenario extends Scenario {
200
204
),
201
205
new ChooseDestinationBehaviourFactory (
202
206
new EpsilonGreedyDestinationSupplierFactory (
203
- 0.2 ,
207
+ 0.25 ,
204
208
optionValues ,
205
209
new NeighbourhoodGridExplorerFactory (
206
210
optionValues ,
207
211
pathFinder ,
208
212
new ShiftedIntSupplierFactory (
209
- new PoissonIntSupplierFactory (5 ),
213
+ new PoissonIntSupplierFactory (1 ),
210
214
1
211
215
)
212
216
),
213
217
new ImitatingPickerFactory <>(
214
218
optionValues ,
215
219
new BestOptionsFromFriendsSupplierFactory <>(
216
- 2 ,
220
+ 5 ,
217
221
optionValuesRegister
218
222
)
219
223
),
@@ -222,7 +226,7 @@ public class BasicScenario extends Scenario {
222
226
new TravelAlongPathBehaviourFactory (
223
227
new DefaultFishingBehaviourFactory <>(
224
228
new FixedBiomassProportionGearFactory (
225
- 0.05 ,
229
+ 0.1 ,
226
230
new DurationFactory (0 , 1 , 0 , 0 )
227
231
),
228
232
new VoidHoldFactory <>(),
@@ -263,16 +267,7 @@ public static void main(final String[] args) {
263
267
scenario ,
264
268
Path .of ("/home/nicolas/Desktop/scenario.yaml" )
265
269
);
266
- final Simulation simulation = scenario .newSimulation ();
267
- simulation .start ();
268
- while (
269
- simulation
270
- .getTemporalSchedule ()
271
- .getDateTime ()
272
- .isBefore (LocalDate .of (LocalDate .now ().getYear () + 10 , 1 , 1 ).atStartOfDay ())
273
- ) {
274
- simulation .schedule .step (simulation );
275
- }
276
- simulation .finish ();
270
+ new QuickRunner (scenario ).runFor (Period .ofYears (1 ));
271
+
277
272
}
278
273
}
0 commit comments