Merge pull request #1 from congyu711/firasans

This commit is contained in:
congyu 2025-05-06 09:46:29 +08:00 committed by GitHub
commit 31c98cd4b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 72 additions and 45 deletions

5
.latexmkrc Normal file
View File

@ -0,0 +1,5 @@
$pdf_mode = 1; # 生成PDF
$latex = 'xelatex %O %S'; # 用 xelatex 替代 latex
$pdflatex = 'xelatex %O %S'; # 用 xelatex 替代 pdflatex
$dvi_mode = 0; # 禁用DVI输出
$postscript_mode = 0; # 禁用PS输出

View File

@ -1,13 +1,32 @@
% Copyright 2018 by Zhibo Wang
%
% This file may be distributed and/or modified
% under the LaTeX Project Public License
\usepackage{libertine}
% !TEX program = xelatex
% !TEX TS-program = xelatex
% fonts
\RequirePackage{fontspec}
% \usefonttheme{professionalfonts}
% \RequirePackage[sfdefault]{FiraSans}
\RequirePackage{FiraMono}
\renewcommand{\rmfamily}{\sffamily}
% \RequirePackage[fakebold]{firamath-otf}
\RequirePackage{unicode-math}
\RequirePackage{amsmath}
\RequirePackage{amsthm}
\RequirePackage{amssymb}
\RequirePackage{inputenc}
\unimathsetup{math-style=ISO, bold-style=ISO, mathrm=sym}
\setsansfont{FiraGO}[BoldFont=* SemiBold, Numbers=Monospaced]
\setmathfont{Fira Math}[BoldFont=*-SemiBold]
% \setmathfont[range=bb]{XITS Math Bold}
\RequirePackage{xeCJK}
\setCJKmainfont{Source Han Sans SC}
\setCJKsansfont{Source Han Sans SC}
\setCJKmonofont{Source Han Sans SC}
\RequirePackage[english]{babel}
\RequirePackage{fancyhdr} % header footer
\RequirePackage{xcolor}
\RequirePackage[dvipsnames]{xcolor}
\RequirePackage{bookmark}
\RequirePackage{hyperref}[colorlinks=true,urlcolor=Blue,citecolor=Green,linkcolor=BrickRed,unicode]
\RequirePackage{natbib}
\RequirePackage{graphicx} % Allows including images
\RequirePackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
% \RequirePackage{tikz}
@ -18,11 +37,8 @@
% \RequirePackage[ruled,linesnumbered]{algorithm2e}
% \RequirePackage{adjustbox}
\RequirePackage{subcaption}
\RequirePackage{amsmath}
\RequirePackage{amsthm}
\RequirePackage[utf8]{inputenc}
\RequirePackage{CJKutf8}
\def\zh#1{\begin{CJK}{UTF8}{gbsn}#1\end{CJK}}
% \RequirePackage{CJKutf8}
% \def\zh#1{\begin{CJK}{UTF8}{gbsn}#1\end{CJK}}
\RequirePackage{aliascnt}
% a color box
@ -125,25 +141,24 @@
\setbeamercolor{alerted text}{fg=beamer@simple@color}
\setbeamerfont{block title alerted}{series=\mdseries}
\setbeamerfont{alerted text}{series=\bfseries\boldmath}
\hypersetup{colorlinks,linkcolor=,urlcolor=oliver}
\hypersetup{colorlinks=true,linkcolor=,citecolor=Green,urlcolor=oliver}
% \usefonttheme[onlymath]{serif}
\setbeamerfont{frametitle}{series=\bfseries\boldmath}
\setbeamerfont{block title}{series=\bfseries\boldmath}
\setbeamerfont{title}{series=\bfseries\boldmath}
\setbeamertemplate{frametitle}{\vskip2pt\hskip-6pt\underline{\insertframetitle}} % add line under frametitle
\setbeamertemplate{frametitle}{\vskip2pt\hskip-6pt\underbar{\insertframetitle}} % add line under frametitle
% theorem env
\setbeamertemplate{theorem begin}{%
{
\vspace{5pt}
\vspace{5pt}%
\usebeamerfont*{block title}%
\selectfont
\selectfont%
\usebeamercolor[fg]{block title}%
\textbf{
\textbf{%
\inserttheoremname
% \inserttheoremnumber
\inserttheoremnumber
\ifx \inserttheoremaddition \empty \else\ [\inserttheoremaddition]\fi
\inserttheorempunctuation
}
}
}
@ -152,7 +167,7 @@
\setbeamertemplate{proof begin}{%
{\vspace{5pt}
\usebeamercolor[fg]{block title}
\textit{Proof.}}
\textit{\textbf{Proof:}}}
}
\setbeamertemplate{proof end}{
\qedhere
@ -160,8 +175,9 @@
}
% more theorem env
\newtheorem{observation}{Observation}
\newtheorem{question}{Question}
\newtheorem{conjecture}[theorem]{Conjecture}
\newtheorem{observation}[theorem]{Observation}
\newtheorem{question}[theorem]{Question}
% ----------------------------------------------------------------------
@ -174,13 +190,13 @@
% I give up. These are in the wrong font, but my kludged versions
% LOOK like kludges, especially \Z, \Q, and \C.
%
\def\Real{\mathbb{R}}
\def\Proj{\mathbb{P}}
\def\Hyper{\mathbb{H}}
\def\Integer{\mathbb{Z}}
\def\Natural{\mathbb{N}}
\def\Complex{\mathbb{C}}
\def\Rational{\mathbb{Q}}
\def\Real{}
\def\Proj{}
\def\Hyper{}
\def\Integer{}
\def\Natural{}
\def\Complex{}
\def\Rational{}
\let\N\Natural
\let\Q\Rational

