From 5bcfee4d5d465618db31bea4d2e408aa27e94e89 Mon Sep 17 00:00:00 2001
From: Francisco Coelho <fc@uevora.pt>
Date: Tue, 3 Oct 2023 17:51:20 +0100
Subject: [PATCH] Added README

---
 README.md                           |   9 +++++++++
 data/model_sample-[0.0;0.3;0.2].csv | 370 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 sample_analysis.jl                  |   8 +++++---
 sampling.jl                         |   6 +++---
 4 files changed, 202 insertions(+), 191 deletions(-)

diff --git a/README.md b/README.md
index e69de29..cb988d3 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,9 @@
+# SASP - Stochastic ASP
+
+> This repository contains code and data used in the paper _An Algebraic Approach to Stochastic ASP_
+
+
+There are two [julia](https://julialang.org/) files:
+
+- `sampling.jl` generates (and saves) a sample following the process described in the _Model+Noise_ item in subsection 4.1 of the paper.
+- `sample_analysis.jl` analyses, summarizes and outputs `LaTeX` rows of the samples above.
\ No newline at end of file
diff --git a/data/model_sample-[0.0;0.3;0.2].csv b/data/model_sample-[0.0;0.3;0.2].csv
index e8b9869..aaeca23 100644
--- a/data/model_sample-[0.0;0.3;0.2].csv
+++ b/data/model_sample-[0.0;0.3;0.2].csv
@@ -1,48 +1,35 @@
 event
 A
 A
-A
-A
-A
-A
-A
+ac
 ab
 A
-A
-A
-A
-A
 ac
-A
-A
+ac
 ac
 A
 A
 A
-ab
 A
 A
 A
 A
 A
 A
-ac
 A
 A
 A
-ac
 A
 A
-ac
-ac
 A
 ac
 A
 A
-ac
 A
 A
 A
+ab
+A
 A
 A
 A
@@ -50,7 +37,6 @@ A
 A
 A
 ac
-ab
 A
 A
 A
@@ -59,8 +45,13 @@ A
 ac
 A
 A
+ab
+ab
 A
 ac
+ac
+A
+ab
 A
 A
 A
@@ -68,45 +59,50 @@ ac
 A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l
+++ b/sample_analysis.jl
@@ -63,11 +63,13 @@ core_of = Dict{String,String}(
     "Δ" => "A,ab,ac",
 )
 
-α = 0.1
+ 
+α = 0.0
 β = 0.3
-γ = 0.8
+γ = 0.2
 
-data = CSV.read("model_sample-[$α;$β;$γ].csv", DataFrame)
+
+data = CSV.read("data/model_sample-[$α;$β;$γ].csv", DataFrame)
 transform!(data, :event => ByRow(e -> get(core_of, e, "z")) => :core)
 groups = groupby(data, :core)
 totals = combine(groups, :core => length => :count)
diff --git a/sampling.jl b/sampling.jl
index 7bf838c..de67700 100644
--- a/sampling.jl
+++ b/sampling.jl
@@ -74,9 +74,9 @@ consistent = filter(is_consistent, omega)
 consistent = join.(consistent)
 
  
-α = 0.1
+α = 0.0
 β = 0.3
-γ = 0.5
+γ = 0.2
 
 events = model_sample(1000; 
     α = α,
@@ -85,7 +85,7 @@ events = model_sample(1000;
 
 println( events )
 
-open("model_sample-[$α;$β;$γ].csv", "w") do io
+open("data/model_sample-[$α;$β;$γ].csv", "w") do io
     writedlm(io, [ "event" ])
     writedlm(io,  events)
 end
\ No newline at end of file
--
libgit2 0.21.2