diff --git a/scripts/make.py b/scripts/make.py index a3fe6c1..7d6020b 100644 --- a/scripts/make.py +++ b/scripts/make.py @@ -142,9 +142,14 @@ def pdfgenr(post): metainj(tmp_dir + "index.tex") texpost(tmp_dir + "index.tex") texcomp("drvpst.ltx") + if not os.path.exists(tmp_dir + "index.pdf"): + print(f" LaTeX failed: {post} (no PDF produced); skipping") + shutil.rmtree(tmp_dir, ignore_errors=True) + return False shutil.copy(tmp_dir + "index.tex", pbl_dir + post + "/index.tex") shutil.copy(tmp_dir + "index.pdf", pbl_dir + post + "/index.pdf") shutil.rmtree(tmp_dir) + return True def post(): # Compiles each post, specifically converts the .md file to a .tex file @@ -165,10 +170,9 @@ def post(): print(f" Skipping post: {post} #{hsh}") continue print(f" Processing post: {post}") - # Write markdown hash to file `sha256` - File(pbl_dir + post + "/sha256").write(hsh) - # Compile PDF - pdfgenr(post) + # Compile PDF; only record the hash on success so failed posts are retried + if pdfgenr(post): + File(pbl_dir + post + "/sha256").write(hsh) # Cleaning os.chdir(utl_dir) print(" Cleaning up:") diff --git a/src/content/blog/2026-02-13/index.md b/src/content/blog/2026-02-13/index.md index a7bc181..6d7a8d0 100644 --- a/src/content/blog/2026-02-13/index.md +++ b/src/content/blog/2026-02-13/index.md @@ -18,7 +18,7 @@ pdf: true 路径规划算法可大致分为搜索类、采样类和优化类三大类型。搜索类以 Dijkstra 和 A*为代表,前者通过非负权图的最短路径求解实现全局最优,但忽略启发式信息导致效率低下;A*引入 admissible 启发式函数$h(n)$,如欧氏距离$\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$,平衡了路径代价$g(n)$和估计代价$f(n) = g(n) + h(n)$,时间复杂度为$O((V+E)\log V)$,优点是最优性强,缺点是节点膨胀严重。采样类如 RRT 和 PRM 适用于高维空间,通过随机采样构建概率完整路图,时间复杂度约$O(n \log n)$,优点是维度无关,缺点是路径平滑度差且非确定最优。优化类如 D*和 Jump Point Search 针对动态重规划,视场景复杂度而定。 -数学基础建立在状态空间模型上。将环境抽象为图$G=(V,E)$,其中$V$为可行配置空间节点,$E$为边集,代价函数$c(u,v)$表示从$u$到$v$的移动成本。A*的核心是启发式函数$h(n)$需满足 admissible 条件,即$h(n) \leq h^*(n)$(真实最优代价),且 consistent 条件$h(n) \leq c(n, n') + h(n')$,确保单次扩展的最优性。这些性质通过优先队列(如堆)实现$f(n)$最小节点弹出。 +数学基础建立在状态空间模型上。将环境抽象为图$G=(V,E)$,其中$V$为可行配置空间节点,$E$为边集,代价函数$c(u,v)$表示从$u$到$v$的移动成本。A*的核心是启发式函数$h(n)$需满足 admissible 条件,即$h(n) \leq h^{*}(n)$(真实最优代价),且 consistent 条件$h(n) \leq c(n, n') + h(n')$,确保单次扩展的最优性。这些性质通过优先队列(如堆)实现$f(n)$最小节点弹出。 性能评估依赖多维指标:路径长度衡量总代价,最优性比较基准解偏差,计算时间记录平均/最坏情况,内存占用追踪开放/闭合集大小,成功率统计复杂场景下求解比例。这些指标为优化提供量化依据,例如在仓库环境中,成功率低于 90% 的算法即视为不合格。