### Thesis: Worked on advanced int creation stuff

parent 9c21de91
 \chapter{Benchmark Problems} \ No newline at end of file
 ... ... @@ -62,6 +62,8 @@ %% [OPT] Added by kelmich. Allows drawing of graphs + other fancy things \usepackage{tikz} \usetikzlibrary{positioning}% To get more advances positioning options \usetikzlibrary{arrows}% To get more arrow heads %% [OPT] Added by kelmich. Allows for text immediately after figures. \usepackage{placeins} \ No newline at end of file
 \chapter{Computational Hardness} We show that the problem of finding a perfect solution to a pixel farming problem is NP complete. We show that the problem of finding a solution of a certain quality to a pixel farming problem is NP complete. To do this we will first formulate the problem as a decision problem. In a second step we will show that the problem is in NP. Lastly we will ... ... @@ -22,7 +23,17 @@ such that the score $S(F, R)$ is at least $s$: s \leq S(F, R) \end{displaymath} \section{Pixel Farming is in NP} \section{Pixel Farming is NP complete} Now that we have defined the decision version of the problem, we formulate and prove the following theorem: \begin{theorem} The decision version of pixel farming is NP complete. \end{theorem} \begin{proof} Assume we are given a field $F$ and a relation function $R$. By computing $S(F, R)$, which ... ... @@ -35,7 +46,7 @@ the field should consist of a certain crop, can also be done in polynomial time in relation to the field size $X \cdot Y$ and number of crops $C$. \section{Pixel Farming finds Hamiltonian Paths} It is known that finding Hamiltonian Paths is NP complete. Thus, reducing the decision version of hamiltonian paths (explained below) to the decision ... ... @@ -125,4 +136,6 @@ not of sufficient length. \hfill \caption{example structure} \end{figure} \FloatBarrier \ No newline at end of file \FloatBarrier \end{proof} \ No newline at end of file
 ... ... @@ -2,4 +2,127 @@ \section{Growing solutions} \section{Creating integer solutions from fractional solutions} \ No newline at end of file \section{Creating integer solutions from fractional solutions} If we were able to take a field that can contain multiple crops in a pixel and transform it into a solution of the same quality where every pixel contains exactly one crop, this would enable us to try additional standard optimization techniques. Of course the field with fractional amounts of crops in pixels has to meet the distribution requirement of the pixel farming problem as well as only contain positive or $0$ amounts of planted crop in a pixel. \subsection{The standard method} First we introduce a method that has good results on large fields and requires no conditions of $R$. \begin{theorem} A fractional pixel farming solution can be transformed to a fractional solution with at least the same score where up to $4 \cdot \binom{C}{2}$ pixels are still fractional. All other pixels contain only one crop. \end{theorem} \begin{proof} The key insight for this statement is that the score function changes linearly when swapping crops between non-neighboring pixels. Picture two non-neighboring pixels that both contain the crops $c_1$ and $c_2$: \FloatBarrier \begin{figure}[h] \centering \begin{tikzpicture}[->,>=stealth',auto,node distance=3cm,thick,main node/.style={rectangle,draw,font=\sffamily\Large\bfseries}] \node[main node] (1) {U}; \node[main node] (2) [right of=1] {V}; \path[every node/.style={font=\sffamily\small}] (1) edge[bend left] node [above] {$\lambda \cdot c_1$} (2) (2) edge[bend left] node [below] {$\lambda \cdot c_2$} (1); \end{tikzpicture} \end{figure} \FloatBarrier Because the neighborhoods remain constant, the shift function above changes the score linearly. This means there is always a direction in which we can swap crops without making the score worse. We perform the swap until at least one of the two pixels is unable to continue with swapping (i.e. runs out of crop to give to the other pixel). Therefore, every time we swap like this, we eliminate at least one crop from at least one fractional pixel. Next we argue that for this result it is not necessary to swap between neighboring pixels. Consider the field below. If we only swap between pixels that have the same color, then we never have to swap between neighboring pixels. It is always possible to color a rectangle field in this fashion with $4$ colors. \FloatBarrier \begin{figure}[h] \centering \begin{tikzpicture}[x=1cm] \foreach \x in {0,...,3} \foreach \y in {0,...,3} { \pgfmathparse{mod(\x+\y,2) ? (mod(\x,2) ? "red" : "green") : (mod(\x,2) ? "blue" : "gray")} \edef\colour{\pgfmathresult} \path[fill=\colour] (\x,\y) rectangle ++ (1,1); } \draw (0,0)--(0,4)--(4,4)--(4,0)--cycle; \end{tikzpicture} \end{figure} \FloatBarrier Further we argue that iterating this method terminates. While there exist pixels of the same color that both contain the same two crops, we perform the swap as outlined above. Eventually, because we get rid of at least one fractional crop every time we swap, we must reach a state for a pixel color where no two pixels contain two of the same crop. Because only a finite amount of fractional crops can exist in a field, we must terminate in finite time. A state where no two pixels contain the same crop means in the worst case there are up to $\binom{C}{2}$ pixels that each contain two crops. All other pixels must now contain exactly one unit of one crop. Because there are four colors among which we swap, this means in the worst case we end up with $4 \cdot \binom{C}{2}$ pixels that are still fractional. TODO: QED SYMBOL MISSING? \end{proof} \subsection{The advanced method} There might be situations where up to $4 \cdot \binom{C}{2}$ still fractional pixels are unacceptable. This might be the case in relatively small fields with relatively large amounts of different crops. Here the following slightly stronger statement with a weak condition on $R$ might be helpful: \begin{theorem} If every crop prefers all other crops over itself, then a fractional pixel farming solution can be transformed to a fractional solution with at least the same score where up to $\binom{C}{2}$ pixels are still fractional. All other pixels contain only one crop. \end{theorem} \begin{proof} The general proof strategy is the same as with the previous theorem. The change we make is that we allow swapping of crops between neighboring pixels. \end{proof} \ No newline at end of file
 \chapter{The Linear Programming Method} \ No newline at end of file \chapter{The Linear Programming Method}
 ... ... @@ -2,15 +2,17 @@ \BOOKMARK [-]{chapter.1}{\376\377\000I\000n\000t\000r\000o\000d\000u\000c\000t\000i\000o\000n}{}% 2 \BOOKMARK [-]{chapter.2}{\376\377\000R\000e\000l\000a\000t\000e\000d\000\040\000W\000o\000r\000k}{}% 3 \BOOKMARK [-]{chapter.3}{\376\377\000P\000r\000o\000b\000l\000e\000m\000\040\000S\000t\000a\000t\000e\000m\000e\000n\000t}{}% 4 \BOOKMARK [-]{chapter.4}{\376\377\000C\000o\000m\000p\000u\000t\000a\000t\000i\000o\000n\000a\000l\000\040\000H\000a\000r\000d\000n\000e\000s\000s}{}% 5 \BOOKMARK [-]{section.4.1}{\376\377\000T\000h\000e\000\040\000d\000e\000c\000i\000s\000i\000o\000n\000\040\000v\000e\000r\000s\000i\000o\000n\000\040\000o\000f\000\040\000p\000i\000x\000e\000l\000\040\000f\000a\000r\000m\000i\000n\000g}{chapter.4}% 6 \BOOKMARK [-]{section.4.2}{\376\377\000P\000i\000x\000e\000l\000\040\000F\000a\000r\000m\000i\000n\000g\000\040\000i\000s\000\040\000i\000n\000\040\000N\000P}{chapter.4}% 7 \BOOKMARK [-]{section.4.3}{\376\377\000P\000i\000x\000e\000l\000\040\000F\000a\000r\000m\000i\000n\000g\000\040\000f\000i\000n\000d\000s\000\040\000H\000a\000m\000i\000l\000t\000o\000n\000i\000a\000n\000\040\000P\000a\000t\000h\000s}{chapter.4}% 8 \BOOKMARK [-]{chapter.5}{\376\377\000H\000e\000l\000p\000f\000u\000l\000\040\000S\000t\000a\000t\000e\000m\000e\000n\000t\000s}{}% 9 \BOOKMARK [-]{section.5.1}{\376\377\000G\000r\000o\000w\000i\000n\000g\000\040\000s\000o\000l\000u\000t\000i\000o\000n\000s}{chapter.5}% 10 \BOOKMARK [-]{section.5.2}{\376\377\000C\000r\000e\000a\000t\000i\000n\000g\000\040\000i\000n\000t\000e\000g\000e\000r\000\040\000s\000o\000l\000u\000t\000i\000o\000n\000s\000\040\000f\000r\000o\000m\000\040\000f\000r\000a\000c\000t\000i\000o\000n\000a\000l\000\040\000s\000o\000l\000u\000t\000i\000o\000n\000s}{chapter.5}% 11 \BOOKMARK [-]{chapter.6}{\376\377\000T\000h\000e\000\040\000L\000i\000n\000e\000a\000r\000\040\000P\000r\000o\000g\000r\000a\000m\000m\000i\000n\000g\000\040\000M\000e\000t\000h\000o\000d}{}% 12 \BOOKMARK [-]{chapter.7}{\376\377\000G\000r\000a\000d\000i\000e\000n\000t\000\040\000D\000e\000s\000c\000e\000n\000t}{}% 13 \BOOKMARK [-]{chapter.8}{\376\377\000C\000o\000n\000c\000l\000u\000s\000i\000o\000n}{}% 14 \BOOKMARK [-]{appendix.A}{\376\377\000C\000a\000l\000c\000u\000l\000a\000t\000i\000o\000n\000s\000\040\000A\000p\000p\000e\000n\000d\000i\000x}{}% 15 \BOOKMARK [-]{appendix*.4}{\376\377\000B\000i\000b\000l\000i\000o\000g\000r\000a\000p\000h\000y}{}% 16 \BOOKMARK [-]{chapter.4}{\376\377\000B\000e\000n\000c\000h\000m\000a\000r\000k\000\040\000P\000r\000o\000b\000l\000e\000m\000s}{}% 5 \BOOKMARK [-]{chapter.5}{\376\377\000C\000o\000m\000p\000u\000t\000a\000t\000i\000o\000n\000a\000l\000\040\000H\000a\000r\000d\000n\000e\000s\000s}{}% 6 \BOOKMARK [-]{section.5.1}{\376\377\000T\000h\000e\000\040\000d\000e\000c\000i\000s\000i\000o\000n\000\040\000v\000e\000r\000s\000i\000o\000n\000\040\000o\000f\000\040\000p\000i\000x\000e\000l\000\040\000f\000a\000r\000m\000i\000n\000g}{chapter.5}% 7 \BOOKMARK [-]{section.5.2}{\376\377\000P\000i\000x\000e\000l\000\040\000F\000a\000r\000m\000i\000n\000g\000\040\000i\000s\000\040\000N\000P\000\040\000c\000o\000m\000p\000l\000e\000t\000e}{chapter.5}% 8 \BOOKMARK [-]{chapter.6}{\376\377\000H\000e\000l\000p\000f\000u\000l\000\040\000S\000t\000a\000t\000e\000m\000e\000n\000t\000s}{}% 9 \BOOKMARK [-]{section.6.1}{\376\377\000G\000r\000o\000w\000i\000n\000g\000\040\000s\000o\000l\000u\000t\000i\000o\000n\000s}{chapter.6}% 10 \BOOKMARK [-]{section.6.2}{\376\377\000C\000r\000e\000a\000t\000i\000n\000g\000\040\000i\000n\000t\000e\000g\000e\000r\000\040\000s\000o\000l\000u\000t\000i\000o\000n\000s\000\040\000f\000r\000o\000m\000\040\000f\000r\000a\000c\000t\000i\000o\000n\000a\000l\000\040\000s\000o\000l\000u\000t\000i\000o\000n\000s}{chapter.6}% 11 \BOOKMARK [-]{subsection.6.2.1}{\376\377\000T\000h\000e\000\040\000s\000t\000a\000n\000d\000a\000r\000d\000\040\000m\000e\000t\000h\000o\000d}{section.6.2}% 12 \BOOKMARK [-]{subsection.6.2.2}{\376\377\000T\000h\000e\000\040\000a\000d\000v\000a\000n\000c\000e\000d\000\040\000m\000e\000t\000h\000o\000d}{section.6.2}% 13 \BOOKMARK [-]{chapter.7}{\376\377\000T\000h\000e\000\040\000L\000i\000n\000e\000a\000r\000\040\000P\000r\000o\000g\000r\000a\000m\000m\000i\000n\000g\000\040\000M\000e\000t\000h\000o\000d}{}% 14 \BOOKMARK [-]{chapter.8}{\376\377\000G\000r\000a\000d\000i\000e\000n\000t\000\040\000D\000e\000s\000c\000e\000n\000t}{}% 15 \BOOKMARK [-]{chapter.9}{\376\377\000C\000o\000n\000c\000l\000u\000s\000i\000o\000n}{}% 16 \BOOKMARK [-]{appendix.A}{\376\377\000C\000a\000l\000c\000u\000l\000a\000t\000i\000o\000n\000s\000\040\000A\000p\000p\000e\000n\000d\000i\000x}{}% 17 \BOOKMARK [-]{appendix*.4}{\376\377\000B\000i\000b\000l\000i\000o\000g\000r\000a\000p\000h\000y}{}% 18
No preview for this file type
 ... ... @@ -115,6 +115,7 @@ \input{indroduction.tex} \input{related-work.tex} \input{problem-statement.tex} \input{benchmarks.tex} \input{hardness.tex} \input{helpers.tex} \input{lp-method.tex} ... ...
 \contentsline {theorem}{{Theorem}{5.{1}}{}}{9}{theorem.5.2.1}% \contentsline {proof}{{Proof}{1}{}}{9}{proof.1}% \contentsline {theorem}{{Theorem}{6.{1}}{}}{13}{theorem.6.2.1}% \contentsline {proof}{{Proof}{2}{}}{13}{proof.2}% \contentsline {theorem}{{Theorem}{6.{2}}{}}{14}{theorem.6.2.2}% \contentsline {proof}{{Proof}{3}{}}{15}{proof.3}%
 ... ... @@ -4,17 +4,19 @@ \contentsline {chapter}{\chapternumberline {1}Introduction}{1}{chapter.1}% \contentsline {chapter}{\chapternumberline {2}Related Work}{3}{chapter.2}% \contentsline {chapter}{\chapternumberline {3}Problem Statement}{5}{chapter.3}% \contentsline {chapter}{\chapternumberline {4}Computational Hardness}{7}{chapter.4}% \contentsline {section}{\numberline {4.1}The decision version of pixel farming}{7}{section.4.1}% \contentsline {section}{\numberline {4.2}Pixel Farming is in NP}{7}{section.4.2}% \contentsline {section}{\numberline {4.3}Pixel Farming finds Hamiltonian Paths}{8}{section.4.3}% \contentsline {paragraph}{Hamiltonian Paths}{8}{section*.2}% \contentsline {paragraph}{Reduction}{8}{section*.3}% \contentsline {chapter}{\chapternumberline {5}Helpful Statements}{11}{chapter.5}% \contentsline {section}{\numberline {5.1}Growing solutions}{11}{section.5.1}% \contentsline {section}{\numberline {5.2}Creating integer solutions from fractional solutions}{11}{section.5.2}% \contentsline {chapter}{\chapternumberline {6}The Linear Programming Method}{13}{chapter.6}% \contentsline {chapter}{\chapternumberline {7}Gradient Descent}{15}{chapter.7}% \contentsline {chapter}{\chapternumberline {8}Conclusion}{17}{chapter.8}% \contentsline {appendix}{\chapternumberline {A}Calculations Appendix}{19}{appendix.A}% \contentsline {chapter}{Bibliography}{21}{appendix*.4}% \contentsline {chapter}{\chapternumberline {4}Benchmark Problems}{7}{chapter.4}% \contentsline {chapter}{\chapternumberline {5}Computational Hardness}{9}{chapter.5}% \contentsline {section}{\numberline {5.1}The decision version of pixel farming}{9}{section.5.1}% \contentsline {section}{\numberline {5.2}Pixel Farming is NP complete}{9}{section.5.2}% \contentsline {paragraph}{Hamiltonian Paths}{10}{section*.2}% \contentsline {paragraph}{Reduction}{10}{section*.3}% \contentsline {chapter}{\chapternumberline {6}Helpful Statements}{13}{chapter.6}% \contentsline {section}{\numberline {6.1}Growing solutions}{13}{section.6.1}% \contentsline {section}{\numberline {6.2}Creating integer solutions from fractional solutions}{13}{section.6.2}% \contentsline {subsection}{\numberline {6.2.1}The standard method}{13}{subsection.6.2.1}% \contentsline {subsection}{\numberline {6.2.2}The advanced method}{14}{subsection.6.2.2}% \contentsline {chapter}{\chapternumberline {7}The Linear Programming Method}{17}{chapter.7}% \contentsline {chapter}{\chapternumberline {8}Gradient Descent}{19}{chapter.8}% \contentsline {chapter}{\chapternumberline {9}Conclusion}{21}{chapter.9}% \contentsline {appendix}{\chapternumberline {A}Calculations Appendix}{23}{appendix.A}% \contentsline {chapter}{Bibliography}{25}{appendix*.4}%
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!