@@ -1,5 +1,6 @@
using MetagraphOptimization
using QEDbase
using QEDcore
using QEDprocesses
using StatsBase # for countmap
using Random
@@ -9,8 +10,6 @@ import MetagraphOptimization.caninteract
import MetagraphOptimization . issame
import MetagraphOptimization . interaction_result
import MetagraphOptimization . propagation_result
import MetagraphOptimization . direction
import MetagraphOptimization . spin_or_pol
import MetagraphOptimization . QED_vertex
def_momentum = SFourMomentum ( 1.0 , 0.0 , 0.0 , 0.0 )
@@ -18,32 +17,32 @@ def_momentum = SFourMomentum(1.0, 0.0, 0.0, 0.0)
RNG = Random . MersenneTwister ( 0 )
testparticleTypes = [
Photon Stateful { Incoming , PolX } ,
Photon Stateful { Outgoing , PolX } ,
Fermion Stateful{ Incoming , SpinUp } ,
Fermion Stateful{ Outgoing , SpinUp } ,
AntiFermion Stateful{ Incoming , SpinUp } ,
AntiFermion Stateful{ Outgoing , SpinUp } ,
Particle Stateful { Incoming , Photon , SFourMomentum } ,
Particle Stateful { Outgoing , Photon , SFourMomentum } ,
Particle Stateful{ Incoming , Electron , SFourMomentum } ,
Particle Stateful{ Outgoing , Electron , SFourMomentum } ,
Particle Stateful{ Incoming , Positron , SFourMomentum } ,
Particle Stateful{ Outgoing , Positron , SFourMomentum } ,
]
testparticleTypesPropagated = [
Photon Stateful { Outgoing , PolX } ,
Photon Stateful { Incoming , PolX } ,
Fermion Stateful{ Outgoing , SpinUp } ,
Fermion Stateful{ Incoming , SpinUp } ,
AntiFermion Stateful{ Outgoing , SpinUp } ,
AntiFermion Stateful{ Incoming , SpinUp } ,
Particle Stateful { Outgoing , Photon , SFourMomentum } ,
Particle Stateful { Incoming , Photon , SFourMomentum } ,
Particle Stateful{ Outgoing , Electron , SFourMomentum } ,
Particle Stateful{ Incoming , Electron , SFourMomentum } ,
Particle Stateful{ Outgoing , Positron , SFourMomentum } ,
Particle Stateful{ Incoming , Positron , SFourMomentum } ,
]
function compton_groundtruth ( input :: QEDProcessInpu t)
function compton_groundtruth ( input :: PhaseSpacePoin t)
# p1k1 -> p2k2
# formula: − (ie)^2 (u(p2) slashed(ε1) S(p2 − k1) slashed(ε2) u(p1) + u(p2) slashed(ε2) S(p1 + k1) slashed(ε1) u(p1))
p1 = input . inFerms [ 1 ]
p2 = input . outFerms [ 1 ]
p1 = momentum ( psp , Incoming ( ) , 2 )
p2 = momentum ( psp , Outgoing ( ) , 2 )
k1 = input . inPhotons [ 1 ]
k2 = input . outPhotons [ 1 ]
k1 = momentum ( psp , Incoming ( ) , 1 )
k2 = momentum ( psp , Outgoing ( ) , 1 )
u_p1 = base_state ( Electron ( ) , Incoming ( ) , p1 . momentum , spin_or_pol ( p1 ) )
u_p2 = base_state ( Electron ( ) , Outgoing ( ) , p2 . momentum , spin_or_pol ( p2 ) )
@@ -57,8 +56,8 @@ function compton_groundtruth(input::QEDProcessInput)
virt2_mom = p1 . momentum + k1 . momentum
@test isapprox ( p2 . momentum + k2 . momentum , virt2_mom )
s_p2_k1 = propagator ( Electron ( ) , virt1_mom )
s_p1_k1 = propagator ( Electron ( ) , virt2_mom )
s_p2_k1 = QEDbase . propagator( Electron ( ) , virt1_mom )
s_p1_k1 = QEDbase . propagator( Electron ( ) , virt2_mom )
diagram1 = u_p2 * ( eps_1 * QED_vertex ( ) ) * s_p2_k1 * ( eps_2 * QED_vertex ( ) ) * u_p1
diagram2 = u_p2 * ( eps_2 * QED_vertex ( ) ) * s_p1_k1 * ( eps_1 * QED_vertex ( ) ) * u_p1
@@ -66,7 +65,6 @@ function compton_groundtruth(input::QEDProcessInput)
return diagram1 + diagram2
end
@testset " Interaction Result " begin
import MetagraphOptimization . QED_conserve_momentum
@@ -88,8 +86,8 @@ end
@test issame ( typeof ( resultParticle ) , interaction_result ( p1 , p2 ) )
totalMom = zero ( SFourMomentum )
for ( p , mom ) in [ ( p1 , testParticle1 . momentum ) , ( p2 , testParticle2 . momentum ) , ( p3 , resultParticle . momentum ) ]
if ( typeof ( direction ( p ) ) <: Incoming )
for ( p , mom ) in [ ( p1 , momentum ( testParticle1) ) , ( p2 , momentum ( testParticle2) ) , ( p3 , momentum ( resultParticle) ) ]
if ( typeof ( particle_ direction( p ) ) <: Incoming )
totalMom += mom
else
totalMom -= mom
@@ -103,7 +101,7 @@ end
@testset " Propagation Result " begin
for ( p , propResult ) in zip ( testparticleTypes , testparticleTypesPropagated )
@test issame ( propagation_result ( p ) , propResult )
@test direction ( propagation_result ( p ) ( def_momentum ) ) != direction ( p ( def_momentum ) )
@test particle_ direction( propagation_result ( p ) ( def_momentum ) ) != particle_ direction( p ( def_momentum ) )
end
end
@@ -117,38 +115,23 @@ end
end
@testset " Known processes " begin
compton_process = QEDProcessDescription (
Dict { Type , Int } ( PhotonStateful { Incoming , PolX } => 1 , FermionStateful { Incoming , SpinUp } => 1 ) ,
Dict { Type , Int } ( PhotonStateful { Outgoing , PolX } => 1 , FermionStateful { Outgoing , SpinUp } => 1 ) ,
)
compton_process = Generic QEDProcess(1 , 1 , 1 , 1 , 0 , 0 )
@test parse_process ( " ke->ke " , QEDModel ( ) ) == compton_process
positron_compton_process = QEDProcessDescription (
Dict { Type , Int } ( PhotonStateful { Incoming , PolX } => 1 , AntiFermionStateful { Incoming , SpinUp } => 1 ) ,
Dict { Type , Int } ( PhotonStateful { Outgoing , PolX } => 1 , AntiFermionStateful { Outgoing , SpinUp } => 1 ) ,
)
positron_compton_process = Generic QEDProcess(1 , 1 , 0 , 0 , 1 , 1 )
@test parse_process ( " kp->kp " , QEDModel ( ) ) == positron_compton_process
trident_process = QEDProcessDescription (
Dict { Type , Int } ( PhotonStateful { Incoming , PolX } => 1 , FermionStateful { Incoming , SpinUp } => 1 ) ,
Dict { Type , Int } ( FermionStateful { Outgoing , SpinUp } => 2 , AntiFermionStateful { Outgoing , SpinUp } => 1 ) ,
)
trident_process = Generic QEDProcess(1 , 0 , 1 , 2 , 0 , 1 )
@test parse_process ( " ke->eep " , QEDModel ( ) ) == trident_process
pair_production_process = QEDProcessDescription (
Dict { Type , Int } ( PhotonStateful { Incoming , PolX } => 2 ) ,
Dict { Type , Int } ( FermionStateful { Outgoing , SpinUp } => 1 , AntiFermionStateful { Outgoing , SpinUp } => 1 ) ,
)
pair_production_process = Generic QEDProcess(2 , 0 , 0 , 1 , 0 , 1 )
@test parse_process ( " kk->pe " , QEDModel ( ) ) == pair_production_process
pair_annihilation_process = QEDProcessDescription (
Dict { Type , Int } ( FermionStateful { Incoming , SpinUp } => 1 , AntiFermionStateful { Incoming , SpinUp } => 1 ) ,
Dict { Type , Int } ( PhotonStateful { Outgoing , PolX } => 2 ) ,
)
pair_annihilation_process = Generic QEDProcess(0 , 2 , 1 , 0 , 1 , 0 )
@test parse_process ( " pe->kk " , QEDModel ( ) ) == pair_annihilation_process
end
@@ -161,12 +144,18 @@ end
for i in 1 : 100
input = gen_process_input ( process )
@test length ( input . inFerms ) == get ( process . inParticles , FermionStateful { Incoming , SpinUp } , 0 )
@test length ( input . inAntiferms ) == get ( process . inParticles , AntiFermion Stateful{ Incoming , SpinUp } , 0 )
@test length ( input . inPhoton s ) == get ( process . inParticles , PhotonStateful { Incoming , PolX } , 0 )
@test length ( input . outFerms ) == get ( process . out Particles, Fermion Stateful{ Outgo ing, SpinUp } , 0 )
@test length ( input . outAntiferms ) == get ( process . outParticles , AntiFermionStateful { Outgoing , SpinUp } , 0 )
@test length ( input . outPhotons ) == get ( process . out Particles, Photon Stateful { Outgo ing, PolX } , 0 )
@test length ( input . inFerms ) ==
get ( process . inParticles , Particle Stateful{ Incoming , Electron , SFourMomentum } , 0 )
@test length ( input . inAntiferm s ) ==
get ( process . in Particles, Particle Stateful{ Incom ing, Positron , SFourMomentum } , 0 )
@test length ( input . inPhotons ) ==
get ( process . in Particles, Particle Stateful { Incom ing, Photon , SFourMomentum } , 0 )
@test length ( input . outFerms ) ==
get ( process . outParticles , ParticleStateful { Outgoing , Electron , SFourMomentum } , 0 )
@test length ( input . outAntiferms ) ==
get ( process . outParticles , ParticleStateful { Outgoing , Positron , SFourMomentum } , 0 )
@test length ( input . outPhotons ) ==
get ( process . outParticles , ParticleStateful { Outgoing , Photon , SFourMomentum } , 0 )
@test isapprox (
sum ( [
@@ -185,6 +174,7 @@ end
end
end
#=
@ t e s t s e t " C o m p t o n " b e g i n
i m p o r t M e t a g r a p h O p t i m i z a t i o n . i n s e r t _ n o d e !
i m p o r t M e t a g r a p h O p t i m i z a t i o n . i n s e r t _ e d g e !
@@ -211,97 +201,97 @@ end
g r a p h = D A G ( )
# s t o o u t p u t ( e x i t n o d e )
d_exit = insert_node ! (grap h , make_nod e (DataTas k (1 6 ) ), track = fals e )
d _ e x i t = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (1 6 ) ); t r a c k = f a l s e )
sum_node = insert_node ! (grap h , make_nod e (ComputeTaskQED_Su m ( 2 ) ), track = fals e )
s u m _ n o d e = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (C o m p u t e T a s k Q E D _ S u m ( 2 ) ); t r a c k = f a l s e )
d_s0_sum = insert_node ! (grap h , make_nod e (DataTas k (1 6 ) ), track = fals e )
d_s1_sum = insert_node ! (grap h , make_nod e (DataTas k (1 6 ) ), track = fals e )
d _ s 0 _ s u m = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (1 6 ) ); t r a c k = f a l s e )
d _ s 1 _ s u m = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (1 6 ) ); t r a c k = f a l s e )
# f i n a l s c o m p u t e
s0 = insert_node ! (grap h , make_nod e (ComputeTaskQED_S 2 ( ) ), track = fals e )
s1 = insert_node ! (grap h , make_nod e (ComputeTaskQED_S 2 ( ) ), track = fals e )
s 0 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (C o m p u t e T a s k Q E D _ S 2 ( ) ); t r a c k = f a l s e )
s 1 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (C o m p u t e T a s k Q E D _ S 2 ( ) ); t r a c k = f a l s e )
# d a t a f r o m v 0 a n d v 1 t o s 0
d_v0_s0 = insert_node ! (grap h , make_nod e (DataTas k (9 6 ) ), track = fals e )
d_v1_s0 = insert_node ! (grap h , make_nod e (DataTas k (9 6 ) ), track = fals e )
d_v2_s1 = insert_node ! (grap h , make_nod e (DataTas k (9 6 ) ), track = fals e )
d_v3_s1 = insert_node ! (grap h , make_nod e (DataTas k (9 6 ) ), track = fals e )
d _ v 0 _ s 0 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (9 6 ) ); t r a c k = f a l s e )
d _ v 1 _ s 0 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (9 6 ) ); t r a c k = f a l s e )
d _ v 2 _ s 1 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (9 6 ) ); t r a c k = f a l s e )
d _ v 3 _ s 1 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (9 6 ) ); t r a c k = f a l s e )
# v 0 a n d v 1 c o m p u t e
v0 = insert_node ! (grap h , make_nod e (ComputeTaskQED_ V ( ) ), track = fals e )
v1 = insert_node ! (grap h , make_nod e (ComputeTaskQED_ V ( ) ), track = fals e )
v2 = insert_node ! (grap h , make_nod e (ComputeTaskQED_ V ( ) ), track = fals e )
v3 = insert_node ! (grap h , make_nod e (ComputeTaskQED_ V ( ) ), track = fals e )
v 0 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (C o m p u t e T a s k Q E D _ V ( ) ); t r a c k = f a l s e )
v 1 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (C o m p u t e T a s k Q E D _ V ( ) ); t r a c k = f a l s e )
v 2 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (C o m p u t e T a s k Q E D _ V ( ) ); t r a c k = f a l s e )
v 3 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (C o m p u t e T a s k Q E D _ V ( ) ); t r a c k = f a l s e )
# d a t a f r o m u P h I n , u P h O u t , u E l I n , u E l O u t t o v 0 a n d v 1
d_uPhIn_v0 = insert_node ! (grap h , make_nod e (DataTas k (9 6 ) ), track = fals e )
d_uElIn_v0 = insert_node ! (grap h , make_nod e (DataTas k (9 6 ) ), track = fals e )
d_uPhOut_v1 = insert_node ! (grap h , make_nod e (DataTas k (9 6 ) ), track = fals e )
d_uElOut_v1 = insert_node ! (grap h , make_nod e (DataTas k (9 6 ) ), track = fals e )
d _ u P h I n _ v 0 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (9 6 ) ); t r a c k = f a l s e )
d _ u E l I n _ v 0 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (9 6 ) ); t r a c k = f a l s e )
d _ u P h O u t _ v 1 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (9 6 ) ); t r a c k = f a l s e )
d _ u E l O u t _ v 1 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (9 6 ) ); t r a c k = f a l s e )
# d a t a f r o m u P h I n , u P h O u t , u E l I n , u E l O u t t o v 2 a n d v 3
d_uPhOut_v2 = insert_node ! (grap h , make_nod e (DataTas k (9 6 ) ), track = fals e )
d_uElIn_v2 = insert_node ! (grap h , make_nod e (DataTas k (9 6 ) ), track = fals e )
d_uPhIn_v3 = insert_node ! (grap h , make_nod e (DataTas k (9 6 ) ), track = fals e )
d_uElOut_v3 = insert_node ! (grap h , make_nod e (DataTas k (9 6 ) ), track = fals e )
d _ u P h O u t _ v 2 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (9 6 ) ); t r a c k = f a l s e )
d _ u E l I n _ v 2 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (9 6 ) ); t r a c k = f a l s e )
d _ u P h I n _ v 3 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (9 6 ) ); t r a c k = f a l s e )
d _ u E l O u t _ v 3 = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (9 6 ) ); t r a c k = f a l s e )
# u P h I n , u P h O u t , u E l I n a n d u E l O u t c o m p u t e s
uPhIn = insert_node ! (grap h , make_nod e (ComputeTaskQED_ U ( ) ), track = fals e )
uPhOut = insert_node ! (grap h , make_nod e (ComputeTaskQED_ U ( ) ), track = fals e )
uElIn = insert_node ! (grap h , make_nod e (ComputeTaskQED_ U ( ) ), track = fals e )
uElOut = insert_node ! (grap h , make_nod e (ComputeTaskQED_ U ( ) ), track = fals e )
u P h I n = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (C o m p u t e T a s k Q E D _ U ( ) ); t r a c k = f a l s e )
u P h O u t = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (C o m p u t e T a s k Q E D _ U ( ) ); t r a c k = f a l s e )
u E l I n = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (C o m p u t e T a s k Q E D _ U ( ) ); t r a c k = f a l s e )
u E l O u t = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (C o m p u t e T a s k Q E D _ U ( ) ); t r a c k = f a l s e )
# d a t a i n t o U
d_uPhIn = insert_node ! (grap h , make_nod e (DataTas k (1 6 ) , " ki 1 ") , track = fals e )
d_uPhOut = insert_node ! (grap h , make_nod e (DataTas k (1 6 ) , " ko 1 ") , track = fals e )
d_uElIn = insert_node ! (grap h , make_nod e (DataTas k (1 6 ) , " ei 1 ") , track = fals e )
d_uElOut = insert_node ! (grap h , make_nod e (DataTas k (1 6 ) , " eo 1 ") , track = fals e )
d _ u P h I n = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (1 6 ) , " k i 1 ") ; t r a c k = f a l s e )
d _ u P h O u t = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (1 6 ) , " k o 1 ") ; t r a c k = f a l s e )
d _ u E l I n = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (1 6 ) , " e i 1 ") ; t r a c k = f a l s e )
d _ u E l O u t = i n s e r t _ n o d e ! (g r a p h , m a k e _ n o d e (D a t a T a s k (1 6 ) , " e o 1 ") ; t r a c k = f a l s e )
# n o w f o r a l l t h e e d g e s
insert_edge ! (grap h , d_uPhI n , uPhIn , track = fals e )
insert_edge ! (grap h , d_uPhOu t , uPhOut , track = fals e )
insert_edge ! (grap h , d_uElI n , uElIn , track = fals e )
insert_edge ! (grap h , d_uElOu t , uElOut , track = fals e )
i n s e r t _ e d g e ! (g r a p h , d _ u P h I n , u P h I n ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , d _ u P h O u t , u P h O u t ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , d _ u E l I n , u E l I n ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , d _ u E l O u t , u E l O u t ; t r a c k = f a l s e )
insert_edge ! (grap h , uPhI n , d_uPhIn_v0 , track = fals e )
insert_edge ! (grap h , uPhOu t , d_uPhOut_v1 , track = fals e )
insert_edge ! (grap h , uElI n , d_uElIn_v0 , track = fals e )
insert_edge ! (grap h , uElOu t , d_uElOut_v1 , track = fals e )
i n s e r t _ e d g e ! (g r a p h , u P h I n , d _ u P h I n _ v 0 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , u P h O u t , d _ u P h O u t _ v 1 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , u E l I n , d _ u E l I n _ v 0 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , u E l O u t , d _ u E l O u t _ v 1 ; t r a c k = f a l s e )
insert_edge ! (grap h , uPhI n , d_uPhIn_v3 , track = fals e )
insert_edge ! (grap h , uPhOu t , d_uPhOut_v2 , track = fals e )
insert_edge ! (grap h , uElI n , d_uElIn_v2 , track = fals e )
insert_edge ! (grap h , uElOu t , d_uElOut_v3 , track = fals e )
i n s e r t _ e d g e ! (g r a p h , u P h I n , d _ u P h I n _ v 3 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , u P h O u t , d _ u P h O u t _ v 2 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , u E l I n , d _ u E l I n _ v 2 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , u E l O u t , d _ u E l O u t _ v 3 ; t r a c k = f a l s e )
insert_edge ! (grap h , d_uPhIn_v 0 , v0 , track = fals e )
insert_edge ! (grap h , d_uPhOut_v 1 , v1 , track = fals e )
insert_edge ! (grap h , d_uElIn_v 0 , v0 , track = fals e )
insert_edge ! (grap h , d_uElOut_v 1 , v1 , track = fals e )
i n s e r t _ e d g e ! (g r a p h , d _ u P h I n _ v 0 , v 0 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , d _ u P h O u t _ v 1 , v 1 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , d _ u E l I n _ v 0 , v 0 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , d _ u E l O u t _ v 1 , v 1 ; t r a c k = f a l s e )
insert_edge ! (grap h , d_uPhIn_v 3 , v3 , track = fals e )
insert_edge ! (grap h , d_uPhOut_v 2 , v2 , track = fals e )
insert_edge ! (grap h , d_uElIn_v 2 , v2 , track = fals e )
insert_edge ! (grap h , d_uElOut_v 3 , v3 , track = fals e )
i n s e r t _ e d g e ! (g r a p h , d _ u P h I n _ v 3 , v 3 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , d _ u P h O u t _ v 2 , v 2 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , d _ u E l I n _ v 2 , v 2 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , d _ u E l O u t _ v 3 , v 3 ; t r a c k = f a l s e )
insert_edge ! (grap h , v 0 , d_v0_s0 , track = fals e )
insert_edge ! (grap h , v 1 , d_v1_s0 , track = fals e )
insert_edge ! (grap h , v 2 , d_v2_s1 , track = fals e )
insert_edge ! (grap h , v 3 , d_v3_s1 , track = fals e )
i n s e r t _ e d g e ! (g r a p h , v 0 , d _ v 0 _ s 0 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , v 1 , d _ v 1 _ s 0 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , v 2 , d _ v 2 _ s 1 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , v 3 , d _ v 3 _ s 1 ; t r a c k = f a l s e )
insert_edge ! (grap h , d_v0_s 0 , s0 , track = fals e )
insert_edge ! (grap h , d_v1_s 0 , s0 , track = fals e )
i n s e r t _ e d g e ! (g r a p h , d _ v 0 _ s 0 , s 0 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , d _ v 1 _ s 0 , s 0 ; t r a c k = f a l s e )
insert_edge ! (grap h , d_v2_s 1 , s1 , track = fals e )
insert_edge ! (grap h , d_v3_s 1 , s1 , track = fals e )
i n s e r t _ e d g e ! (g r a p h , d _ v 2 _ s 1 , s 1 ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , d _ v 3 _ s 1 , s 1 ; t r a c k = f a l s e )
insert_edge ! (grap h , s 0 , d_s0_sum , track = fals e )
insert_edge ! (grap h , s 1 , d_s1_sum , track = fals e )
i n s e r t _ e d g e ! (g r a p h , s 0 , d _ s 0 _ s u m ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , s 1 , d _ s 1 _ s u m ; t r a c k = f a l s e )
insert_edge ! (grap h , d_s0_su m , sum_node , track = fals e )
insert_edge ! (grap h , d_s1_su m , sum_node , track = fals e )
i n s e r t _ e d g e ! (g r a p h , d _ s 0 _ s u m , s u m _ n o d e ; t r a c k = f a l s e )
i n s e r t _ e d g e ! (g r a p h , d _ s 1 _ s u m , s u m _ n o d e ; t r a c k = f a l s e )
insert_edge ! (grap h , sum_nod e , d_exit , track = fals e )
i n s e r t _ e d g e ! (g r a p h , s u m _ n o d e , d _ e x i t ; t r a c k = f a l s e )
i n p u t = [ g e n _ p r o c e s s _ i n p u t ( p r o c e s s ) f o r _ i n 1 : 1 0 0 0 ]
@@ -314,9 +304,12 @@ end
@ t e s t i s a p p r o x ( c o m p t o n _ f u n c t i o n . ( i n p u t ) , c o m p t o n _ g r o u n d t r u t h . ( i n p u t ) )
e n d
@testset " Equal results after optimizatio n " for optimizer in
[ ReductionOptimize r ( ) , RandomWalkOptimize r (MersenneTwiste r ( 0 ) )]
@testset " Process $proc_str " for proc_str in [ " ke->ke " , " kp->kp " , " kk->ep " , " ep->kk " , " ke->kke " , " ke->kkke " ]
@ t e s t s e t " E q u a l r e s u l t s a f t e r o p t i m i z a t i o n " f o r o p t i m i z e r i n [
R e d u c t i o n O p t i m i z e r ( ) , R a n d o m W a l k O p t i m i z e r (M e r s e n n e T w i s t e r ( 0 ) )
]
@ t e s t s e t " P r o c e s s $ p r o c _ s t r " f o r p r o c _ s t r i n [
" k e - > k e " , " k p - > k p " , " k k - > e p " , " e p - > k k " , " k e - > k k e " , " k e - > k k k e "
]
m o d e l = Q E D M o d e l ( )
p r o c e s s = p a r s e _ p r o c e s s ( p r o c _ s t r , m o d e l )
m a c h i n e = M a c h i n e (
@@ -347,3 +340,4 @@ end
@ t e s t i s a p p r o x ( c o m p u t e _ f u n c t i o n . ( i n p u t ) , r e d u c e d _ c o m p u t e _ f u n c t i o n . ( i n p u t ) )
e n d
e n d
=#