BIN
main.pdf

Binary file not shown.

View File

@ -1,8 +1,8 @@
\documentclass{beamer}
\title[template example]{Minimizing the Sum of Piecewise Linear Convex Functions}
\title[template example]{Title}
\date{\today}
\author{\texorpdfstring{\zh{丛宇}}{Yu Cong}}
\author{丛宇}
% \AtBeginSection[]{
% \frame{\frametitle{Outline}\tableofcontents[currentsection,
% subsectionstyle=show/show/shaded]}
@ -23,6 +23,7 @@
\section{Problems \& Definitions}
\begin{frame}{$\min \sum f_i(a_i\cdot x-b_i)$}
$A\setminus B$ 测试中文:
\begin{problem}
Given $n$ piecewise linear convex functions $f_1,...,f_n:\R \to \R$ of total $m$ breakpoints, and $n$ linear functions $a_i\cdot x-b_i:\R^d\to \R$, find $\min_x \sum_i f_i(a_i\cdot x-b_i)$.
\end{problem}
@ -78,7 +79,7 @@ However, observe that in our problem the piecewise linear convex function is not
Let $n_i$ be the number of line segments in $f_i$. Note that $\sum_i n_i=m+n$.
We can formulate the optimization problem as the following linear program,
\newpage
\framebreak
\begin{align*}
\min &\sum_{i=1}^n f_i\\
@ -92,10 +93,8 @@ However, observe that in our problem the piecewise linear convex function is not
\section{LP in Low Dimensions}
\begin{frame}[allowframebreaks]{Megiddo's algorithm}%
\boxfill{
\tiny
\url{https://people.inf.ethz.ch/gaertner/subdir/texts/own_work/chap50-fin.pdf}
}
\url{https://people.inf.ethz.ch/gaertner/subdir/texts/own_work/chap50-fin.pdf}
The dimension $d$ (in our problem, the dimension of $x$) is small while the number of constraints are huge. We need only $d$ linearly independent tight constraints to identify the optimal solution $x^*$.
Thus most of the constraints are useless.
@ -106,7 +105,7 @@ However, observe that in our problem the piecewise linear convex function is not
Through inquiries. Let $a\cdot x \leq b$ be the constraint. Define 3 hyperplanes, $a\cdot x = c$ where $c\in \set{b,b-\e,b+\e}$. Now solve three $d-1$ dimension linear programming. The largest of the three objective functions tells us where $x^*$ lies with respect to the
hyperplane.
\newpage
\framebreak
Finding the optimal solution $x^*$ is therefore equivalent to the following problem,
\begin{problem}[Multidimensional Search Problem]
Suppose that there exists a point $x^*$ which is not known to us, but there is a oracle that can tell the position of $x^*$ relative to any hyperplane in $\R^d$. Given $n$ hyperplanes, we want to know the position of $x^*$ relative to each of them.
@ -114,7 +113,7 @@ However, observe that in our problem the piecewise linear convex function is not
\textbf{What about 1 dimension search?} A fastest way will be using the linear time median algorithm. We can find the median of $n$ numbers and call the oracle to compare the median with $x^*$. Thus with $O(n)$ time median finding and one oracle call, we find the relative position of $n/2$ elements relative to $x^*$.
\newpage
\framebreak
If we can do similar things in $\R^d$, i.e., there is a method which makes $A(d)$ oracle calls and determines at least $B(d)$ fraction of relative positions, then we can apply this method $\log_{\frac{1}{1-B(d)}} n$ times to find all relative positions.
@ -124,7 +123,7 @@ However, observe that in our problem the piecewise linear convex function is not
\[T(n,d)=n(3T(n-1,d-1)+O(nd))\]
Note that in this setting $A(d)=1$ and $B(d)=1/n$.
\newpage
\framebreak
Megiddo designed a clever method where $A(d)=2^{d-1}$ and $B(d)=2^{-(2^d-1)}$.
\begin{lemma}
@ -133,7 +132,7 @@ However, observe that in our problem the piecewise linear convex function is not
\end{figure}
Given two lines through the origin with slopes of opposite sign, knowing which quadrant $x^*$ lies in allows us to locate it with respect to at least one of the lines.
\end{lemma}
\newpage
\framebreak
Let $l_H$ be the intersection of hyperplane $H$ and $x_1x_2$ plane.
Compute a partition $S_1\sqcup S_2=\mathcal H$.
$H\in S_1$ iff $l_H$ has positive slope. Otherwise $l_H\in S_2$. We further assume that $|S_1|=|S_2|=n/2$.
@ -148,12 +147,8 @@ However, observe that in our problem the piecewise linear convex function is not
Now we have $n/2$ pairs $(H_1,H_2)$, where $H_i\in S_i$. Let $l_i$ be the intersection of $H_i$ and $x_1x_2$ plane.
Let $H_{x_i}$ be the linear combination of $H_1$ and $H_2$ s.t. $x_i$ is eliminated.
\end{minipage}
{
% Now we have $n/2$ pairs $(H_1,H_2)$, where $H_i\in S_i$. Let $l_i$ be the intersection of $H_i$ and $x_1x_2$ plane.
% Let $H_{x_i}$ be the linear combination of $H_1$ and $H_2$ s.t. $x_i$ is eliminated.
By the previous lemma, calling oracle on $l_{x_1}$ and $l_{x_2}$ locate $x^*$ with respect to at least one of $H_1$ and $H_2$.}
\newpage
By the previous lemma, calling oracle on $l_{x_1}$ and $l_{x_2}$ locate $x^*$ with respect to at least one of $H_1$ and $H_2$.
\framebreak
Input: $S_1,S_2$ and the pairs.
\begin{enumerate}
\item recursively locate $x^*$ respect to $B(d-1)n/2$ hyperplanes($H_{x_i}$) with $A(d-1)$ oracle calls in $S_1$.

11
readme.md Normal file
View File

@ -0,0 +1,11 @@
To use this theme:
1. install fonts. [FiraGO](https://github.com/bBoxType/FiraGO), [firamath](https://github.com/firamath/firamath)(build from source) and [Source Han Sans SC](https://github.com/adobe-fonts/source-han-sans/releases).
2. use xelatex. `.latexmkrc` generated by chatgpt
```latexmk
$pdf_mode = 1;
$latex = 'xelatex %O %S';
$pdflatex = 'xelatex %O %S';
$dvi_mode = 0;
$postscript_mode = 0;
```