mirror of
https://github.com/Zenithsiz/ist-ddrs-lab2
synced 2026-02-03 22:23:55 +00:00
All output files are now created at output/.
This commit is contained in:
parent
fdaa11752e
commit
b6499e8da7
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,8 +1,6 @@
|
||||
# Auto-generated
|
||||
*.pdf
|
||||
images/*.svg
|
||||
diagrams/*.svg
|
||||
tables/*.csv
|
||||
output/
|
||||
|
||||
# Exceptions
|
||||
!guide.pdf
|
||||
|
||||
8
code/1.R
8
code/1.R
@ -53,7 +53,7 @@ simulate <- function(alpha, beta, output_file) {
|
||||
|
||||
set.seed(0)
|
||||
pdf(NULL)
|
||||
simulate(0.1, 0.1, "images/1a (α=0.1, β=0.1).svg")
|
||||
simulate(0.5, 0.5, "images/1a (α=0.5, β=0.5).svg")
|
||||
simulate(0.9, 0.9, "images/1a (α=0.9, β=0.9).svg")
|
||||
simulate(0.9, 0.1, "images/1b (α=0.9, β=0.1).svg")
|
||||
simulate(0.1, 0.1, "output/1a (α=0.1, β=0.1).svg")
|
||||
simulate(0.5, 0.5, "output/1a (α=0.5, β=0.5).svg")
|
||||
simulate(0.9, 0.9, "output/1a (α=0.9, β=0.9).svg")
|
||||
simulate(0.9, 0.1, "output/1b (α=0.9, β=0.1).svg")
|
||||
|
||||
4
code/2.R
4
code/2.R
@ -17,7 +17,7 @@ for (data_idx in 2:length(data)) {
|
||||
|
||||
cat("Occurrences matrix:\n")
|
||||
print(occur_matrix)
|
||||
write.table(occur_matrix, "tables/2-occur.csv", sep = "\t", col.names = FALSE, row.names = FALSE)
|
||||
write.table(occur_matrix, "output/2-occur.csv", sep = "\t", col.names = FALSE, row.names = FALSE)
|
||||
|
||||
prob_matrix <- apply(
|
||||
occur_matrix,
|
||||
@ -27,7 +27,7 @@ prob_matrix <- apply(prob_matrix, 2, function(cell) round(cell, 2))
|
||||
|
||||
cat("Probability matrix:\n")
|
||||
print(prob_matrix)
|
||||
write.table(prob_matrix, "tables/2-prob.csv", sep = "\t", col.names = FALSE, row.names = FALSE)
|
||||
write.table(prob_matrix, "output/2-prob.csv", sep = "\t", col.names = FALSE, row.names = FALSE)
|
||||
|
||||
alpha <- prob_matrix[1, 1]
|
||||
beta <- prob_matrix[2, 1]
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#indent_par[The 2-DTMC process is capable of performing both what the Bernoulli process can, as well as another interesting behavior]
|
||||
|
||||
#figure(
|
||||
image("/diagrams/1.svg", width: 50%),
|
||||
image("/output/1.svg", width: 50%),
|
||||
caption: [2-DTMC process]
|
||||
)
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
#indent_par[When the α and β parameters are on opposite sides of the spectrum, the 2-DTMC process exhibits an interesting behavior:]
|
||||
|
||||
#figure(
|
||||
image("/images/1b (α=0.9, β=0.1).svg", width: 50%),
|
||||
image("/output/1b (α=0.9, β=0.1).svg", width: 50%),
|
||||
caption: [2-DTMC and Bernoulli processes (α=0.9, β=0.1)]
|
||||
)
|
||||
|
||||
@ -27,15 +27,15 @@
|
||||
#grid(
|
||||
columns: (1fr, 1fr, 1fr),
|
||||
figure(
|
||||
image("/images/1a (α=0.1, β=0.1).svg", width: 80%),
|
||||
image("/output/1a (α=0.1, β=0.1).svg", width: 80%),
|
||||
caption: [2-DTMC and Bernoulli processes (α=0.1, β=0.1)]
|
||||
),
|
||||
figure(
|
||||
image("/images/1a (α=0.5, β=0.5).svg", width: 80%),
|
||||
image("/output/1a (α=0.5, β=0.5).svg", width: 80%),
|
||||
caption: [2-DTMC and Bernoulli processes (α=0.5, β=0.5)]
|
||||
),
|
||||
figure(
|
||||
image("/images/1a (α=0.9, β=0.9).svg", width: 80%),
|
||||
image("/output/1a (α=0.9, β=0.9).svg", width: 80%),
|
||||
caption: [2-DTMC and Bernoulli processes (α=0.9, β=0.9)]
|
||||
)
|
||||
)
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
|
||||
#indent_par[The following were our results:]
|
||||
|
||||
#let occur_matrix = csv("/tables/2-occur.csv", delimiter: "\t")
|
||||
#let prob_matrix = csv("/tables/2-prob.csv", delimiter: "\t")
|
||||
#let occur_matrix = csv("/output/2-occur.csv", delimiter: "\t")
|
||||
#let prob_matrix = csv("/output/2-prob.csv", delimiter: "\t")
|
||||
#grid(
|
||||
columns: (1fr, 1fr),
|
||||
figure(
|
||||
|
||||
16
zbuild.yaml
16
zbuild.yaml
@ -1,5 +1,5 @@
|
||||
---
|
||||
default: [diagrams/1.svg, rule: ex1, rule: ex2]
|
||||
default: [output/1.svg, rule: ex1, rule: ex2]
|
||||
|
||||
rules:
|
||||
# Typst
|
||||
@ -20,7 +20,7 @@ rules:
|
||||
diagram:
|
||||
alias:
|
||||
input: diagrams/^(file).dot
|
||||
output: diagrams/^(file).svg
|
||||
output: output/^(file).svg
|
||||
out: [$(output)]
|
||||
deps: [$(input)]
|
||||
exec:
|
||||
@ -33,10 +33,10 @@ rules:
|
||||
# Exercise 1
|
||||
ex1:
|
||||
out:
|
||||
- images/1a (α=0.1, β=0.1).svg
|
||||
- images/1b (α=0.9, β=0.1).svg
|
||||
- images/1a (α=0.5, β=0.5).svg
|
||||
- images/1a (α=0.9, β=0.9).svg
|
||||
- output/1a (α=0.1, β=0.1).svg
|
||||
- output/1b (α=0.9, β=0.1).svg
|
||||
- output/1a (α=0.5, β=0.5).svg
|
||||
- output/1a (α=0.9, β=0.9).svg
|
||||
deps:
|
||||
- code/1.R
|
||||
exec:
|
||||
@ -46,8 +46,8 @@ rules:
|
||||
# Exercise 2
|
||||
ex2:
|
||||
out:
|
||||
- tables/2-occur.csv
|
||||
- tables/2-prob.csv
|
||||
- output/2-occur.csv
|
||||
- output/2-prob.csv
|
||||
deps:
|
||||
- code/2.R
|
||||
exec:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user