Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.pl
More file actions
Latest commit
executable file
·78 lines (57 loc) · 2.99 KB
/
Copy pathinit.pl
File metadata and controls
executable file
·78 lines (57 loc) · 2.99 KB
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
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
use Try::Tiny;
use v5.10;
use lib "lib";
use Pear::LocalLoop::Algorithm::Main;
use Pear::LocalLoop::Algorithm::Debug;
use Pear::LocalLoop::Algorithm::ProcessingTypeContainer;
use Pear::LocalLoop::Algorithm::StaticRestriction::RemoveTransactionsThatCannotFormALoop;
use Pear::LocalLoop::Algorithm::ChainDynamicRestriction::AllowOnlyTransactionsWhichFromUserMatchesOurToUser;
use Pear::LocalLoop::Algorithm::ChainDynamicRestriction::AllowOnlyAfterCurrentTransaction;
use Pear::LocalLoop::Algorithm::ChainDynamicRestriction::AllowOnlyTransactionsNotExtendedOntoYet;
use Pear::LocalLoop::Algorithm::Heuristic::None;
use Pear::LocalLoop::Algorithm::TransactionOrder::EarliestTransactionFirst;
use Pear::LocalLoop::Algorithm::TransactionOrder::LargestTransactionValueFirst;
use Pear::LocalLoop::Algorithm::LoopDynamicRestriction::DisallowLoopsWhichHaveTransactionsInActiveLoops;
use Pear::LocalLoop::Algorithm::LoopDynamicRestriction::DisallowSelectionOfAlreadySelectedLoops;
use Pear::LocalLoop::Algorithm::Heuristic::PrioritiseFindingLoops;
my$debug = 0;
foreachmy$arg (@ARGV) {
if ($argeq"debug") {
$debug = 1;
}
}
if ($debug) {
Pear::LocalLoop::Algorithm::Debug->setDebugMode();
}
my$main = Pear::LocalLoop::Algorithm::Main->instance();
#FIXME It should not have this in the final version, but for now use this for state management.
my$dbh = $main->dbi();
$dbh->prepare("DELETE FROM Loops")->execute();
$dbh->prepare("DELETE FROM LoopInfo")->execute();
my$rst = Pear::LocalLoop::Algorithm::StaticRestriction::RemoveTransactionsThatCannotFormALoop->new();
my$staticRestrictions = [$rst];
my$matchId = Pear::LocalLoop::Algorithm::ChainDynamicRestriction::AllowOnlyTransactionsWhichFromUserMatchesOurToUser->new();
my$afterCurrent = Pear::LocalLoop::Algorithm::ChainDynamicRestriction::AllowOnlyAfterCurrentTransaction->new();
my$extendedOnto = Pear::LocalLoop::Algorithm::ChainDynamicRestriction::AllowOnlyTransactionsNotExtendedOntoYet->new();
my$chainDynamicRestrictions = [$matchId, $afterCurrent, $extendedOnto];
my$none = Pear::LocalLoop::Algorithm::Heuristic::None->new();
my$findFirstFinish = Pear::LocalLoop::Algorithm::Heuristic::PrioritiseFindingLoops->new();
my$chainHeuristics = [$findFirstFinish, $none];
my$loopHeuristics = [$none];
my$disallowTransactionsInLoops = Pear::LocalLoop::Algorithm::LoopDynamicRestriction::DisallowLoopsWhichHaveTransactionsInActiveLoops->new();
my$loopDynamicRestrictions = [$disallowTransactionsInLoops];
my$hash = {
transactionOrder=> Pear::LocalLoop::Algorithm::TransactionOrder::LargestTransactionValueFirst->new(),
staticRestrictionsArray=>$staticRestrictions,
chainDynamicRestrictionsArray=>$chainDynamicRestrictions,
chainHeuristicArray=>$chainHeuristics,
loopDynamicRestrictionsArray=>$loopDynamicRestrictions,
loopHeuristicArray=>$loopHeuristics,
};
my$proc = Pear::LocalLoop::Algorithm::ProcessingTypeContainer->new($hash);
#say Dumper($proc);
say$main->process($proc);