Skip to content
Snippets Groups Projects
Commit 0c8d9a96 authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

prace: Mega moc změn

parent 270070fa
Branches
No related tags found
No related merge requests found
...@@ -46,9 +46,6 @@ class Run: ...@@ -46,9 +46,6 @@ class Run:
self._from = None self._from = None
self.seed = json["seed"] self.seed = json["seed"]
if self.error:
print(self, self.print_pipeline(), self.algo_version, self.is_up_to_date())
def print_pipeline(self, versions=False): def print_pipeline(self, versions=False):
x = "" x = ""
if self._from: if self._from:
...@@ -64,6 +61,8 @@ class Run: ...@@ -64,6 +61,8 @@ class Run:
return x return x
def is_up_to_date(self): def is_up_to_date(self):
if not self.data_cls.validate_versions:
return True
if self._from and not self._from.is_up_to_date(): if self._from and not self._from.is_up_to_date():
return False return False
return self.algo_version == self.algo.current_version return self.algo_version == self.algo.current_version
......
...@@ -42,7 +42,8 @@ def box(element, context, processor): ...@@ -42,7 +42,8 @@ def box(element, context, processor):
'task': "Úloha", 'task': "Úloha",
'algo': "Algoritmus", 'algo': "Algoritmus",
'theorem': "Věta", 'theorem': "Věta",
'lemma': "Lemma" 'lemma': "Lemma",
'def': "Definice",
}[element.attributes["t"]] }[element.attributes["t"]]
out = [] out = []
intro = [] intro = []
...@@ -86,3 +87,48 @@ def figure(element, content, processor): ...@@ -86,3 +87,48 @@ def figure(element, content, processor):
x = processor.transform([pf.Figure(*data, caption=pf.Caption(pf.Plain(*caption)), identifier=element.identifier, attributes=element.attributes)]) x = processor.transform([pf.Figure(*data, caption=pf.Caption(pf.Plain(*caption)), identifier=element.identifier, attributes=element.attributes)])
x[0].content = remove_div_para_to_plain(*x[0].content) x[0].content = remove_div_para_to_plain(*x[0].content)
return x return x
def copy(e, *content):
kwargs = dict()
if hasattr(e, 'attributes'):
kwargs['attributes'] = e.attributes
if hasattr(e, 'classes'):
kwargs['classes'] = e.classes
if hasattr(e, 'identifier'):
kwargs['identifier'] = e.identifier
return type(e)(
*content,
**kwargs
)
def texb(s):
return pf.RawBlock(s, format="tex")
def texi(s):
return pf.RawInline(s, format="tex")
@formatitko_command
def refs(element, content, processor):
x = []
(div1,) = element.content
assert type(div1) == pf.Div
for div2 in div1.content:
assert type(div2) == pf.Div, type(div2)
for para in div2.content:
assert type(para) == pf.Para, para
x.append(copy(div2, copy(para,
texi("\\hskip -1.3cm\\hbox to 1.3cm{"),
para.content[0],
texi("\\hfil}"),
*para.content[1:],
)))
return [
texb(
"""{
\\leftskip=1.3cm
\\rightskip=0pt plus 3em
\\relax"""
),
copy(div1, *x),
texb("}"),
]
...@@ -4,12 +4,16 @@ import plotly.graph_objects as go ...@@ -4,12 +4,16 @@ import plotly.graph_objects as go
import numpy as np import numpy as np
from . import data_lib from . import data_lib
import pathlib import pathlib
import sys, os
d = pathlib.Path("/".join(__file__.split("/")[:-1])) d = pathlib.Path("/".join(__file__.split("/")[:-1]))
def load(name): def load(name):
return data_lib.Data(d/name, validate_versions=False) return data_lib.Data(d/name, validate_versions=False)
def load_main_test():
return load(d/"main_test/log")
algo_to_name = { algo_to_name = {
"greedy": "Hladové ř.", "greedy": "Hladové ř.",
"rg": "Rekurzivní ř.", "rg": "Rekurzivní ř.",
...@@ -38,11 +42,12 @@ def draw_algo_graph(fig, data, algo, n, val_getter=lambda x:x.score, name=None, ...@@ -38,11 +42,12 @@ def draw_algo_graph(fig, data, algo, n, val_getter=lambda x:x.score, name=None,
def intro_graph(algo): def intro_graph(algo):
fig = plotly.subplots.make_subplots(rows=2, cols=1, row_heights=[0.8, 0.2], shared_xaxes=True, vertical_spacing = 0.05) fig = plotly.subplots.make_subplots(rows=2, cols=1, row_heights=[0.8, 0.2], shared_xaxes=True, vertical_spacing = 0.05)
draw_algo_graph(fig, data_lib.Data(d/"log-intr", validate_versions=False), algo, 200) draw_algo_graph(fig, load_main_test(), algo, 200)
return fig return fig
def nonzero_coords(n, seeds, max_dim=20): def nonzero_coords(n, seeds, max_dim=20):
nonzero_coords = [[float(i) for i in open(d/f"semidef_prog_nonzero_coord/n{n}_seed{i:04}").read().split()] for i in seeds] data_dir = d/"main_test/sdp/nonzero_coord"
nonzero_coords = [[float(i) for i in open(data_dir/f).read().split()] for f in os.listdir(data_dir) if f.startswith(f"{n}-")]
fig = go.Figure(data=[go.Box( fig = go.Figure(data=[go.Box(
y=[x[i] for x in nonzero_coords], y=[x[i] for x in nonzero_coords],
...@@ -61,7 +66,8 @@ def nonzero_coords(n, seeds, max_dim=20): ...@@ -61,7 +66,8 @@ def nonzero_coords(n, seeds, max_dim=20):
return fig return fig
def max_coords(n, seeds, max_dim=20): def max_coords(n, seeds, max_dim=20):
max_coords = [[float(i) for i in open(d/f"semidef_prog_max_coord/n{n}_seed{i:04}").read().split()] for i in seeds] data_dir = d/"main_test/sdp/max_coord"
max_coords = [[float(i) for i in open(data_dir/f).read().split()] for f in os.listdir(data_dir) if f.startswith(f"{n}-")]
fig = go.Figure(data=[go.Box( fig = go.Figure(data=[go.Box(
y=[x[i] for x in max_coords], y=[x[i] for x in max_coords],
......
This diff is collapsed.
...@@ -153,3 +153,27 @@ isbn="978-3-642-40328-6" ...@@ -153,3 +153,27 @@ isbn="978-3-642-40328-6"
} }
@online{maxcut-derandom,
author = {Alexander Dimitrakakis},
title = {Lecture notes for Randomness and Computation, lecture 6},
url = {https://people.csail.mit.edu/ronitt/COURSE/S20/NOTES/lec6-scribe.pdf},
year = {2020},
urldate = {2024-04-20}
}
@online{maxcut-np,
author = {Kevin Sun},
title = {Lecture notes for Graph Algorithms, lecture 22},
url = {https://people.csail.mit.edu/ronitt/COURSE/S20/NOTES/lec6-scribe.pdf},
year = {2019},
urldate = {2024-04-20}
}
@online{cpp-norm,
author = {{ISO/IEC}},
title = {Working Draft, Standard for Programming Language C++},
url = {https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf},
year = {2014},
urldate = {2024-04-20}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment