-
Notifications
You must be signed in to change notification settings - Fork 0
/
explorationALUMSS.oms
979 lines (930 loc) · 30.5 KB
/
explorationALUMSS.oms
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
// to execute from the command line: openmole -s explorationALUMSS.oms
// output files
val agreOut = Val[File]
val f = Val[File]
// random number generator seed
val mySeed = Val[Int]
// model parameters
val ksi = Val[Double]
val y0 = Val[Double]
val sar = Val[Double]
val a = Val[Double]
val w = Val[Double]
val Tag = Val[Double]
val Tab = Val[Double]
val Tr = Val[Double]
val Td = Val[Double]
val d = Val[Double]
val mdc = Val[Double]
val ndc = Val[Double]
// simulation parameters
val T = Val[Double]
val dtp = Val[Double]
val L = Val[Double]
val d0 = Val[Double]
val a0 = Val[Double]
val dtsave = Val[Double]
// variable outputs
val t = Val[Double]
val nFrag = Val[Double]
val meanSize = Val[Double]
val stdSize = Val[Double]
val maxSize = Val[Double]
val meanES = Val[Double]
val stdES = Val[Double]
val P = Val[Double]
val N = Val[Double]
val D = Val[Double]
val A0 = Val[Double]
val A1 = Val[Double]
val Y = Val[Double]
val C = Val[Double]
val nMax = Val[Double]
val nMin = Val[Double]
val pMax = Val[Double]
val pMin = Val[Double]
val ripleyN = Val[Double]
val ripleyD = Val[Double]
val ripleyA0 = Val[Double]
val ripleyA1 = Val[Double]
val meanR = Val[Double]
val stdR = Val[Double]
val corrLen = Val[Double]
val Pmean = Val[Double]
val Nmean = Val[Double]
val Pstd = Val[Double]
val Nstd = Val[Double]
///////////////////////////////////////////////////////////////////////////////
// 1- MODEL PLUGIN AS AN EXECUTABLE FILE
///////////////////////////////////////////////////////////////////////////////
val scriptTask =
SystemExecTask(
command = Seq(
"./alumss-exec ${T} ${dtp} ${L} ${a0} ${d0} ${ksi} ${y0} ${sar} ${a} ${w} ${Tag} ${Tab} ${Tr} ${Td} ${d} ${mdc} ${ndc} ${dtsave} ${mySeed} "),
)set(
(inputs, outputs) += (T,dtp,L,a0,d0,ksi,y0,sar,a,w,Tag,Tab,Tr,Td,d,mdc,ndc,dtsave,mySeed),
// outputFiles is the path to the file containing the model outputs
// outputFiles += ("DATA_AGRE_T_${T}_dtp_${dtp}_n_${L}_a0_${a0}_d0_${d0}_ksi_${ksi}_y0_${y0}_sar_${sar}_a_${a}_w_${w}_Tag_${Tag}_Tab_${Tab}_Tr_${Tr}_Td_${Td}_d_${d}_dtsave_${dtsave}_expid_${mySeed}.dat",agreOut),
outputFiles += ("DATA_AGRE",agreOut),
// resources is the path to the executable that runs the simulations
resources += "/home/AD.LSM.CNRS.FR/diego.bengochea-paz/ALUMSS/ALUMSS/alumss-exec",
// resources += "/home/karpouzi/Research/Chapter2/gillespie-land-use/alumss-exec",
// default parameter and initialization values
T:=3000.0,
dtp:=0.1,
L:=40,
a0:=0.2,
d0:=0.0,
ksi:=1.2,
y0:=0.2,
sar:=0.25,
a:=0.0,
w:=0.0,
Tag:=0.1,
Tab:=50.0,
Tr:=5.0,
Td:=50.0,
d:=1.0,
mdc:=1.1,
ndc:=1.1,
dtsave:=4000.0,
mySeed:=1111
)
///////////////////////////////////////////////////////////////////////////////
// 2 - HOOKS FOR THE REPLICATION EXPERIMENTS
///////////////////////////////////////////////////////////////////////////////
// hook to append the output across time of a simulation a replications file.
// the name of the replication file contains the information on the parameter
// values
val hookAppend = AppendToFileHook(workDirectory/"REPS_AGRE_T_${T}_dtp_${dtp}_n_${L}_a0_${a0}_d0_${d0}_ksi_${ksi}_y0_${y0}_sar_${sar}_a_${a}_w_${w}_Tag_${Tag}_Tab_${Tab}_Tr_${Tr}_Td_${Td}_d_${d}_mdc_${mdc}_ndc_${ndc}_dtsave_${dtsave}.csv", "${agreOut.content}")
// hook to create and initialize the header of a replications file. file must
// be previously created in a scalaTask
// the name of the replication file contains the information on the parameter
// values
val copyHook = CopyFileHook(f, workDirectory/"REPS_AGRE_T_${T}_dtp_${dtp}_n_${L}_a0_${a0}_d0_${d0}_ksi_${ksi}_y0_${y0}_sar_${sar}_a_${a}_w_${w}_Tag_${Tag}_Tab_${Tab}_Tr_${Tr}_Td_${Td}_d_${d}_mdc_${mdc}_ndc_${ndc}_dtsave_${dtsave}.csv")
///////////////////////////////////////////////////////////////////////////////
// 3- ENVIRONMENT SETUP: USE 40 LOCAL CORES
///////////////////////////////////////////////////////////////////////////////
val env = LocalEnvironment(40)
///////////////////////////////////////////////////////////////////////////////
// 4 - DECLARATION OF NUMERICAL EXPERIMENTS
//////////////////////////////////////////////////////////////////////////////
// doing a couple of replications to see the dynamics emerging from changin ndc
val parameterSet = ScalaTask("""
val ksi = 1.2
val y0 = 0.2
val sar = 0.25
val a = 0.0
val w = 0.0
val Tag = 0.1
val Tab = 50.0
val Tr = 5.0
val Td = 50.0
val d = 3.1
val T = 3000.0
val dtp = 0.1
val L = 40.0
val d0 = 0.0
// val a0 = 0.2
val mdc = 1.1
val ndc = 3.1
val dtsave = 1.0
// create a file with a header consisting of all the model macro outputs
val f = newFile()
f.content = "t P N D A0 A1 Y nFrag meanSize stdSize maxSize meanES stdES connectance nMax nMin pMax pMin ripleyN ripleyD ripleyA0 ripleyA1 meanR stdR corrLen\n"
""") set(
inputs += a0,
outputs += (f,T,dtp,L,a0,d0,ksi,sar,a,w,Tag,Tab,Tr,y0,Td,d,mdc,ndc,dtsave)
)
val replications =
Replication(
evaluation = scriptTask hook hookAppend on env,
seed = mySeed,
sample = 5
)
val explorationA0 = ExplorationTask( a0 in Seq(0.1,0.2,0.5) )
// val explorationNDC = ExplorationTask( ndc in Seq(1.1,2.1,3.1,4.1,5.1) )
//
// val explorationMDC = ExplorationTask( mdc in Seq(1.1,2.1,3.1,4.1,5.1) )
explorationA0 -< (parameterSet hook copyHook) -- replications
// explorationNDC -< (parameterSet hook copyHook) -- replications
// explorationMDC -< (parameterSet hook copyHook) -- replications
// i saw that ndc = 3.1 was interesting ! i now vary mdc to catch possible interactions
// between them, I should think of a deeper question to ask with my OM tools
// doing a couple of replications to see the dynamics emerging from changin mdc
// direct sampling for bifurcation diagram as a function of ndc
//
// val readOutputFile =
// ScalaTask("""
// // read file as an array of lines and get last line
// val lastLineAgre = scala.io.Source.fromFile(agreOut).getLines.toList.last.mkString
// // split the string and store it in an array
// val valuesAgre = lastLineAgre.split(" ")
//
// val P = valuesAgre(1).toDouble
// val N = valuesAgre(2).toDouble
// val D = valuesAgre(3).toDouble
// val A0 = valuesAgre(4).toDouble
// val nMax = valuesAgre(14).toDouble
// val nMin = valuesAgre(15).toDouble
// val pMax = valuesAgre(16).toDouble
// val pMin = valuesAgre(17).toDouble
// """
//
// )set(
// inputs+=agreOut,
// (inputs, outputs)+=(T,dtp,L,a0,d0,ksi,y0,sar,a,w,Tag,Tab,Tr,Td,d,mdc,ndc,dtsave,mySeed),
// outputs+=(P,N,D,A0,nMax,nMin,pMax,pMin)
// )
//
// val runAndRead = MoleTask(scriptTask -- readOutputFile)
//
// val replicationsLongTerm =
// Replication(
// evaluation = runAndRead,
// seed = mySeed,
// sample = 5,
// aggregation = Seq (
// d aggregate average,
// ndc aggregate average,
// P aggregate average,
// N aggregate average,
// D aggregate average,
// A0 aggregate average,
// nMax aggregate average,
// nMin aggregate average,
// pMax aggregate average,
// pMin aggregate average)
// )
//
// val longTermSampling =
// DirectSampling(
// evaluation = replicationsLongTerm,
// sampling =
// (ndc in Seq(1.1,2.1,3.1,4.1,5.1))x
// (d in Seq(1.1,2.1,3.1,4.1,5.1)),
// )
// longTermSampling on env hook (workDirectory / "experimentNDCD-2-140621.csv")
//
// ///////////////////////////////////////////////////////////////////////////////
// // Begin of clustering experiment for figure 3:
// // Replications to get the time dynamics of the fragmentation measures
// ///////////////////////////////////////////////////////////////////////////////
// val setParamClusteringExp=ScalaTask("""
// val ksi = 1.2
// val sar = 0.25
// val a = 0.0
// val Tag = 0.1
// val Tab = 50.0
// val Tr = 5.0
// val Td = 50.0
// val d = 1.0
// val T = 4000.0
// val dtp = 0.1
// val L = 40.0
// val d0 = 0.0
// val a0 = 0.2
// val dtsave = 1.0
// // create a file with a header consisting of all the model macro outputs
// val f = newFile()
// f.content = "t P N D A0 A1 Y nFrag meanSize stdSize maxSize meanES stdES connectance nMax nMin pMax pMin ripleyN ripleyD ripleyA0 ripleyA1\n"
// """) set(
// inputs += w,
// outputs +=(f,T,dtp,L,a0,d0,ksi,sar,a,w,Tag,Tab,Tr,Td,d,dtsave)
// )
// // use this function to get all the data across time stored
// val replicationsClustering =
// Replication(
// evaluation = scriptTask hook hookAppend on env,
// seed = mySeed,
// sample = 20
// )
// val clusteringExploration = ExplorationTask( w in Seq(0.0,4.0,8.0) )
//
// ///////////////////////////////////////////////////////////////////////////////
// // End of clustering experiment for figure 3
// ///////////////////////////////////////////////////////////////////////////////
//
// ///////////////////////////////////////////////////////////////////////////////
// // Begin of intensification experiment for figure 1
// ///////////////////////////////////////////////////////////////////////////////
// val setParamIntenseExp=ScalaTask("""
// val ksi = 1.2
// val sar = 0.25
// val w = 0.0
// val Tag = 0.1
// val Tab = 50.0
// val Tr = 5.0
// val Td = 50.0
// val d = 1.0
// val T = 3000.0
// val dtp = 0.1
// val L = 40.0
// val d0 = 0.0
// val a0 = 0.25
// val dtsave = 1.0
// // create a file with a header consisting of all the model macro outputs
// val f = newFile()
// f.content = "t P N D A0 A1 Y nFrag meanSize stdSize maxSize meanES stdES connectance nMax nMin pMax pMin ripleyN ripleyD ripleyA0 ripleyA1\n"
// """) set(
// inputs += a,
// outputs +=(f,T,dtp,L,a0,d0,ksi,sar,a,w,Tag,Tab,Tr,Td,d,dtsave)
// )
// // use this function to get all the data across time stored
// val replicationsIntensification =
// Replication(
// evaluation = scriptTask hook hookAppend on env,
// seed = mySeed,
// sample = 20
// )
// val intensificationExploration = ExplorationTask( a in Seq(0.06,0.07,0.08,0.09) )
// // end of intensification exploration fig 1
// ///////////////////////////////////////////
//
// //////////////////////////////////////////////////
// // begin of zoom for detail on landscape structure perco transition fig 2
// val setParamZoomPerco=ScalaTask("""
// val ksi = 1.2
// val sar = 0.25
// val a = 0.0
// val w = 0.0
// val Tag = 0.1
// val Tab = 50.0
// val Tr = 5.0
// val Td = 50.0
// val d = 1.0
// val T = 100.0
// val dtp = 0.1
// val L = 40.0
// val d0 = 0.0
// val a0 = 0.35
// val dtsave = 0.01
// // create a file with a header consisting of all the model macro outputs
// val f = newFile()
// f.content = "t P N D A0 A1 Y nFrag meanSize stdSize maxSize meanES stdES connectance nMax nMin pMax pMin ripleyN ripleyD ripleyA0 ripleyA1\n"
// """) set(
// outputs +=(f,T,dtp,L,a0,d0,ksi,sar,a,w,Tag,Tab,Tr,Td,d,dtsave)
// )
// // use this function to get all the data across time stored
// val replicationsZoomPerco =
// Replication(
// evaluation = scriptTask hook hookAppend on env,
// seed = mySeed,
// sample = 30
// )
// // end of perco zoom fig 2
// ///////////////////////////////////////////
//
// //////////////////////////////////////////
// // begin of longterm sampling for intensification
//
// val readFinalStateIntensification =
// ScalaTask("""
// // read file as an array of lines and get last line
// val lastLineAgre = scala.io.Source.fromFile(agreOut).getLines.toList.last.mkString
// // split the string and store it in an array
// val valuesAgre = lastLineAgre.split(" ")
//
// val P = valuesAgre(1).toDouble
// val N = valuesAgre(2).toDouble
// val nMax = valuesAgre(14).toDouble
// val nMin = valuesAgre(15).toDouble
// val pMax = valuesAgre(16).toDouble
// val pMin = valuesAgre(17).toDouble
// """
//
// )set(
// inputs+=agreOut,
// (inputs, outputs)+=(T,dtp,L,a0,d0,ksi,sar,a,w,Tag,Tab,Tr,Td,d,dtsave,mySeed),
// outputs+=(P,N,nMax,nMin,pMax,pMin)
// )
//
// val finalStateIntensificationTask = MoleTask(scriptTask -- readFinalStateIntensification)
//
// val replicationsFinalStateIntensification =
// Replication(
// evaluation = finalStateIntensificationTask,
// seed = mySeed,
// sample = 20,
// aggregation = Seq (
// T aggregate average,
// dtp aggregate average,
// L aggregate average,
// a0 aggregate average,
// d0 aggregate average,
// ksi aggregate average,
// sar aggregate average,
// a aggregate average,
// w aggregate average,
// Tag aggregate average,
// Tab aggregate average,
// Tr aggregate average,
// Td aggregate average,
// d aggregate average,
// dtsave aggregate average,
// mySeed aggregate average,
// P aggregate average,
// N aggregate average,
// nMax aggregate average,
// nMin aggregate average,
// pMax aggregate average,
// pMin aggregate average)
// )
//
// val longTermIntensification =
// DirectSampling(
// evaluation = replicationsFinalStateIntensification on env,
// sampling =
// (T is 3000.0) x
// (dtp is 0.1) x
// (L is 40.0) x
// (a0 is 0.23) x
// (d0 is 0.0) x
// (ksi is 1.2) x
// (sar is 0.25) x
// (w is 0.0) x
// (Tab is 50.0) x
// (Tr is 5.0) x
// (Td is 50.0) x
// (d is 1.0) x
// (dtsave is "T") x
// ( a in Seq(0.05,0.06,0.07,0.08,0.09,0.1) ) x
// (Tag in LogRange(0.03,0.3,20)),
// // (( Tag in LogRange(0.15,0.3,10) ) x ( a is 0.1 )) ::
// // (( Tag in LogRange(0.12,0.25,10) ) x ( a is 0.2 )) ::
// // (( Tag in LogRange(0.05,0.13,10) ) x ( a is 0.3 )) ::
// // (( Tag in LogRange(0.03,0.1,10) ) x ( a is 0.4 )) ::
// // (( Tag in LogRange(0.03,0.06,10) ) x ( a is 0.5 )) ::
// // (( Tag in LogRange(0.02,0.05,10) ) x ( a is 0.6 )) ::
// // (( Tag in LogRange(0.01,0.04,10) ) x ( a is 0.7 )) ::
// // (( Tag in LogRange(0.01,0.04,10) ) x ( a is 0.8 )) ::
// // (( Tag in LogRange(0.01,0.04,10) ) x ( a is 0.9 )) ::
// // (( Tag in LogRange(0.01,0.04,10) ) x ( a is 1.0 )),
// // ( a in Seq(0.0,0.25,0.5) ),
// // ( ( (Tag in LogRange(0.02,1.0,40)) x (a in Seq(0.0,0.333,0.666)) ) :: ( (Tag in (0.24 to 0.28 by 0.005)) x (a in Seq(0.0,0.333,0.666)) ) ),
// )
//
//
// // end of longterm sampling for intensification
// //////////////////////////////////////////
//
// //////////////////////////////////////////
// // begin of longterm sampling for clustering
//
// val readFinalStateClustering =
// ScalaTask("""
// // read file as an array of lines and get last line
// val lastLineAgre = scala.io.Source.fromFile(agreOut).getLines.toList.last.mkString
// // split the string and store it in an array
// val valuesAgre = lastLineAgre.split(" ")
//
// val P = valuesAgre(1).toDouble
// val N = valuesAgre(2).toDouble
// val nMax = valuesAgre(14).toDouble
// val nMin = valuesAgre(15).toDouble
// val pMax = valuesAgre(16).toDouble
// val pMin = valuesAgre(17).toDouble
// """
//
// )set(
// inputs+=agreOut,
// (inputs, outputs)+=(T,dtp,L,a0,d0,ksi,sar,a,w,Tag,Tab,Tr,Td,d,dtsave,mySeed),
// outputs+=(P,N,nMax,nMin,pMax,pMin)
// )
//
// val finalStateClusteringTask = MoleTask(scriptTask -- readFinalStateClustering)
//
// val replicationsFinalStateClustering =
// Replication(
// evaluation = finalStateClusteringTask,
// seed = mySeed,
// sample = 20,
// aggregation = Seq (
// T aggregate average,
// dtp aggregate average,
// L aggregate average,
// a0 aggregate average,
// d0 aggregate average,
// ksi aggregate average,
// sar aggregate average,
// a aggregate average,
// w aggregate average,
// Tag aggregate average,
// Tab aggregate average,
// Tr aggregate average,
// Td aggregate average,
// d aggregate average,
// dtsave aggregate average,
// mySeed aggregate average,
// P,
// N,
// nMax,
// nMin,
// pMax,
// pMin)
// )
//
// val longTermClustering =
// DirectSampling(
// evaluation = replicationsFinalStateClustering on env,
// sampling =
// (T is 4000.0) x
// (dtp is 0.1) x
// (L is 40.0) x
// (a0 is 0.2) x
// (d0 is 0.0) x
// (ksi is 1.2) x
// (sar is 0.25) x
// (Tab is 50.0) x
// (Tr is 5.0) x
// (Td is 50.0) x
// (d is 1.0) x
// (dtsave is "T") x
// (Tag in LogRange(0.02,1.0,40)) x
// (w in Seq(1.0,2.0,4.0)),
// )
//
// // end of longterm sampling for clustering
// //////////////////////////////////////////
//
//
// //////////////////////////////////////////
// // begin of longterm sampling for clustering2
//
// val readFinalStateClustering2 =
// ScalaTask("""
// // read file as an array of lines and get last line
// val lastLineAgre = scala.io.Source.fromFile(agreOut).getLines.toList.last.mkString
// // split the string and store it in an array
// val valuesAgre = lastLineAgre.split(" ")
//
// val N = valuesAgre(2).toDouble
// val maxSize = valuesAgre(10).toDouble
// val meanSize = valuesAgre(8).toDouble
// val stdSize = valuesAgre(9).toDouble
// val nFrag = valuesAgre(7).toDouble
// """
//
// )set(
// inputs+=agreOut,
// (inputs, outputs)+=(T,dtp,L,a0,d0,ksi,sar,a,w,Tag,Tab,Tr,Td,d,dtsave,mySeed),
// outputs+=(N,maxSize,meanSize,stdSize,nFrag)
// )
//
// val finalStateClusteringTask2 = MoleTask(scriptTask -- readFinalStateClustering2)
//
// val replicationsFinalStateClustering2 =
// Replication(
// evaluation = finalStateClusteringTask2,
// seed = mySeed,
// sample = 20,
// aggregation = Seq (
// T aggregate average,
// dtp aggregate average,
// L aggregate average,
// a0 aggregate average,
// d0 aggregate average,
// ksi aggregate average,
// sar aggregate average,
// a aggregate average,
// w aggregate average,
// Tag aggregate average,
// Tab aggregate average,
// Tr aggregate average,
// Td aggregate average,
// d aggregate average,
// dtsave aggregate average,
// mySeed aggregate average,
// N aggregate average,
// maxSize aggregate average,
// meanSize aggregate average,
// stdSize aggregate average,
// nFrag aggregate average)
// )
//
// val longTermClustering2 =
// DirectSampling(
// evaluation = replicationsFinalStateClustering2 on env,
// sampling =
// (T is 0.0) x
// (dtp is 0.1) x
// (L is 40.0) x
// (Tag is 0.1) x
// (d0 is 0.0) x
// (ksi is 1.2) x
// (y0 is 0.2)x
// (sar is 0.25) x
// (Tab is 50.0) x
// (Tr is 5.0) x
// (Td is 50.0) x
// (d is 1.0) x
// (dtsave is 1.0) x
// (a0 in (0.0 to 1.0 by 0.01)) x
// (w in Seq(0.0,1.0,2.0,4.0)),
// )
//
// // end of longterm sampling for clustering2
// //////////////////////////////////////////
//
// /////////////////////////////////////////////
// // begin of ci conditions for figure 4
// val setParamA0Exp=ScalaTask("""
// val ksi = 1.2
// val sar = 0.25
// val a = 0.9
// val w = 8.0
// val Tag = 0.1
// val Tab = 50.0
// val Tr = 5.0
// val Td = 50.0
// val d = 1.0
// val T = 2000.0
// val dtp = 0.1
// val L = 40.0
// val d0 = 0.0
// val dtsave = 1.0
// // create a file with a header consisting of all the model macro outputs
// val f = newFile()
// f.content = "t P N D A0 A1 Y nFrag meanSize stdSize maxSize meanES stdES connectance nMax nMin pMax pMin ripleyN ripleyD ripleyA0 ripleyA1\n"
// """) set(
// inputs += a0,
// outputs +=(f,T,dtp,L,a0,d0,ksi,sar,a,w,Tag,Tab,Tr,Td,d,dtsave)
// )
// // use this function to get all the data across time stored
// val replicationsA0 =
// Replication(
// evaluation = scriptTask hook hookAppend on env,
// seed = mySeed,
// sample = 20
// )
// val a0Exploration = ExplorationTask( a0 in Seq(0.6,0.7,0.8,0.9,1.0) )
// // end of figure4
// /////////////////////////////////////////////
//
// /////////////////////////////////////////////
// // directsampling for irreversible collapse figure4
//
// val readFinalState =
// ScalaTask("""
// // read file as an array of lines and get last line
// val lastLineAgre = scala.io.Source.fromFile(agreOut).getLines.toList.last.mkString
// // split the string and store it in an array
// val valuesAgre = lastLineAgre.split(" ")
//
// val N = valuesAgre(2).toDouble
// val P = valuesAgre(1).toDouble
// val nMax = valuesAgre(14).toDouble
// val nMin = valuesAgre(15).toDouble
// val pMax = valuesAgre(16).toDouble
// val pMin = valuesAgre(17).toDouble
// val maxSize = valuesAgre(10).toDouble
// val meanSize = valuesAgre(8).toDouble
// val stdSize = valuesAgre(9).toDouble
// val nFrag = valuesAgre(7).toDouble
// """
//
// )set(
// inputs+=agreOut,
// (inputs, outputs)+=(T,dtp,L,a0,d0,ksi,sar,a,w,Tag,Tab,Tr,Td,d,dtsave,mySeed),
// outputs+=(N,P,nMax,nMin,pMax,pMin,maxSize,meanSize,stdSize,nFrag)
// )
//
// val finalStateTask = MoleTask(scriptTask -- readFinalState)
//
// val replicationsFinalState=
// Replication(
// evaluation = finalStateTask,
// seed = mySeed,
// sample = 20,
// aggregation = Seq (
// T aggregate average,
// dtp aggregate average,
// L aggregate average,
// a0 aggregate average,
// d0 aggregate average,
// ksi aggregate average,
// sar aggregate average,
// a aggregate average,
// w aggregate average,
// Tag aggregate average,
// Tab aggregate average,
// Tr aggregate average,
// Td aggregate average,
// d aggregate average,
// dtsave aggregate average,
// mySeed aggregate average,
// N,
// P,
// nMin,
// nMax,
// pMin,
// pMax,
// maxSize,
// meanSize,
// stdSize,
// nFrag)
// )
//
// val longTerm4 =
// DirectSampling(
// evaluation = replicationsFinalState on env,
// sampling =
// (T is 2000.0) x
// (dtp is 0.1) x
// (L is 40.0) x
// (Tag is 0.1) x
// (d0 is 0.0) x
// (ksi is 1.2) x
// (sar is 0.25) x
// (Tab is 50.0) x
// (Tr is 5.0) x
// (Td is 50.0) x
// (d is 1.0) x
// (dtsave is "T") x
// (a0 in (0.1 to 0.9 by 0.1)) x
// (a in (0.0 to 1.0 by 0.1)) x
// (w in (0.0 to 8.0 by 1.0)),
// )
//
// /////////////////////////////////////////////
// // ose for irreversible collapse figure4
//
// // val readFinalStateOSE =
// // ScalaTask("""
// // // read file as an array of lines and get last line
// // val lastLineAgre = scala.io.Source.fromFile(agreOut).getLines.toList.last.mkString
// // // split the string and store it in an array
// // val valuesAgre = lastLineAgre.split(" ")
// //
// // val N = valuesAgre(2).toDouble
// // val P = valuesAgre(1).toDouble
// // """
// //
// // )set(
// // inputs+=agreOut,
// // (inputs, outputs)+=(T,dtp,L,a0,d0,ksi,sar,a,w,Tag,Tab,Tr,Td,d,dtsave,mySeed),
// // outputs+=(N,P)
// // )
// //
// // val finalStateOSE = MoleTask(scriptTask -- readFinalStateOSE)
// //
// // val a0Exploration2 = ExplorationTask( a0 in Seq(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9) )
// //
// // val a0OSE = OSEEvolution(
// // evaluation = finalStateOSE on env,
// // parallelism = 40,
// // termination = 100,
// // origin = Seq(
// // a0 is a0,
// // a in (0.0 to 1.0 by 0.1),
// // w in (0.0 to 8.0 by 1.0)),
// // objective = Seq(
// // P under 10.0,
// // N under 0.01),
// // stochastic = Stochastic(seed = mySeed, reevaluate = 0.2, sample = 10),
// // )
//
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////
// // directsampling for final state in the absence of population as a function of landscape initial composition
//
// val readFinalStateNoPop =
// ScalaTask("""
// // read file as an array of lines and get last line
// val lastLineAgre = scala.io.Source.fromFile(agreOut).getLines.toList.last.mkString
// // split the string and store it in an array
// val valuesAgre = lastLineAgre.split(" ")
//
// val N = valuesAgre(2).toDouble
// """
//
// )set(
// inputs+=agreOut,
// (inputs, outputs)+=(T,dtp,L,a0,d0,ksi,y0,sar,a,w,Tag,Tab,Tr,Td,d,dtsave,mySeed),
// outputs+=(N)
// )
//
// val finalStateTaskNoPop = MoleTask(scriptTask -- readFinalStateNoPop)
//
// val replicationsFinalStateNoPop=
// Replication(
// evaluation = finalStateTaskNoPop,
// seed = mySeed,
// sample = 20,
// aggregation = Seq (
// T aggregate average,
// dtp aggregate average,
// L aggregate average,
// a0 aggregate average,
// d0 aggregate average,
// ksi aggregate average,
// y0 aggregate average,
// sar aggregate average,
// a aggregate average,
// w aggregate average,
// Tag aggregate average,
// Tab aggregate average,
// Tr aggregate average,
// Td aggregate average,
// d aggregate average,
// dtsave aggregate average,
// mySeed aggregate average,
// N aggregate average
// )
// )
//
// val longTermNoPop =
// DirectSampling(
// evaluation = replicationsFinalStateNoPop on env,
// sampling =
// (T is 6000.0) x
// (dtp is "T") x
// (L is 40.0) x
// (Tag is 1.0) x
// (a0 is 0.0) x
// (a is 0.0) x
// (w is 0.0) x
// (y0 is 0.0) x
// (ksi is 0.0) x
// (Tab is 50.0) x
// (Td is 1.0) x
// (d is 1.0) x
// (dtsave is "T") x
// (d0 in (0.0 to 1.0 by 0.1)) x
// (sar in Seq(0.0,0.125)) x
// (Tr in LogRange(0.01,1.0,20)),
// )
//
//
// ///////////////////////////////////////////////////////////////////////////////////
// // begin of exploration with otherrange values for processes compared to demography
//
// val setParamExplo=ScalaTask("""
// val ksi = 1.2
// val sar = 0.25
// val y0 = 0.2
// val a = 0.0
// val w = 0.0
// val Tag = 0.1
// val Tab = 50.0
// val Tr = 5.0
// val Td = 50.0
// val d = 1.0
// val T = 2000.0
// val dtp = 0.1
// val L = 40.0
// val d0 = 0.0
// val a0 = 0.2
// val dtsave = 1.0
// // create a file with a header consisting of all the model macro outputs
// val f = newFile()
// f.content = "t P N D A0 A1 Y nFrag meanSize stdSize maxSize meanES stdES connectance nMax nMin pMax pMin ripleyN ripleyD ripleyA0 ripleyA1\n"
// """) set(
// outputs +=(f,T,dtp,L,a0,d0,ksi,sar,y0,a,w,Tag,Tab,Tr,Td,d,dtsave)
// )
// // use this function to get all the data across time stored
// val replicationsExplo =
// Replication(
// evaluation = scriptTask hook hookAppend on env,
// seed = mySeed,
// sample = 20
// )
// // end of perco zoom fig 2
// ///////////////////////////////////////////
//
// //////////////////////////////////////////
// // begin percolation measure sampling to get correlation length and radius of gyration as a function of omega and N
//
// val readFinalStatePercoMeasure =
// ScalaTask("""
// // read file as an array of lines and get last line
// val lastLineAgre = scala.io.Source.fromFile(agreOut).getLines.toList.last.mkString
// // split the string and store it in an array
// val valuesAgre = lastLineAgre.split(" ")
//
// val N = valuesAgre(2).toDouble
// val meanES = valuesAgre(11).toDouble
// val stdES = valuesAgre(12).toDouble
// val meanR = valuesAgre(22).toDouble
// val stdR = valuesAgre(23).toDouble
// val corrLen = valuesAgre(24).toDouble
// """
//
// )set(
// inputs+=agreOut,
// (inputs, outputs)+=(T,dtp,L,a0,d0,ksi,y0,sar,a,w,Tag,Tab,Tr,Td,d,dtsave,mySeed),
// outputs+=(N,meanES,stdES,meanR,stdR,corrLen)
// )
//
// val finalStatePercoMeasureTask = MoleTask(scriptTask -- readFinalStatePercoMeasure)
//
// val replicationsFinalStatePercoMeasure =
// Replication(
// evaluation = finalStatePercoMeasureTask,
// seed = mySeed,
// sample = 20,
// aggregation = Seq (
// T aggregate average,
// dtp aggregate average,
// L aggregate average,
// a0 aggregate average,
// d0 aggregate average,
// ksi aggregate average,
// y0 aggregate average,
// sar aggregate average,
// a aggregate average,
// w aggregate average,
// Tag aggregate average,
// Tab aggregate average,
// Tr aggregate average,
// Td aggregate average,
// d aggregate average,
// dtsave aggregate average,
// mySeed aggregate average,
// N aggregate average,
// meanES aggregate average,
// stdES aggregate average,
// meanR aggregate average,
// stdR aggregate average,
// corrLen aggregate average)
// )
//
// val samplingPercoMeasure =
// DirectSampling(
// evaluation = replicationsFinalStatePercoMeasure on env,
// sampling =
// (T is 0.0) x
// (dtp is 0.1) x
// (L is 100.0) x
// (a is 40.0) x
// (Tag is 0.1) x
// (d0 is 0.0) x
// (ksi is 1.2) x
// (y0 is 0.2)x
// (sar is 0.25) x
// (Tab is 50.0) x
// (Tr is 5.0) x
// (Td is 50.0) x
// (d is 1.0) x
// (dtsave is 1.0) x
// (a0 in (0.01 to 0.99 by 0.01)) x
// (w in Seq(0.0,1.0,2.0,4.0)),
// )
//
// // end of longterm sampling for clustering2
// //////////////////////////////////////////
//
//
// // a0Exploration2 -< ( a0OSE hook (workDirectory / "resultsOSE") )
// longTerm4 hook (workDirectory / "experiment4-010521.csv")
// // longTermNoPop hook (workDirectory / "experimentNoPop-2-140521.csv")
// // a0Exploration -< (setParamA0Exp hook copyHook) -- replicationsA0
// // clusteringExploration -< (setParamClusteringExp hook copyHook) -- replicationsClustering
// // intensificationExploration -< (setParamIntenseExp hook copyHook) -- replicationsIntensification
// // (setParamZoomPerco hook copyHook) -- replicationsZoomPerco
// // longTermIntensification hook (workDirectory / "experimentTagA-290421-2Dbif-3.csv")
// // longTermClustering hook (workDirectory / "experimentTagW-280421.csv")
// // longTermClustering2 hook (workDirectory / "experimentA0W-220421.csv")
//
// samplingPercoMeasure hook (workDirectory / "experimentPercoMeasure-280521.csv")
//
// // (setParamExplo hook copyHook) -- replicationsExplo