emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Bug: can not evaluate any code blocks after enabling additional


From: Rainer M Krug
Subject: Re: [O] Bug: can not evaluate any code blocks after enabling additional languages [8.3.4 (release_8.3.4-639-gd5a603 @ /Users/rainerkrug/.emacs.d/elpa/25.0/org-20151005/)]
Date: Thu, 10 Mar 2016 21:55:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin)

Kyle Meyer <address@hidden> writes:

> Rainer M Krug <address@hidden> writes:
>
>> Nicolas Goaziou <address@hidden> writes:
>>
>>> Hello,
>>>
>>> Rainer M Krug <address@hidden> writes:
>>>
>>>> Debugger entered--Lisp error: (void-function org-babel-get-header)
>>>
>>> This looks like a mixed installation. This function was removed in
>>> development version and code base doesn't use it anymore.
>>
>> I don't think so - I use org from git uncompiled and, as you can see int
>> the init.el, initialize it (require 'org) before calling 
>> (package-initialize).
>>
>> For some unknown reasons, the function
>> org-babel-execute-src-block(nil) (in the org-git directory) calls
>> org-babel-execute:sh in the installation directory of emacs.
>>
>> So wy is this the case? I see that the file ob.sh.el seems to be renamed
>> in ob-shell.el - is this the case? Do I have to change the language sh
>> to shell?
>
> This has been reported on the list a few times.  See
> http://thread.gmane.org/gmane.emacs.orgmode/102877/focus=102882.

OK - thanks. This is solved now. But now I am stuck with the following,
where again, org-element-cache-reset is in the emacs packed org-mode,
while orgmode() is in the git version, and the changed org-set-local()
causes an error. Any suggestions?

,----
| Debugger entered--Lisp error: (void-function org-set-local)
|   org-set-local(org-element--cache [cl-struct-avl-tree- [nil nil nil 0] 
org-element--cache-compare])
|   org-element-cache-reset()
|   (let ((delay-mode-hooks t)) (outline-mode) (setq major-mode (quote 
org-mode)) (setq mode-name "Org") (progn (if (get (quote outline-mode) (quote 
mode-class)) (put (quote org-mode) (quote mode-class) (get (quote outline-mode) 
(quote mode-class)))) (if (keymap-parent org-mode-map) nil (set-keymap-parent 
org-mode-map (current-local-map))) (let ((parent (char-table-parent 
org-mode-syntax-table))) (if (and parent (not (eq parent 
(standard-syntax-table)))) nil (set-char-table-parent org-mode-syntax-table 
(syntax-table)))) (if (or (abbrev-table-get org-mode-abbrev-table :parents) (eq 
org-mode-abbrev-table local-abbrev-table)) nil (abbrev-table-put 
org-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map 
org-mode-map) (set-syntax-table org-mode-syntax-table) (setq local-abbrev-table 
org-mode-abbrev-table) (if (featurep (quote xemacs)) (if (boundp (quote 
outline-mode-menu-heading)) (progn (easy-menu-remove outline-mode-menu-heading) 
(easy-menu-remove outline-mode-menu-show) (easy-menu-remove 
outline-mode-menu-hide))) (define-key org-mode-map [menu-bar headings] (quote 
undefined)) (define-key org-mode-map [menu-bar hide] (quote undefined)) 
(define-key org-mode-map [menu-bar show] (quote undefined))) 
(org-load-modules-maybe) (if (featurep (quote xemacs)) (progn (easy-menu-add 
org-org-menu) (easy-menu-add org-tbl-menu))) (org-install-agenda-files-menu) 
(if org-descriptive-links (progn (add-to-invisibility-spec (quote 
(org-link))))) (add-to-invisibility-spec (quote (org-cwidth))) 
(add-to-invisibility-spec (quote (org-hide-block . t))) (if (featurep (quote 
xemacs)) (progn (set (make-local-variable (quote line-move-ignore-invisible)) 
t))) (set (make-local-variable (quote outline-regexp)) org-outline-regexp) (set 
(make-local-variable (quote outline-level)) (quote org-outline-level)) (setq 
bidi-paragraph-direction (quote left-to-right)) (if (and org-ellipsis (fboundp 
(quote set-display-table-slot)) (boundp (quote buffer-display-table)) (fboundp 
(quote make-glyph-code))) (progn (if org-display-table nil (setq 
org-display-table (make-display-table))) (set-display-table-slot 
org-display-table 4 (vconcat (mapcar (function (lambda ... ...)) (if (stringp 
org-ellipsis) org-ellipsis "...")))) (setq buffer-display-table 
org-display-table))) (org-set-regexps-and-options) (org-set-font-lock-defaults) 
(if (and org-tag-faces (not org-tags-special-faces-re)) (progn 
(org-set-tag-faces (quote org-tag-faces) org-tag-faces))) (set 
(make-local-variable (quote calc-embedded-open-mode)) "# ") 
(modify-syntax-entry 64 "w") (modify-syntax-entry 34 "\"") (modify-syntax-entry 
92 "_") (modify-syntax-entry 126 "_") (set (make-local-variable (quote 
font-lock-unfontify-region-function)) (quote org-unfontify-region)) (set 
(make-local-variable (quote org-table-may-need-update)) t) (org-add-hook (quote 
before-change-functions) (quote org-before-change-function) nil (quote local)) 
(org-add-hook (quote kill-buffer-hook) (quote org-check-running-clock) nil 
(quote local)) (org-macro-initialize-templates) 
(org-update-radio-target-regexp) (set (make-local-variable (quote 
indent-line-function)) (quote org-indent-line)) (set (make-local-variable 
(quote indent-region-function)) (quote org-indent-region)) (org-setup-filling) 
(org-setup-comments-handling) (org-element-cache-reset) (set 
(make-local-variable (quote beginning-of-defun-function)) (quote 
org-backward-element)) (set (make-local-variable (quote end-of-defun-function)) 
(function (lambda nil (if (not (org-at-heading-p)) (org-forward-element) 
(org-forward-element) (forward-char -1))))) (set (make-local-variable (quote 
next-error-function)) (quote org-occur-next-match)) (if 
org-enforce-todo-dependencies (add-hook (quote org-blocker-hook) (quote 
org-block-todo-from-children-or-siblings-or-parent)) (remove-hook (quote 
org-blocker-hook) (quote org-block-todo-from-children-or-siblings-or-parent))) 
(if org-enforce-todo-checkbox-dependencies (add-hook (quote org-blocker-hook) 
(quote org-block-todo-from-checkboxes)) (remove-hook (quote org-blocker-hook) 
(quote org-block-todo-from-checkboxes))) (set (make-local-variable (quote 
align-mode-rules-list)) (quote ((org-in-buffer-settings (regexp . "^[  
]*#\\+[A-Z_]+:\\(\\s-*\\)\\S-+") (modes quote (org-mode)))))) (set 
(make-local-variable (quote imenu-create-index-function)) (quote 
org-imenu-get-tree)) (set (make-local-variable (quote 
outline-isearch-open-invisible-function)) (function (lambda (&rest _) 
(org-show-context (quote isearch))))) (set (make-local-variable (quote 
pcomplete-command-completion-function)) (quote org-pcomplete-initial)) (set 
(make-local-variable (quote pcomplete-command-name-function)) (quote 
org-command-at-point)) ...)
|   (progn (make-local-variable (quote delay-mode-hooks)) (let 
((delay-mode-hooks t)) (outline-mode) (setq major-mode (quote org-mode)) (setq 
mode-name "Org") (progn (if (get (quote outline-mode) (quote mode-class)) (put 
(quote org-mode) (quote mode-class) (get (quote outline-mode) (quote 
mode-class)))) (if (keymap-parent org-mode-map) nil (set-keymap-parent 
org-mode-map (current-local-map))) (let ((parent (char-table-parent 
org-mode-syntax-table))) (if (and parent (not (eq parent ...))) nil 
(set-char-table-parent org-mode-syntax-table (syntax-table)))) (if (or 
(abbrev-table-get org-mode-abbrev-table :parents) (eq org-mode-abbrev-table 
local-abbrev-table)) nil (abbrev-table-put org-mode-abbrev-table :parents (list 
local-abbrev-table)))) (use-local-map org-mode-map) (set-syntax-table 
org-mode-syntax-table) (setq local-abbrev-table org-mode-abbrev-table) (if 
(featurep (quote xemacs)) (if (boundp (quote outline-mode-menu-heading)) (progn 
(easy-menu-remove outline-mode-menu-heading) (easy-menu-remove 
outline-mode-menu-show) (easy-menu-remove outline-mode-menu-hide))) (define-key 
org-mode-map [menu-bar headings] (quote undefined)) (define-key org-mode-map 
[menu-bar hide] (quote undefined)) (define-key org-mode-map [menu-bar show] 
(quote undefined))) (org-load-modules-maybe) (if (featurep (quote xemacs)) 
(progn (easy-menu-add org-org-menu) (easy-menu-add org-tbl-menu))) 
(org-install-agenda-files-menu) (if org-descriptive-links (progn 
(add-to-invisibility-spec (quote (org-link))))) (add-to-invisibility-spec 
(quote (org-cwidth))) (add-to-invisibility-spec (quote (org-hide-block . t))) 
(if (featurep (quote xemacs)) (progn (set (make-local-variable (quote 
line-move-ignore-invisible)) t))) (set (make-local-variable (quote 
outline-regexp)) org-outline-regexp) (set (make-local-variable (quote 
outline-level)) (quote org-outline-level)) (setq bidi-paragraph-direction 
(quote left-to-right)) (if (and org-ellipsis (fboundp (quote 
set-display-table-slot)) (boundp (quote buffer-display-table)) (fboundp (quote 
make-glyph-code))) (progn (if org-display-table nil (setq org-display-table 
(make-display-table))) (set-display-table-slot org-display-table 4 (vconcat 
(mapcar (function ...) (if ... org-ellipsis "...")))) (setq 
buffer-display-table org-display-table))) (org-set-regexps-and-options) 
(org-set-font-lock-defaults) (if (and org-tag-faces (not 
org-tags-special-faces-re)) (progn (org-set-tag-faces (quote org-tag-faces) 
org-tag-faces))) (set (make-local-variable (quote calc-embedded-open-mode)) "# 
") (modify-syntax-entry 64 "w") (modify-syntax-entry 34 "\"") 
(modify-syntax-entry 92 "_") (modify-syntax-entry 126 "_") (set 
(make-local-variable (quote font-lock-unfontify-region-function)) (quote 
org-unfontify-region)) (set (make-local-variable (quote 
org-table-may-need-update)) t) (org-add-hook (quote before-change-functions) 
(quote org-before-change-function) nil (quote local)) (org-add-hook (quote 
kill-buffer-hook) (quote org-check-running-clock) nil (quote local)) 
(org-macro-initialize-templates) (org-update-radio-target-regexp) (set 
(make-local-variable (quote indent-line-function)) (quote org-indent-line)) 
(set (make-local-variable (quote indent-region-function)) (quote 
org-indent-region)) (org-setup-filling) (org-setup-comments-handling) 
(org-element-cache-reset) (set (make-local-variable (quote 
beginning-of-defun-function)) (quote org-backward-element)) (set 
(make-local-variable (quote end-of-defun-function)) (function (lambda nil (if 
(not (org-at-heading-p)) (org-forward-element) (org-forward-element) 
(forward-char -1))))) (set (make-local-variable (quote next-error-function)) 
(quote org-occur-next-match)) (if org-enforce-todo-dependencies (add-hook 
(quote org-blocker-hook) (quote 
org-block-todo-from-children-or-siblings-or-parent)) (remove-hook (quote 
org-blocker-hook) (quote org-block-todo-from-children-or-siblings-or-parent))) 
(if org-enforce-todo-checkbox-dependencies (add-hook (quote org-blocker-hook) 
(quote org-block-todo-from-checkboxes)) (remove-hook (quote org-blocker-hook) 
(quote org-block-todo-from-checkboxes))) (set (make-local-variable (quote 
align-mode-rules-list)) (quote ((org-in-buffer-settings (regexp . "^[        
]*#\\+[A-Z_]+:\\(\\s-*\\)\\S-+") (modes quote (org-mode)))))) (set 
(make-local-variable (quote imenu-create-index-function)) (quote 
org-imenu-get-tree)) (set (make-local-variable (quote 
outline-isearch-open-invisible-function)) (function (lambda (&rest _) 
(org-show-context (quote isearch))))) (set (make-local-variable (quote 
pcomplete-command-completion-function)) (quote org-pcomplete-initial)) (set 
(make-local-variable (quote pcomplete-command-name-function)) (quote 
org-command-at-point)) ...))
|   org-mode()
|   (let ((org-mode-hook nil) (org-inhibit-startup t)) (org-mode))
|   (let ((inhibit-modification-hooks t)) (let ((org-mode-hook nil) 
(org-inhibit-startup t)) (org-mode)) (set (make-local-variable (quote 
org-table-may-need-update)) (quote t)) (set (make-local-variable (quote 
org-latex-and-related-regexp)) (quote "")) (set (make-local-variable (quote 
org-todo-line-tags-regexp)) (quote "^\\(\\*+\\)\\(?: 
+\\(C\\(?:ANCELED\\|HECK\\|ODE\\)\\|DONE\\|EXECUTE\\|T\\(?:EXT\\|ODO\\)\\|WAIT\\)\\)?\\(?:
 +\\(.*?\\)\\)??\\(?:[     ]+\\(:[[:alnum:]:address@hidden:\\)\\)?[        
]*$")) (set (make-local-variable (quote org-complex-heading-regexp-format)) 
(quote "^\\(\\*+\\)\\(?: 
+\\(C\\(?:ANCELED\\|HECK\\|ODE\\)\\|DONE\\|EXECUTE\\|T\\(?:EXT\\|ODO\\)\\|WAIT\\)\\)?\\(?:
 +\\(\\[#.\\]\\)\\)?\\(?: +\\(?:\\[[0-9%%/]+\\] *\\)*\\(%s\\)\\(?: 
*\\[[0-9%%/]+\\]\\)*\\)\\(?:[         ]+\\(:[[:alnum:address@hidden:]+:\\)\\)?[ 
      ]*$")) (set (make-local-variable (quote org-complex-heading-regexp)) 
(quote "^\\(\\*+\\)\\(?: 
+\\(C\\(?:ANCELED\\|HECK\\|ODE\\)\\|DONE\\|EXECUTE\\|T\\(?:EXT\\|ODO\\)\\|WAIT\\)\\)?\\(?:
 +\\(\\[#.\\]\\)\\)?\\(?: +\\(.*?\\)\\)??\\(?:[         
]+\\(:[[:alnum:address@hidden:]+:\\)\\)?[       ]*$")) (set 
(make-local-variable (quote org-todo-line-regexp)) (quote "^\\(\\*+\\)\\(?: 
+\\(C\\(?:ANCELED\\|HECK\\|ODE\\)\\|DONE\\|EXECUTE\\|T\\(?:EXT\\|ODO\\)\\|WAIT\\)\\)?\\(?:
 +\\(.*?\\)\\)?[      ]*$")) (set (make-local-variable (quote 
org-not-done-heading-regexp)) (quote "^\\(\\*+\\)\\(?: 
+\\(C\\(?:HECK\\|ODE\\)\\|EXECUTE\\|T\\(?:EXT\\|ODO\\)\\|WAIT\\)\\)\\(?: 
+\\(.*?\\)\\)?[         ]*$")) (set (make-local-variable (quote 
org-not-done-regexp)) (quote 
"\\(C\\(?:HECK\\|ODE\\)\\|EXECUTE\\|T\\(?:EXT\\|ODO\\)\\|WAIT\\)")) (set 
(make-local-variable (quote org-todo-regexp)) (quote 
"\\(C\\(?:ANCELED\\|HECK\\|ODE\\)\\|DONE\\|EXECUTE\\|T\\(?:EXT\\|ODO\\)\\|WAIT\\)"))
 (set (make-local-variable (quote org-not-done-keywords)) (quote ("TODO" "WAIT" 
"CHECK" "EXECUTE" "CODE" "TEXT"))) (set (make-local-variable (quote 
org-todo-log-states)) (quote nil)) (set (make-local-variable (quote 
org-todo-sets)) (quote (("TODO" "WAIT" "CHECK" "EXECUTE" "CODE" "TEXT" "DONE" 
"CANCELED")))) (set (make-local-variable (quote org-todo-heads)) (quote 
("TODO"))) (set (make-local-variable (quote org-done-keywords)) (quote ("DONE" 
"CANCELED"))) (set (make-local-variable (quote org-todo-keywords-1)) (quote 
("TODO" "WAIT" "CHECK" "EXECUTE" "CODE" "TEXT" "DONE" "CANCELED"))) (set 
(make-local-variable (quote org-todo-key-trigger)) (quote (116 119 99 101 111 
121 100 120))) (set (make-local-variable (quote org-todo-key-alist)) (quote 
((:startgroup) ("TODO" . 116) ("WAIT" . 119) ("CHECK" . 99) ("EXECUTE" . 101) 
("CODE" . 111) ("TEXT" . 121) ("DONE" . 100) ("CANCELED" . 120) (:endgroup)))) 
(set (make-local-variable (quote org-todo-kwd-alist)) (quote (("TODO" sequence 
"TODO" "DONE" "CANCELED") ("WAIT" sequence "TODO" "DONE" "CANCELED") ("CHECK" 
sequence "TODO" "DONE" "CANCELED") ("EXECUTE" sequence "TODO" "DONE" 
"CANCELED") ("CODE" sequence "TODO" "DONE" "CANCELED") ("TEXT" sequence "TODO" 
"DONE" "CANCELED") ("DONE" sequence "TODO" "DONE" "CANCELED") ("CANCELED" 
sequence "TODO" "DONE" "CANCELED")))) (set (make-local-variable (quote 
org-hide-block-startup)) (quote t)) (set (make-local-variable (quote 
org-use-sub-superscripts)) (quote t)) (set (make-local-variable (quote 
org-table-formula-constants-local)) (quote nil)) (set (make-local-variable 
(quote org-file-properties)) (quote (("header-args:R" . ":session test 
:comments link") ("header-args" . ":tangle-mode (identity #o444) :tangle no 
:mkdirp yes :exports both :padline no :eval never-export :noweb yes")))) (set 
(make-local-variable (quote org-tag-alist)) (quote nil)) (set 
(make-local-variable (quote org-tag-groups-alist)) (quote nil)) (set 
(make-local-variable (quote org-file-tags)) (quote nil)) (set 
(make-local-variable (quote buffer-file-name)) (quote 
"/Users/rainerkrug/Documents/Projects/ASM_Optimization/asmOptim.org")) (set 
(make-local-variable (quote default-directory)) (quote 
"/Users/rainerkrug/Documents/Projects/ASM_Optimization/")) (set 
(make-local-variable (quote buffer-file-coding-system)) (quote utf-8-unix)) 
(insert "#+TITLE: Optimizing management actions for invasive alien plants under 
different budgetary scenarios\n#+AUTHOR: Rainer M. Krug, Núria Roura-Pascual & 
David M. Richardson\n#+EMAIL: 
address@hidden:\n#+KEYWORDS:\n\n:CONFIG:\n#+OPTIONS: ':nil *:t -:t ::t <:t H:3 
\\n:nil ^:t arch:headline\n#+OPTIONS: author:t c:nil creator:comment d:(not 
\"LOGBOOK\") date:t\n#+OPTIONS: e:t email:nil f:t inline:t num:t p:nil pri:nil 
prop:nil\n#+OPTIONS: stat:t tags:t tasks:t tex:t timestamp:t toc:t todo:t 
|:t\n#+LANGUAGE: en\n#+SELECT_TAGS: export\n#+EXCLUDE_TAGS: 
noexport\n#+CREATOR: Emacs 24.4.1 (Org mode 8.3beta)\n#+OPTIONS: 
H:6\n#+OPTIONS: toc:6\n#+STARTUP: hideblocks\n#+TODO: TODO(t) WAIT(w) CHECK(c) 
EXECUTE(e) CODE(o) TEXT(y) | DONE(d) 
CANCELED(x)\n:END:\n:LATEXHEADER:\n#+LaTeX_CLASS_OPTIONS: 
[a4paper,usenames,dvipsnames,table]\n\n#+LATEX_HEADER: 
\\lstset{%\n#+LATEX_HEADER:     basicstyle=\\ttfamily\\footnotesize,       % 
the font that is used for the code\n#+LATEX_HEADER:     tabsize=4,              
         % sets default tabsize to 4 spaces\n#+LATEX_HEADER:     numbers=left,  
                  % where to put the line numbers\n#+LATEX_HEADER:     
numberstyle=\\tiny,               % line number font size\n#+LATEX_HEADER:     
stepnumber=0,                    % step between two line 
numbers\n#+LATEX_HEADER:     breaklines=true,                 %!! don't break 
long lines of code\n#+LATEX_HEADER:     showtabs=false,                  % show 
tabs within strings adding particular underscores\n#+LATEX_HEADER:     
showspaces=false,                % show spaces adding particular 
underscores\n#+LATEX_HEADER:     showstringspaces=false,          % underline 
spaces within strings\n#+LATEX_HEADER:     
keywordstyle=\\color{blue},\n#+LATEX_HEADER:     
identifierstyle=\\color{black},\n#+LATEX_HEADER:     
stringstyle=\\color{ForestGreen},\n#+LATEX_HEADER:     
commentstyle=\\color{red},\n#+LATEX_HEADER:     
backgroundcolor=\\color{light-gray},   % sets the background 
color\n#+LATEX_HEADER:     columns=fullflexible,  \n#+LATEX_HEADER:     
basewidth={0.5em,0.4em}, \n#+LATEX_HEADER:     captionpos=b,                    
% sets the caption position to `bottom'\n#+LATEX_HEADER:     
extendedchars=false              %!?? workaround for when the listed file is in 
UTF-8\n#+LATEX_HEADER: }\n\n#+LATEX_HEADER: 
\\usepackage[round,semicolon,authoryear]{natbib}\n\n#+LATEX_CLASS_OPTIONS: 
[colorlinks=true]\n\n#+LATEX_HEADER: 
\\usepackage[section]{placeins}\n#+LATEX_HEADER: 
\\usepackage{subcaption}\n\n#+LATEX_HEADER: \\usepackage{bm}\n\n#+LATEX_HEADER: 
%% \\usepackage{showframe}\n#+LATEX_HEADER: 
\\usepackage{float}\n\n#+LaTeX_header: \\usepackage{amsmath}\n\n#+LaTeX_header: 
\\usepackage{todonotes}\n\n#+LaTeX_header: \\usepackage{soul}\n# See 
[[http://tex.stackexchange.com/a/139500/6941]] for why\n#+LaTeX_header: 
\\soulregister\\cite7\n#+LaTeX_header: \\soulregister\\citep7\n#+LaTeX_header: 
\\soulregister\\citet7\n#+LaTeX_header: 
\\soulregister\\emph7\n\n:END:\n:HTMLHEADER:\n#+SETUPFILE: 
/Users/rainerkrug/.emacs.d/org-html-themes/setup/theme-readtheorg.setup\n:END:\n:MATHMACROS:\n#+LATEX_HEADER:
 \\newcommand{\\cua}{\\mathit{a} (t)}\n#+LATEX_HEADER: 
\\newcommand{\\cov}{\\mathit{cov} (t)}\n#+LATEX_HEADER: 
\\newcommand{\\ac}{\\mathit{c} (t)}\n#+LATEX_HEADER: 
\\newcommand{\\bpc}{\\mathit{b}}\n#+LATEX_HEADER: 
\\newcommand{\\bpci}{\\mathit{b_{inv}}}\n\n#+LATEX_HEADER: 
\\newcommand{\\tmg}{\\mathit{t_{95}}}\n#+LATEX_HEADER: 
\\newcommand{\\bmg}{\\mathit{B_{95}}}\n\n#+LATEX_HEADER: 
\\newcommand{\\pmg}{\\mathit{p_{95}}}\n\n#+LATEX_HEADER: 
\\newcommand{\\bc}{\\mathit{\\hat{b}}}\n#+LATEX_HEADER: 
\\newcommand{\\bci}{\\mathit{\\hat{b}_{inv}}}\n\n#+LATEX_HEADER: 
\\newcommand{\\idb}{\\mathit{I^{b}_{95}}}\n#+LATEX_HEADER: 
\\newcommand{\\idt}{\\mathit{I^{t}_{95}}}\n\n:END:\n:MACROS:\n#+INCLUDE: 
~/.emacs.d/org-macros/org-macros.setup\n\n#+MACRO: us        (eval (if 
(org-export-derived-backend-p org-export-current-backend 'latex) 
\"\\\\textunderscore{}\" \"_\"             ))\n#+MACRO: clearpage (eval (if 
(org-export-derived-backend-p org-export-current-backend 'latex) 
\"\\\\clearpage\"        \"\"               ))\n#+MACRO: img       (eval (if 
(org-export-derived-backend-p org-export-current-backend 'latex) 
\"[[file:$1.pdf]]\"    \"[[file:$1.png]]\"))\n#+MACRO: sc        (eval (if 
(org-export-derived-backend-p org-export-current-backend 'latex) 
\"\\\\textsc{$1}\"    \"$1\"))\n\n#+MACRO: pandoc    (eval (if 
(org-export-derived-backend-p org-export-current-backend 'latex) 
\"@@latex:%forPandoc%$1@@\"   \"$1\"))\n:END:\n:BABEL:\n#+PROPERTY: header-args 
 :tangle-mode (identity #o444)\n#+PROPERTY: header-args+ :tangle 
no\n#+PROPERTY: header-args+ :mkdirp yes\n#+PROPERTY: header-args+ :exports 
both\n#+PROPERTY: header-args+ :padline no\n#+PROPERTY: header-args+ :eval 
never-export \n#+PROPERTY: header-args+ :noweb yes\n\n#+PROPERTY: header-args:R 
:session test\n#+PROPERTY: header-args:R+ :comments link\n\n#+Bind: 
org-babel-use-quick-and-dirty-noweb-expansion \"t\"\n:END:\n\n# #+LaTeX_header: 
\\usepackage[]{endfloat}\n\n* List Of Figures                                   
          :ignoreheading:\n{{{if-latex-else(\\\\listoffigures, \"\")}}}\n\n* 
List Of Tables                                              
:ignoreheading:\n{{{if-latex-else(\\\\listoftables, \"\")}}}\n* List Of TODOs   
                                            
:ignoreheading:\n{{{if-latex-else(\\\\listoftodos, \"\")}}}\n\n\n\n* Version 
src_sh{sed -n '/^Version: /s///p' ./DESCRIPTION}  \n:PROPERTIES:\n:header-args: 
:exports results\n:header-args+: :tangle no\n:END:\nVersion src_sh{sed -n 
'/^Version: /s///p' ./DESCRIPTION}\n\n* #### clearpage ####                     
                    :ignoreheading:\n{{{clearpage}}}\n\n\n\n* 
Abstract\n#+begin_abstract\nNeeds top be written\n#+end_abstract\n\n\n* TODO 
DESCRIPTION File                                            
:noexport:\n:PROPERTIES:\n:header-args: :comments no\n:header-args+: :padline 
no\n:header-args+: :no-expand TRUE\n:header-args+: :eval 
never\n:END:\n\n#+begin_src RDescr :tangle ./DESCRIPTION\nPackage: 
ASMOptim\nType: Paper\nTitle: Analysis transcripts and Paper Alanysis\nVersion: 
0.2.0.+\nAuthor: Rainer M. Krug\nMaintainer: Rainer M Krug 
<address@hidden>\nDepends: ASMOptimPackage (>= 0.2.0)\n#+end_src\n\n\n* TODO 
Setup .Rprofile file                                        :noexport:\nThis 
file will only be used when R is not started with --vanilla!!!!\n#+begin_src R 
:tangle 
./.Rprofile\n.libPaths(normalizePath(\"library\"))\nlibrary(devtools)\n# 
load_all(\"./package/asm\")\n#+end_src\n\n* Code Snippets for Analysis and 
Results                           :noexport:\n:PROPERTIES:\n:header-args+: 
:tangle no\n:header-args+: :eval never\n:END:\n** initR\nLoad lEnergyBalance 
and WindProfilePaper packages\n#+NAME: initR\n#+begin_src R\n\n##  
<initR>\nlibrary(devtools)\n## install_bitbucket(repo=\"rkrug/WindProfiles\", 
ref=\"v_0.7.0\", auth_user=\"rkrug\", 
password=\"\")\nload_all(\"./package/ASMOptimPaper/ASMOptimPaper.org/\")\n## 
gInit()\n##  </initR>\n\n#+end_src\n\n** getMapsetTypes\nThis is a template to 
be remembered and to be used as a base for getting the results types from a 
simulation.\n\n#+NAME: getMapsetTypes\n#+begin_src R \n    getMapNames(\n       
 site     = \"CapePeninsula\",\n        strategy = \"Consensus\",\n        
budget   = \"CapePeninsula_1_0\",\n        run      = 5,\n        type     = 
\"raster\",\n        pattern  = \"*\",\n        fullMapNames = FALSE\n    ) 
%>%\n        strsplit(split=\"_\") %>%\n        subset(sapply(., 
FUN=\"length\") == 2) %>%\n        sapply(FUN=\"[[\", 2) %>%\n        
unique()\n\n#+end_src\n* emails                                                 
          :noexport:\n[[notmuch:id:address@hidden from Núria Roura-Pascual: RE: 
Missing piece ...]]\n\n* Data preparation                                       
          :noexport:\n** Split complete data into different 
types\n:PROPERTIES:\n:heade-args: :eval never-export\n:END:\n- csv 
::\n#+begin_src sh :session data :results none\nmkdir ./inputdata/csv/  \nrsync 
-avz --include=\"*/\" --include=\"*.csv\" --exclude=\"*\" 
/Volumes/Seagate_1TB/HomeExternal/Documents/ASM_Optimization ./inputdata/csv/  
\nfind . -type f -name \"*.asc\" -exec gzip -v {} \\;\nrsync -avz 
--include=\"*/\" --include=\"*.csv\" --exclude=\"*\" 
address@hidden:~/clusterResults/clusterResults/simASM/RandomClearingPaper/results/simASMRightFire
 ./inputdata/csv/\n#+end_src\n\n- png ::\n#+begin_src sh :session data :results 
none\nmkdir ./inputdata/png//  \nrsync -avz --include=\"*/\" 
--include=\"*.png\" --exclude=\"*\" 
/Volumes/Seagate_1TB/HomeExternal/Documents/ASM_Optimization ./inputdata/png/  
\nrsync -avz --include=\"*/\" --include=\"*.png\" --exclude=\"*\" 
/Volumes/Home\\ on\\ 
Pogoplug/clusterResults/clusterResults/simASM/RandomClearingPaper/results/simASMRightFire/
 ./inputdata/csv/\nrsync -avz --include=\"*/\" --include=\"*.png\" 
--exclude=\"*\" 
address@hidden:~/clusterResults/clusterResults/simASM/RandomClearingPaper/results/simASMRightFire
 ./inputdata/png/\n#+end_src\n\n** Merge directory structure 
into\n./inputdata/csv/ASM_Otimization/Simulations/SITE/simASM/STRATEGY/BUDGET/FIRE/RUN\n\n*
 Bash scripts for data preparation and handling                   
:noexport:\n** tar2grass  - extract grass/simulation directories and create 
single grass location\n:PROPERTIES:\n:header-args:sh: :tangle 
./tar2grass\n:header-args:sh: :comments no\n:header-args:sh+: :tangle-mode 
(identity #o755)\n:END:\nThis script extracts the =grass/simulation= directory 
from a tar.gz\nfile of the simulation and moves it into the folder =./simASM= 
folder\nand renames it to the name of the =tar.gz= without the 
=.tar.gz=.\n\nAfter adding the \n#+begin_src sh \nTAR=\"$1\"\necho $TAR 
...\ntar -xvzf $TAR  --include='*/grass/simulation/*'\nmkdir -p simASM\ncd 
tmp\ncd $(ls)\nSIM=$(ls)\ncd $(ls)\ncd grass\nmv simulation $SIM\nmv $SIM 
./../../../../simASM/\ncd ./../../../../\nrm -rf ./tmp\n#+end_src\n\n** make 
the squashfs\n:PROPERTIES:\n:header-args:sh: :tangle 
./addPERMANENT\n:header-args:sh: :comments no\n:header-args:sh+: :tangle-mode 
(identity #o755)\n:END:\nCopies =PERMANENT= from =./inputdata/PERMANENT= into 
the location and\nadds the link to a mapset =./../grassAnalysis= which can be 
used for\nwrite access outside the mapset, i.e. the complete mapset can 
be\nconverted into a SquashFS and be mounted afterwards.\n\n#+begin_src sh \ncp 
-R ./inputdata/PERMANENT ./simASM/\nln ln -s ./../../grassAnalysis 
./simASM/grassAnalysis\n#+end_src\n\n#+begin_src sh  :tangle no\nmksquashfs 
./simASM ./simASM.squashfs -processors 6\n#+end_src\n\n** COMMENT tar2sqfs  - 
Prepare .tar.gz files and convert to SquashFS\n:PROPERTIES:\n:header-args:sh: 
:tangle ./tar2sqfs\n:header-args:sh+: :comments no\n:header-args:sh+: 
:tangle-mode (identity #o755)\n:END:\nThis script converts is converting tar.gz 
fines in tto .squashfs files\nin the current directory. It should be run in the 
./input directory.\n\n*** Extract .tar.gz simulation but exclude certain 
redundant files\n#+begin_src sh\nTAR=\"$1\"\ntar -xvzf $TAR  
--exclude='*/output/*' --exclude='input.tar.gz' 
--exclude='output.tar.gz'\n#+end_src\n\n*** Climb in dirrectory into single 
unique directory\n#+begin_src sh \ncd tmp\ncd `ls`\n#+end_src\n\n*** Replace 
link to =PERMANENT= with link to existing =PERMANENT= \n#+begin_src sh \nfind . 
-type \"link\" -name \"PERMANENT\" -exec ln -fhs ./../../PERMANENT {} 
\\;\n#+end_src\n\n*** Create squashfs in base folder and delete original 
folder\n#+begin_src sh \nNAME=$(ls)\nmksquashfs $NAME ./../../$NAME.squashfs -b 
1048576 -comp xz -Xdict-size 100%\ncd ./../../\nrm -rf 
./tmp\n#+end_src\n\n\n\n** COMMENT oneGrass\n:PROPERTIES:\n:header-args:sh: 
:tangle ./oneGRASS\n:header-args:sh+: :comments no\n:header-args:sh+: 
:tangle-mode (identity #o755)\n:END:\n#+begin_src sh 
\nDEST=./DEST$$\nGRASS=./GRASS$$/simASM\n\nfunction finish {\n    rm -rf 
\"$DEST\"\n    rm -rf \"$GRASS\"\n}\ntrap finish EXIT\n\nmkdir -p 
\"$GRASS\"\n\necho Copying ./inputdata/PERMANENT to $GRASS ...\ncp -R 
./inputdata/PERMANENT $GRASS/\nfor F in ./inputdata/simASM.*.squashfs; do \n    
BN=$(basename $F)\n    DN=$(dirname $F)\n    DIR=\"${BN%.*}\"\n    echo 
\"<<<<<\"\n    echo Extracting grass/simulation from $F to 
./$DEST/grass/simulation\n    unsquashfs -dest $DEST \"$F\" -e 
grass/simulation/*\n    echo Moving \"./$DEST/grass/simulation\" to 
\"$GRASS/simASM/grass/$DIR\"\n    mv \"./$DEST/grass/simulation\" \"$GRASS\"\n  
  mv \"$GRASS/simulation\" \"$GRASS/$DIR\"\n    echo Deleting \"$DEST\"\n    rm 
-rf \"$DEST\"\n    echo \">>>>>\"\ndone  \necho Create link $GRASS/analysis out 
of the squashfs for editable mapset\nln -s \"./../../grassAnalysis\" 
\"$GRASS/analysis\"\necho Making SquashFS ./input/simASM.grass.squashfs from 
$GRASS/simASM ...\nmksquashfs \"$GRASS\" ./input/simASM.grass.squashfs -b 
1048576 -comp xz -Xdict-size 100%\necho Done\n#+end_src\n\n** COMMENT 
mountSimASM - mount simASM.grass.squashfs to 
./inputdata/simASM\n:PROPERTIES:\n:header-args:sh: :tangle 
./mountSimASM\n:header-args:sh+: :comments no\n:header-args:sh+: :tangle-mode 
(identity #o755)\n:END:\n#+begin_src sh 
\nDIR=./inputdata/simASM\nSFS=./inputdata/simASM.grass.squashfs\nFN=./umountSimASM\necho
 \"#!/bin/sh\" > $FN\necho \"umount $DIR\" >> $FN\necho \"rm $DIR/NOT_MOUNTED\" 
>> $FN\necho \"rmdir $DIR\" >> $FN\necho \"rm $FN\" >> $FN\nchmod +x $FN\nmkdir 
-p \"$DIR\"\ntouch \"$DIR/NOT_MOUNTED\"\nsquashfuse \"$SFS\" 
\"$DIR\"\n#+end_src\n\n\n** COMMENT mountSims - mount all 
./input/simASM.*.squashfs \n:PROPERTIES:\n:header-args:sh: :tangle 
./mountsimASM\n:header-args:sh+: :comments no\n:header-args:sh+: :tangle-mode 
(identity #o755)\n:END:\n#+begin_src sh \nFN=./umountsimASM\necho \"#!/bin/sh\" 
> $FN\nchmod +x umountsimASM\nfor F in ./inputdata/simASM.*.squashfs; do \n    
BN=$(basename $F)\n    DN=$(dirname $F)\n    DIR=$DN/\"${BN%.*}\"\n    echo 
###\n    echo Mounting $F to $D\n    mkdir -p \"$DIR\"\n    squashfuse \"$F\" 
\"$DIR\" \n    echo \"umount $DIR; rmdir $DIR\" >> $FN\ndone  \necho \"rm 
./umountsimASM\" >> $FN\n#+end_src\n\n\n\n* Introduction                        
                             :noexport:\nInvasive alien plants pose a 
significant threat to the environment and society. They are known to cause 
significant changes in species, communities and ecosystems citep:Vila2011 and 
to be responsible for major economic losses citep:Pimentel2005. Economic 
expenses are in the form of losses to provisioning services, but more 
importantly in the form of management costs, including eradication, control, 
and monitoring citep:Vila2010. This is particularly certain for strongly 
dominating plant species, since eradication is not always an option and the 
maintenance and effectiveness of control measures are largely uncertain. 
Economics are known to play an important role in clearing operations 
citep:Higgins1997a,Marais2004a.\n \n[[comment:Needs to be reworded.][For 
example, cite:Odom2005 showed that investment in managing the Scotch broom 
(/Cytisus scoparius/) is economically justified and that higher budgets yield 
higher value for the society. citep:Cacho2008 used a decision model based on 
economic analysis to identify the most appropriate management goal 
(eradication, containment or no management). Both studies coincide in 
indicating that the major factor determining the management goal is the 
available budget, with higher budgets resulting in more eradication oriented 
goals.]]\n\nBesides the overreaching importance of budget, the effectivity of 
management actions is also constrained by the characteristics of species} and 
the environment citep:Cacho2008,Krug2010_rmk and the strategy adopted for 
clearing invasive alien plants ([[comment:Ref needed][REF]]). Investment needs 
to be adjusted to the particularities of each study site and maintained over 
time to maximize the efficiency of clearing programs citep:Krug2010_rmk. The 
maintenance of management measures over time is, however, not exempt of 
nuances.  [[comment:TAlk about the problems associated with clearing the same 
site over time][TALK ABOUTTHE PROBLEMS ASSOCIATED WITH CLEARING THE SAME SITE 
OVER TIME]] The selection of the optimal clearing strategy, based on the 
characteristics of the environment and the allocation of resources over time, 
is thus crucial to provide practical guidelines for use in fiscal and policy 
decisions of IAP management. \n\nThis study builds on our previous work that 
examined the impact of different budget scenarios on the effectivity of 
clearing actions on a selected prioritization strategy citep:Krug2010_rmk, but 
instead of focusing on a single prioritization strategy we also examine the 
effect of several prioritization strategies. In particular, we aim to identify 
the optimal combination of elements –budget and clearing strategy– that ensures 
the effective management of IAPs at regional scales, while taking into account 
the particularities of invasive species and the hosting environment.\n\nIn this 
study, we use the three sites in the South Africa’s Cape Floristic Region as a 
case study (Agulhas Plains, Cape Peninsula, Outeniqua, see ref:map-All), an 
area subject to extensive control operations to reduce the expansion of woody 
IAPs that threaten the persistence of its high biological diversity. \n\n** 
#### clearpage ####                                       
:ignoreheading:\n{{{clearpage}}}\n\n\n* Methods\n\n** Study sites\nThe 
simulations for this study are based on three study sites within South Africa’s 
Cape Floristic Region: Agulhas Plain, Cape Peninsula and Outeniqua (see Fig. 
ref:map-All and Table ref:tab-All for details). All three sites contain large 
areas that are formally protected. Whereas the Cape Peninsula and Outeniqua 
regions have large areas of natural or seminatural vegetation, the Agulhas 
Plains consists of a mosaic of agricultural landscapes and conservation areas. 
All sites are invaded by IAPs, albeit by different species and to different 
degrees (see ref:tab-All for details). The most important IAP groups in the 
study sites and in the CFR overall are major woody plants, particularly species 
of /Acacia/, /Hakea/ and /Pinus/ 
citep:Richardson1986_rmka,Richardson1992_rmk,Richardson1994_rmk,Wilgen1994_rmk,Richardson2008_rmk
 [[comment:Further References needed?]]). \n\nDifferent usage and management 
pattern as well as topography of the three sites result in different fire 
patterns, e.g. with respect to the average area burned per year and the average 
number of fires per year (see supplemental material from cite:Krug2010_rmk for 
details).\n\n#+CAPTION: Study label:map-All sites in South Africa's Cape 
Floristic Region\n[[file:map-All.png]]\n\n#+ATTR_LATEX: :caption 
\\caption{Details \\label{tab-All} the study sites used in this study. $\\bpc$ 
is the budget per year per cell, $\\bpci$ is the budget per year per invaded 
cell (1ha = 1cell).} \\todo[inline]{Units in headers only or in table 
itself?}\n|                | Area    | Area invaded       | Budget       |      
2007/2008 |                  |\n|                | in ha   | in ha              
| Overall in R | $\\bpc$ in R/ha | $\\bpci$ in  R/ha 
|\n|----------------+---------+--------------------+--------------+----------------+------------------|\n|
 Agulhas Plains | 215,982 | 142,672 ( 66.1 % ) | 3,691,728    |          17.09 
|            25.88 |\n| Cape Peninsula | 49,179  | 19,226  ( 39.1 % ) | 
6,675,539    |         135.74 |           347.21 |\n| Outeniqua      | 57,697  
| 57,454  ( 99.6 % ) | 1,937,220    |          33.58 |            33.72 |\n|    
            |         |                    |              |                |    
              
|\n|----------------+---------+--------------------+--------------+----------------+------------------|\n\n\n\n**
 Model description\nTo model the spread of species under different management 
strategies, we used the spatio-temporal explicit simulation model 
{{{sc(SpreadSim)}}} ( [[comment:This needs to be added][The source code is 
available at]]  [[comment:Merge all different into one - the only difference 
should be the prioritisation file!]]). In this section, we present a short 
overview of the model, a detailed description can be found in 
cite:Krug2010_rmk. \n\nThe purpose of the model is to simulate the spread of 
three IAPs groups, namely /Acacia/, /Hakea/ and /Pinus/ citep:Krug2010_rmk, by 
incorporating spatial population dynamics (seed production, seed dispersal, 
germination and establishment), fire dynamics and the clearing of IAPs based on 
a certain prioritization strategy, the costs of clearing actions and the budget 
available per year. The aim is to assess the effectiveness of different 
clearing strategies and budget scenarios over time. \n\nThe model 
{{{sc(SpreadSim)}}} was written in R citep:R2008_rmk, (with additional packages 
by 
cite:Pebesma2005_rmk,Petzoldt2007_rmk,Bivand2009_rmk,James2009_rmk,Keitt2009_rmk,Lewin-Koh2009_rmk,Urbanek_rmk)
 and uses GRASS citep:GRASS2007 for the storage of the spatial results and 
spatial calculations. It can be separated into five different modules, namely 
{{{sc(clearing)}}}, {{{sc(fire)}}}, {{{sc(seedProduction)}}}, 
{{{sc(seedDispersal)}}} and {{{sc(germEst)}}}, which are executed consecutively 
(see Figure ref:fig-Model for the flowchart of the model). Each module contains 
parameter controlling the stochastic spread and management of IAPs of the 
genera /Acacia/, /Hakea/ and /Pinus/ citep:Krug2010_rmk.  \n\nDue to the 
stochastic nature of the model, each *simulation* (defined by the =site=, 
prioritization =strategy= and =budget=) was repeated five times. For further 
analysis, we defined a *simulation set* as different =budget= scenarios for the 
same =site= and clearing =strategy=.\n\nThe input data for the simulations was 
provided by the relevant nature conservation agencies and Working for Water 
(see cite:Roura-Pascual2009_rmkb,Roura-Pascual2009_rmkc for details 
[[comment:REF for topography and natural vegetation data  needed? I don't think 
so, as referred to the papers)]]. \n\nSimulations were done on a raster with a 
resolution of $100m \\times 100m$ cells and with a time step of one year.  
\n\n#+ATTR_LATEX: :caption \\caption{\\label{fig-Model} from 
\\protect\\cite{Krug2010_rmk}} \\todo[inline]{If we need this here, I will redo 
it - just let me know.}\n{{{if-latex-else([[file:fig-Model.pdf]], 
[[file:fig-Model.png]])}}}\n\n\n** Prioritization =strategy=\n\nThe 
prioritization =strategy= assigns each individual cell a priority value for 
clearing of the IAPs out of these cells. Subsequently, cells are cleared in 
descending order of their priority until the budget is spend (see 
cite:Krug2010_rmk). \n\nThe strategies are based on weights and consider the 
following factors:\n\n- Area burnt recently\n- Density of IAPs\n- Spread based 
on topography\n- Area at fire risk\n- Age of IAPs\n- Identity of IAPs\n- Last 
clearing operation\n\nFor a detailed description of these factors and how they 
were derived, see citep:Roura-Pascual2009_rmkb,Roura-Pascual2009_rmkc. \n\nThe 
prioritization strategies evaluated in this study are (Fig. 
ref:fig-Strategies):\n\n- =consensus= :: this strategy was developed through a 
participatory process with managers and researchers experts on various aspects 
of IAPs citep:Roura-Pascual2009_rmkb. This resulted in priority was given to 
areas burnt recently and the density of the IAPs was reduced 
citep:Roura-Pascual2009_rmkc. The following =strategies= are based on the 
=consensus strategy= and were modified based on certain aims.\n- =maintain 
follow-ups= :: (aka =past=) aims at prioritizing areas based on previous 
clearing operations, i.e. giving higher priority to areas which have been 
cleared already or in follow-ups. It relies on accurate information of fire and 
clearing history of the site citep:Roura-Pascual2009_rmkc;\n- =keep clean= :: 
(aka =present=) is a strategy where management operations do not rely on fire 
opportunities to clear invaded stands and the potential of a stand to be a 
major source of invasion is minimized. It relies on accurate information of the 
present, i.e. present density of the IAPs and spread potential based on 
topography citep:Roura-Pascual2009_rmkc;\n- =water production= :: (aka 
=future=)is orientated towards increasing water production in the future, with 
higher priority given to riparian areas in lower parts of the catchment invaded 
by dense stands of /Acacia/ species. It uses mainly static information, i.e. 
spread based on topography citep:Roura-Pascual2009_rmkc;\n- =random= :: is a 
null-strategy which does not require any knowledge about the past and randomly 
assigns priorities citep:Krug2010_rmk.\n\nA visualization of these 
prioritization strategies can be seen in Fig. 
ref:fig-Strategies.\n\n#+ATTR_LATEX: :caption \\caption{\\label{fig-Strategies} 
from \\protect\\cite{Roura-Pascual2009_rmkc}} \\todo[inline]{This figure needs 
to be redone and further info 
added}\n{{{if-latex-else([[file:fig-Strategies.pdf]], 
[[file:fig-Strategies.png]])}}}\n\n** Budget\nThe budget as well as the costs 
used in this study are based on the actual budget for the three areas of the 
financial year 2007/2008. They are specified in South African Rand (R) as 
$\\boldmath\\bpc$ (IAP clearing budget per year per cell) and  
$\\boldmath\\bpci$ (IAP clearing budget per year per invaded cell).\n\nThe 
actual budgets were multiplied with a factor ranging from 0.1 to 6.0 to obtain 
14 to 15 different budget scenarios for each simulation set defined by a =site= 
and a =strategy= (see Figure ref:fig-Budgets and Table ref:tab-Budgets in the 
Appendix for values from cite:Krug2010_rmk).\n\nThe budgets and the factors 
used for the three sites are[[comment:We could leave the factors out here but I 
think it is a useful addition. All information also also in the table in the 
Appendix]]:\n\n|                   budget | Agulhas   | CapePeninsula | 
Outeniqua |\n|                   factor |           |               |           
|\n|--------------------------+-----------+---------------+-----------|\n| 
$\\bpc$  $\\frac{R}{cell}$ | 17.09     | 135.05        | 33.58     |\n|         
         $\\bpci$ | 25.88     | 347.21        | 33.72     
|\n|--------------------------+-----------+---------------+-----------|\n|      
                0.1 | C M K W - | C M K W R     | C M K W R |\n|                
      0.2 |           | - - - - R     | - - - - R |\n|                      0.3 
|           | - - - - R     | - - - - R |\n|                      0.4 |         
  | - - - - R     | - - - - R |\n|                      0.5 | - - - - R | C M K 
W R     | C M K W R |\n|                      0.6 |           | - - - - R     | 
- - - - R |\n|                      0.7 |           | C M K W R     | - - - - R 
|\n|                      0.8 |           | - - - - R     | - - - - R |\n|      
                0.9 |           | - - - - R     | - - - - R |\n|                
       1. | - - - - R | C M K W R     | - - - - R |\n|                      1.1 
|           |               |           |\n|                      1.2 | - - - - 
R |               |           |\n|                      1.3 |           | - - - 
- R     | C M K W R |\n|                      1.4 |           |               | 
          |\n|                      1.5 | - - - - R | C M K W R     | C M K W R 
|\n|                      1.6 |           |               |           |\n|      
                1.7 | - - - - R | - - - - R     |           |\n|                
      1.8 |           |               |           |\n|                      1.9 
|           |               |           |\n|                       2. | - - - - 
R | - - - - R     | C M K W R |\n|                      2.2 | - - - - R |       
        |           |\n|                      2.5 | C M K W R |               | 
          |\n|                       3. | - - - - R |               |           
|\n|                      3.5 | - - - - R |               |           |\n|      
                 4. | - - - - R |               |           |\n|                
      4.5 | - - - - R |               |           |\n|                       5. 
| C M K W R |               |           |\n|                      5.5 | C M K W 
R |               |           |\n|                       6. | C M K W R |       
        |           |\n\n\n- Agulhas Plains :: $\\bpc =$ 17.09 R/cell, $\\bpci 
=$ 25.88 R/cell\n  - Consensus, Maintain Follow Ups, Keep clean, Water 
production :: 0.1; 2.5; 5.0; 5.5; 6.0\n  - Random :: 0.5; 1.0; 1.2; 1.5; 1.7; 
2.0; 2.2; 2.5; 3.0; 3.5; 4.0; 4.5; 5.0; 5.5; 6.0; 6.5; 7.0\n- CapePeninsula :: 
$\\bpc =$ 135.047 R/cell, $\\bpci =$ 347.21R/cell\n  - Consensus, Maintain 
Follow Ups, Keep clean, Water production :: 0.1; 0.5; 0.7; 1.0; 1.5\n  - Random 
:: 0.1; 0.2; 0.3; 0.4; 0.5; 0.6; 0.7; 0.8; 0.9; 1.0; 1.3; 1.5; 1.7; 2.0\n- 
Outeniqua :: $\\bpc =$ 33.58R/cell, $\\bpci =$ 33.72R/cell\n  - Consensus, 
Maintain Follow Ups, Keep clean, Water production :: 0.1; 0.5; 1.3; 1.5; 2.0\n  
- Random :: 0.1; 0.2; 0.3; 0.4; 0.5; 0.6; 0.7; 0.8; 0.9; 1.0; 1.3; 1.5; 1.7; 
2.0\n\n#+CAPTION: Different label:fig-Budgets budgets of the different sites in 
comparison. Colours indicate different sites, pattern indicate if the budget is 
\"per all cells\" or \"per invaded 
cells\"\n{{{if-latex-else([[file:fig-Budgets.pdf]], 
[[file:fig-Budgets.png]])}}}\n\n** TODO Analysis\nThe analysis follows the 
analysis done in cite:Krug2010_rmk and uses very similar measures and 
indicators to assess the efficiency of the different strategies. We therefore 
calculated for each individual =simulation= run (i.e. five per 
=simulation=)\n\n# - $\\cua$ :: number of cells covered by IAPs per year, where 
*covered* is defined as $dc \\leq 1$ i.e. *rare* or less\n- $\\cov$ :: as the 
proportion of the cells covered by aliens in year $t$\n     (i.e. all cells for 
which the density class of aliens is higher\n     than *rare*). $\\cov = 0$ 
indicates no alien infestation and $\\cov\n     = 1$ indicates complete cover 
of IAPs. (From cite:Krug2010_rmk) \n# - $\\ac$ :: number of cells cleared of 
IAPs in year $t$\n\nTo assess the effectiveness of the =simulation= run, we 
defined a\n- management goal :: as to be having 95% of the area (cells) alien 
free (density class of aliens smaller or equal *rare*), i.e. $\\cov \\leq 
0.95$\nwhere each individual simulation run is regarded as successful after 
reaching the *management goal*.\n\nIf the *management goal* was reached, we 
calculated for each =simulation= run\n- $\\tmg$ :: as the time when we reached 
the management goal\n- $\\bmg$ :: as the cumulative budget needed to achieve 
the management goal\n\nFor each =simulation= (i.e. over the five simulation 
runs) we then calculated\n+ $\\pmg$ :: proportions of all the runs (here five 
simulation runs) in one =simulation= which reached the *management goal*\n\nTo 
accumulate over each =simulation set=, i.e. one =site= and one =strategy= and 
multiple =budget=s, we calculated\n- $\\bc$ :: the *critical budget* is the 
lowest budget at which more than 50% of all simulations resulted in achieving 
the *management goal* of 95% alien free within the time-frame of 30 years,\n- 
$\\bci$ :: as $\\bc$ but the using $\\bpci$ instead of $\\bpc$\n\n# Finally, we 
calculated for each set of =site= and =strategy= a\n# - budget index :: 
$\\bm{\\idb} = \\frac{\\bpc}{\\bc}$\n# - time index :: $\\bm{\\idt} = 
\\frac{\\tmg(\\bc)-1}{\\mathit{mean}\\left(\\tmg(\\bc)-1\\right)}$ [[comment:I 
have to confess I am not sure what I did here!]]\n\n# The variables used to 
evaluate the efficiency of the clearing operations under different 
prioritization strategies and budgetary scenarios were: area covered by IAPs 
per year, IAP clearing budget per year, and area cleared of IAPs per year. The 
proportion of the site covered by aliens in year t, i.e. all cells for which 
the density class of aliens is higher than ‘‘rare’’, is called cov(t). cov(t) = 
0 indicates no alien infestation and cov(t) = 1 indicates complete cover of 
IAPs.\n\n# We set our ‘‘management goal’’ arbitrarily at clearing 95% (and for 
some scenarios 90%) of the area of IAPs. This ‘‘management goal’’ represents 
the threshold cover, below which the management is considered as being 
successful. An eradication of all IAPs would be ideal, but would require much 
higher resources.\n \n# If during the simulation the cover of IAPs was reduced 
below the ‘‘management goal’’, we determined the year in which it occurred 
(tnf95) and the cumulative costs per cell up to tnf95 (BPC 95). Note that BPC 
95 <= bPC·tnf95 as the whole budget might not be spent. The lowest budget at 
which more than 50% of all simulations resulted in a reduction of the alien 
cover to less than 5% within the time-frame of 30 years, was called the 
‘‘critical budget’’ (bPC relating to bPC and bPCINV relating to bPCINV). Each 
budget scenario was simulated five times.\n\n# In addition, we calculated a 
budget index and a time index for each species separately. The budget index was 
calculated by dividing the actual budget bPC by the critical budget ^ bPC. 
Consequently, the budget index was one for the critical budget. The time index 
was calculated as follow:\n\n# ??ADD FORMULA??\n\n# By subtracting one from 
tnf95 we achieved that the lowest value of the index is zero, while 1 
represents the average tnf95ð ^ bPCÞ.\n\n** #### clearpage ####                 
                      :ignoreheading:\n{{{clearpage}}}\n\n\n\n\n#  LocalWords:  
IAPs\n\n* TODO [2/6] Make Analysis and Graphs                              
:noexport:\n:PROPERTIES:\n:COOKIE_DATA: todo recursive\n:header-args+: :eval 
no-export\n:END:\n** DONE Budget graph fig-budgets\n\n\n#+NAME: tabBudgets\n| 
budget | Agulhas |            | CapePeninsula |            | Outeniqua |        
    |\n| factor |  R/Cell | R/Cell_inv |        R/Cell | R/Cell_inv |    R/Cell 
| R/Cell_inv 
|\n|--------+---------+------------+---------------+------------+-----------+------------|\n|
    0.1 |   1.709 |      2.588 |        13.504 |     34.721 |     3.358 |      
3.372 |\n|    0.2 |         |            |        27.008 |     69.442 |     
6.716 |      6.744 |\n|    0.3 |         |            |        40.512 |    
104.163 |    10.074 |     10.116 |\n|    0.4 |         |            |        
54.016 |    138.884 |    13.432 |     13.488 |\n|    0.5 |         |            
|         67.52 |    173.605 |     16.79 |      16.86 |\n|    0.6 |         |   
         |        81.024 |    208.326 |    20.148 |     20.232 |\n|    0.7 |    
     |            |        94.528 |    243.047 |    23.506 |     23.604 |\n|    
0.8 |         |            |       108.032 |    277.768 |    26.864 |     
26.976 |\n|    0.9 |         |            |       121.536 |    312.489 |    
30.222 |     30.348 |\n|     1. |   17.09 |      25.88 |        135.04 |     
347.21 |     33.58 |      33.72 |\n|    1.1 |         |            |            
   |            |           |            |\n|    1.2 |  20.508 |     31.056 |   
            |            |           |            |\n|    1.3 |         |       
     |       175.552 |    451.373 |    43.654 |     43.836 |\n|    1.4 |        
 |            |               |            |           |            |\n|    1.5 
|  25.635 |      38.82 |        202.56 |    520.815 |     50.37 |      50.58 
|\n|    1.6 |         |            |               |            |           |   
         |\n|    1.7 |  29.053 |     43.996 |       229.568 |    590.257 |    
57.086 |     57.324 |\n|    1.8 |         |            |               |        
    |           |            |\n|    1.9 |         |            |               
|            |           |            |\n|     2. |   34.18 |      51.76 |      
  270.08 |     694.42 |     67.16 |      67.44 |\n|    2.2 |  37.598 |     
56.936 |               |            |           |            |\n|    2.5 |  
42.725 |       64.7 |               |            |           |            |\n|  
   3. |   51.27 |      77.64 |               |            |           |         
   |\n|    3.5 |  59.815 |      90.58 |               |            |           
|            |\n|     4. |   68.36 |     103.52 |               |            |  
         |            |\n|    4.5 |  76.905 |     116.46 |               |      
      |           |            |\n|     5. |   85.45 |      129.4 |             
  |            |           |            |\n|    5.5 |  93.995 |     142.34 |    
           |            |           |            |\n|     6. |  102.54 |     
155.28 |               |            |           |            |\n\n\n#+NAME: 
fig-Budgets\n#+begin_src R :var BUDGET=tabBudgets  :exports results :file-ext 
pdf :results graphics :width 7 :height 7\n<<initR>>\nlibrary(magrittr)\nx <- 
BUDGET\nx <- BUDGET %>%\n    extract(-(1:2),) %>%\n    set_names(\n        c(\n 
           \"f\",\n            \"Agulhas\", \"Agulhas_I\",\n            
\"CapePeninsula\", \"CapePeninsula_I\",\n            \"Outeniqua\", 
\"Outeniqua_I\"\n        )\n    )\n\n##\nfor (i in 1:length(x)) {\n    x[[i]] 
<-  as.numeric(x[[i]])\n}\n\n##\nx %<>%\n    extract(-1) %>%\n    unlist %>%\n  
  extract(!is.na(.)) %>%\n    sort(decreasing = TRUE)\n\n##\nAG_I <- x %>%\n    
names %>%\n    grep(\"Agulhas_I\", .)\nAG <- x %>%\n    names %>%\n    
grep(\"Agulhas[1-9]\", .)\n##\nCP_I <- x %>%\n    names %>%\n    
grep(\"CapePeninsula_I\", .)\nCP <- x %>%\n    names %>%\n    
grep(\"CapePeninsula[1-9]\", .)\n##\nOU_I <- x %>%\n    names %>%\n    
grep(\"Outeniqua_I\", .)\nOU <- x %>%\n    names %>%\n    
grep(\"Outeniqua[1-9]\", .)\n\n##\ncols <- rep(\"black\", 
length(x))\ncols[c(AG, AG_I)] <- \"green\"\ncols[c(CP, CP_I)] <- 
\"red\"\ncols[c(OU, OU_I)] <- \"blue\"\n\n##\ndens <- rep(-1, 
length(x))\ndens[c(AG_I, CP_I, OU_I)] <- 30\n\n##\npar(\n    mar = c(4.1, 0.3, 
0.1, 0.8)\n)\nbarplot(\n    x,\n    xlab = \"Budget per cell\",\n    xlim = 
c(0, 700),\n    names.arg = \"\",\n    horiz = TRUE,\n    col = cols,\n    
density = dens\n)\nsiteNames <- c(\"Agulhas Plains\", \"Cape Peninsula\", 
\"Outeniqua\")\nlegend(\n    x = \"topright\",\n    legend  = c( siteNames, 
\"\", \"per all cells\", \"per invaded cells\"),\n    fill    = c(\"green\", 
\"red\", \"blue\", NA, \"black\", \"black\"),\n    border  = c(\"black\", 
\"black\", \"black\", NA, \"black\", \"black\"),\n    density = c(-1, -1, -1, 
NA, -1, 30)\n)\n#+end_src\n\n#+RESULTS: 
fig-Budgets\n[[file:fig-Budgets.pdf]]\n\n\n** DONE Calculate dc\n#+begin_src R 
:results output :tangle 
./package/ASMOptimPaper/inst/scripts/analysis.calculate.dc.R :eval never 
\n<<initR>>\ndc <- getDc( new = TRUE, cores = 6 
)\n#+end_src\n\n#+RESULTS:\n#+begin_example\nLoading ASMOptimPaper\nLoading 
required package: sp\nLoading required package: raster\nLoading required 
package: rgrass7\nLoading required package: XML\nGRASS GIS interface loaded 
with GRASS version: (GRASS not running)\nLoading required package: 
magrittr\n\nAttaching package: ‘magrittr’\n\nThe following object is masked 
from ‘package:raster’:\n\n    extract\n\nLoading required package: 
parallel\ngisdbase    ./inputdata \nlocation    simASM \nmapset      
grassAnalysis \nrows        210 \ncolumns     790 \nnorth       6263000 \nsouth 
      6242000 \nwest        574000 \neast        653000 \nnsres       100 
\newres       100 \nprojection  +proj=utm +south +zone=34 +a=6378137 
+rf=298.257223563 +no_defs\n+towgs84=0.000,0.000,0.000 
+to_meter=1.0\n#+end_example\n\n** TODO Examples of some simulations            
                  :noexport:\n#+begin_src R \nua <- getUaWide(site = 
\"Agulhas\", strategy=\"Consensus\", species = \"all\")\n\ndcs <- split(\n    
dc, dc$run\n)\nmatplot(x = dc$year, dc[as.character(1:7)])\nua <- 
rowSums(dc[as.character(1:7)])\n\nplot(ua)\n\nua <- getUa(site = \"Agulhas\", 
budget=\"None\", species = \"all\", 
proportion=TRUE)\nplot(ua$cl)\nb\n#+end_src\n** CHECK Figures --- =simulation 
sets= by site\n:PROPERTIES:\n:header-args+: :epilogue rm(ST, 
SI)\n:END:\n\n:CODESNIPPETS:\n#+NAME: plotScenarios\n#+begin_src R :eval 
never\n<<initR>>\npar(\n    mfcol = c(length(STRATEGIES)-1, 1),\n    mar   = 
c(1.2, 4.1, 1.1, 0.1),\n    cex   = 0.7\n)\nfor (i in 1:(length(STRATEGIES)-1)) 
{\n    if (i == length(STRATEGIES)-1) {\n        par(\n            mar   = 
c(4.2, 4.1, 1.1, 0.1)\n        )        \n    }\n    plotScenario( site = SI, 
strategy = STRATEGIES[i])\n}\n#+end_src\n:END:\n\n#+NAME: 
fig-ScenAgulhas\n#+HEADER: :var SI=\"Agulhas\"\n#+begin_src R :exports results 
:file-ext pdf :results graphics :width 7 :height 
7\n<<plotScenarios>>\n#+end_src\n\n#+RESULTS: 
fig-ScenAgulhas\n[[file:fig-ScenAgulhas.pdf]]\n\n\n#+NAME: 
fig-ScenCapePeninsula\n#+HEADER: :var SI=\"CapePeninsula\"\n#+begin_src R 
:exports results :file-ext pdf :results graphics :width 7 :height 
7\n<<plotScenarios>>\n#+end_src\n\n#+RESULTS: 
fig-ScenCapePeninsula\n[[file:fig-ScenCapePeninsula.pdf]]\n\n\n#+NAME: 
fig-ScenOuteniqua\n#+HEADER: :var SI=\"Outeniqua\"\n#+begin_src R :exports 
results :file-ext pdf :results graphics :width 7 :height 
7\n<<plotScenarios>>\n#+end_src\n\n\n#+RESULTS: 
fig-ScenOuteniqua\n[[file:fig-ScenOuteniqua.pdf]]\n\n{{{clearpage}}}\n\n** 
CHECK Figures --- Proportion reaching Management Goal\n#+NAME: 
fig-CritBudProp\n#+begin_src R :exports results :file-ext pdf :results graphics 
:width 7 :height 7\n<<initR>>\npar(\n    mfcol = c(length(SITES), 1),\n    mar  
 = c(1.2, 4.1, 1.1, 0.1),\n    cex   = 0.7\n)\nfor (i in 1:length(SITES)) {\n   
 if (i == length(SITES)) {\n        par(\n            mar   = c(4.2, 4.1, 1.1, 
0.1)\n        )        \n    }\n    plotCritBud( \n        site = SITES[i],\n   
     ylab = \"Prop Man. Goal\",\n        dx = 0.6,\n        xlim = c(0, 150)\n  
  )\n}\n#+end_src\n\n#+RESULTS: 
fig-CritBudProp\n[[file:fig-CritBudProp.pdf]]\n\n** CHECK Plot of Critical 
Budgets[[ comment:Here is something not right and needs to be checked. It could 
be the functions?]] :noexport:\n#+NAME: fig-BcOverview\n#+begin_src R :exports 
results :file-ext pdf :results graphics :width 7 :height 4.5\n<<initR>>\ncb <- 
getCriticalBudget(species = \"all\")\n\n\nplot(\n    bc$budgetPerCell ~ 
bc$tmg.mean,\n    xlab = \"mean time until management goal is achieved at 
critical budget\",\n    ylab = \"critical budget ber cell\",\n    cex = 1,\n    
col = as.factor(bc$strategy),\n    pch = 
as.integer(as.factor(bc$site))\n)\n\nsite <- unique(bc$site)\nstrategy <- 
unique(bc$strategy)\nlegend(\n    \"bottomright\",\n    legend = c(\n        
site,\n        \"\",\n        strategy\n    ),\n    pch = c(\n        
as.integer(as.factor(site)),\n        1,\n        rep(15, length(strategy))\n   
 ),\n    col = c(\n        rep(\"black\", length(site)),\n        \"white\",\n  
      as.factor(strategy)\n    )\n)\n\npar(op)\n#+end_src\n\n#+RESULTS: 
fig-BcOverview\n[[file:fig-BcOverview.pdf]]\n\n* Results\n** =simulation sets= 
by Site\n\n#+CAPTION: Proportion label:fig-ScenAgulhas of cells under aliens 
for the different strategies at *Agulhas Plains*. Horizontal line at y = 0.05 
indicates the management 
target.\n{{{if-latex-else([[file:fig-ScenAgulhas.pdf]], 
[[file:fig-ScenAgulhas.png]])}}}\n\n#+CAPTION: Proportion 
label:fig-ScenCapePeninsula of cells under aliens for the different strategies 
at *Cape Peninsula*. Horizontal line at y = 0.05 indicates the management 
target.\n{{{if-latex-else([[file:fig-ScenCapePeninsula.pdf]], 
[[file:fig-ScenCapePeninsula.png]])}}}\n\n#+CAPTION: Proportion 
label:fig-ScenOuteniqua of cells under aliens for the different strategies at 
*Outeniqua*. Horizontal line at y = 0.05 indicates the management 
target.\n{{{if-latex-else([[file:fig-ScenOuteniqua.pdf]], 
[[file:fig-ScenOuteniqua.png]])}}}\n\n*** #### clearpage ####                   
                  :ignoreheading:\n{{{clearpage}}}\n\n** Proportion reaching 
Management Goal\n#+CAPTION: label:fig-CritBudProp  Proportion of five 
simulation runs which reached the Management Goal. Colors depict different 
sites. Horizontal line at y = 0.05 indicates the critical budget 
$\\bc$\n{{{if-latex-else([[file:fig-CritBudProp.pdf]], 
[[file:fig-CritBudProp.pdf]])}}}\n\n*** #### clearpage ####                     
                :ignoreheading:\n{{{clearpage}}}\n\n* Discussion\n- Based on 
Figure ref:fig-CritBudProp, it is clear that the choice of\n  strategy is 
heavily site dependent. E.g. for Cape Peninsula, it\n  really doesn't matter 
what strategy is used - just go in and clear\n  what you see. While in the case 
of Agulhas Plains and Outeniqua, there are\n  considerable differences with for 
Agulhas Plains =Future= and =Random=\n  being the worst, this is not true for 
Outeniqua, where =Future= and\n  =Consensus= is the worst.\n\n- No clear 
pattern which one is better - heavily site dependent\n\n- Random is not 
necessarily the worst - sometimes better than wrong choice\n\n- ???\n\n* 
Acknowledgements\n* References\nbibliographystyle:plainnat\n# <<bibliography 
link>>\nbibliography:asmOptim.bib\n\n \n* Appendix\n\\appendix\n* 
Simulations\nSimulations are differentiated by their =site=, =strategy= 
and\n=budget= (see Table ref:tab-simulations for the 
different\ncombinations).\n\n#+CAPTION: Parameter label:tab-simulations sets 
used forthe different simulations.\n| =site=        | =strategy= | =budget=   
|\n|---------------+------------+------------|\n|               | Consensus  | 
depends    |\n| Agulhas       | Future     | on         |\n| CapePeninsula | 
Past       | =site=     |\n| Outeniqua     | Present    | and        |\n|       
        | Random     | =strategy= |\n|               |            |            
|\n|---------------+------------+------------|\n\n* Budget\n#+CAPTION: 
label:tab-Budgets Different budget factors and their actual values per cell.\n| 
budget | Agulhas |            | CapePeninsula |            | Outeniqua |        
    |\n| factor |  R/Cell | R/Cell_inv |        R/Cell | R/Cell_inv |    R/Cell 
| R/Cell_inv 
|\n|--------+---------+------------+---------------+------------+-----------+------------|\n|
    0.1 |   1.709 |      2.588 |        13.504 |     34.721 |     3.358 |      
3.372 |\n|    0.2 |         |            |        27.008 |     69.442 |     
6.716 |      6.744 |\n|    0.3 |         |            |        40.512 |    
104.163 |    10.074 |     10.116 |\n|    0.4 |         |            |        
54.016 |    138.884 |    13.432 |     13.488 |\n|    0.5 |         |            
|         67.52 |    173.605 |     16.79 |      16.86 |\n|    0.6 |         |   
         |        81.024 |    208.326 |    20.148 |     20.232 |\n|    0.7 |    
     |            |        94.528 |    243.047 |    23.506 |     23.604 |\n|    
0.8 |         |            |       108.032 |    277.768 |    26.864 |     
26.976 |\n|    0.9 |         |            |       121.536 |    312.489 |    
30.222 |     30.348 |\n|     1. |   17.09 |      25.88 |        135.04 |     
347.21 |     33.58 |      33.72 |\n|    1.1 |         |            |            
   |            |           |            |\n|    1.2 |  20.508 |     31.056 |   
            |            |           |            |\n|    1.3 |         |       
     |       175.552 |    451.373 |    43.654 |     43.836 |\n|    1.4 |        
 |            |               |            |           |            |\n|    1.5 
|  25.635 |      38.82 |        202.56 |    520.815 |     50.37 |      50.58 
|\n|    1.6 |         |            |               |            |           |   
         |\n|    1.7 |  29.053 |     43.996 |       229.568 |    590.257 |    
57.086 |     57.324 |\n|    1.8 |         |            |               |        
    |           |            |\n|    1.9 |         |            |               
|            |           |            |\n|     2. |   34.18 |      51.76 |      
  270.08 |     694.42 |     67.16 |      67.44 |\n|    2.2 |  37.598 |     
56.936 |               |            |           |            |\n|    2.5 |  
42.725 |       64.7 |               |            |           |            |\n|  
   3. |   51.27 |      77.64 |               |            |           |         
   |\n|    3.5 |  59.815 |      90.58 |               |            |           
|            |\n|     4. |   68.36 |     103.52 |               |            |  
         |            |\n|    4.5 |  76.905 |     116.46 |               |      
      |           |            |\n|     5. |   85.45 |      129.4 |             
  |            |           |            |\n|    5.5 |  93.995 |     142.34 |    
           |            |           |            |\n|     6. |  102.54 |     
155.28 |               |            |           |            |\n\n\n* Figures 
and tables for pandoc\n\n{{{pandoc(\\\\section*{List of 
Figures})}}}\n\n\n{{{pandoc(FiguresHere\\\\par)}}}\n\n{{{pandoc(\\\\section*{List
 of Tables})}}}\n\n\n{{{pandoc(TablesHere\\\\par)}}}\n\n\n* Some initial plots 
of histograms                                 :noexport:\n\n#+begin_src R 
\n<<initR>>\n\nsim <- getDir(\n    type = \"csv\",\n    site = 
\"CapePeninsula\",\n    strategy = \"Consensus\",\n    budget   = 
\"CapePeninsula_1_0\",\n    run = 1)\n\nh <- read.csv(file.path(sim, 
\"all_dc_hist.csv\"))\n#+end_src\n\n#+RESULTS:\n\n* Results from Simulations    
                                     :noexport:\n** Directory structure         
                                   :noexport:\n*** 
Example\n#+begin_example\n./inputdata/csv/ASM_Optimization/\n└── Simulations\n  
  ├── Agulhas\n    │   └── simASM\n    │       ├── Consensus\n    │       │   
├── Agulhas_0_1\n    │       │   │   └── Agulhas\n    │       │   │       ├── 
47835.1\n    │       │   │       ├── 47835.2\n    │       │   │       ├── 
47835.3\n    │       │   │       ├── 47835.4\n    │       │   │       └── 
47835.5\n    │       │   ├── Agulhas_2_5\n    │       │   │   └── ...\n    │    
   │   ├── Agulhas_5_0\n    │       │   │   └── ...\n    │       │   ├── 
Agulhas_5_5\n    │       │   │   └── ...\n    │       │   └── Agulhas_6_0 \n    
│       │       └── ...\n    │       ├── Future\n    │       ├── Past ...\n    
│       └── Present ...\n    ├── CapePeninsula ...\n    ├── Outeniqua ...\n    
└── 
log\n#+end_example\n\n./inputdata/*csv*/SITE/simASM/STRATEGY/BUDGET/FIRE/RUN\n\n***
 R functions\nsee package ASMOptimPaper for the functions used in the analysis. 
\n\n** GRASS simASM input data\n*** Mapset name structure\nThe 
[[file:inputdata/simASM/][GRASS location]] contains the following mapsets:\n- 
[[file:inputdata/simASM/PERMANENT/][PERMANENT]] mapset - read-only :: which 
contains the South Africa wide data used in the simulations\n- 
[[file:inputdata/simASM/grassAnalysis/][grassAnalysis]] - read-write :: which 
can be used for analysis\n- 
[[file:inputdata/simASM/simASM.Outeniqua.Random.Outeniqua_2_0.Outeniqua.41719.5/][simulations]]
 :: about 530 mapsets whose names are build as follow:\n\n     
{{{if-latex-else(simASM.\\\\texttt{SITE}.\\\\texttt{STRATEGY}.\\\\texttt{BUDGET}.\\\\texttt{FIREREGIME}.\\\\texttt{JOBID}.\\\\texttt{ARRAYID},
 simASM . =SITE= . =STRATEGY= . =BUDGET= . =FIREREGIME= . =JOBID= . 
=ARRAYID=)}}}\n     #+CAPTION: Simulations conducted and combination of 
different parameter values. =f= is the factor which, multiplied with the yearly 
original budget of year 2006 [[comment:Check!]] becomes the initial budget of 
the simulation. The factor f is written with underscore ({{{us}}}) instead of 
the decimal point (e.g. 1.5 becomes 1{{{us}}}1).\n     | =SITE=        | 
=STRATEGY= | =BUDGET=               | =FIREREGIME= | =JOBID= | =ARRAYID= |\n    
 
|---------------+------------+------------------------+--------------+---------+-----------|\n
     |               | Consensus  |                        |              |     
    |         1 |\n     | Agulhas       | Future     | =SITE= {{{us}}}f       | 
             |         |         2 |\n     | CapePeninsula | Past       |       
                 | =SITE=       | number  |         3 |\n     | Outeniqua     | 
Present    | none                   |              |         |         4 |\n    
 |               | Random     |                        |              |         
|         5 |\n     
|---------------+------------+------------------------+--------------+---------+-----------|\n\n***
 Map name structure in the =simulation= mapsets\nUsing 
=simASM.CapePeninsula.Random.CapePeninsula_1_0.CapePeninsula.xxx.5= as an 
exapmle.\n**** Static data\n#+begin_src R :colnames yes :exports 
results\n<<initR>>\nx <- getMapNames(\n    site     = \"CapePeninsula\",\n    
strategy = \"Random\",\n    budget   = \"CapePeninsula_1_0\",\n    run      = 
5,\n    type     = \"raster\",\n    pattern  = \"*\",\n    fullMapNames = 
FALSE\n) %>%\n    strsplit(split=\"_\") %>%\n    subset(sapply(., 
FUN=\"length\") == 1) %>%\n    sapply(FUN=\"[[\", 1) %>%\n    unique()\nx <- 
c(x, \"SPECIES\\{{{us}}}suitability\")\ndata.frame(\"names\" = 
x)\n#+end_src\n\n#+RESULTS:\n| names                               
|\n|-------------------------------------|\n| MASK                              
  |\n| NBALs                               |\n| TPI                             
    |\n| ignitionRisk                        |\n| region                        
      |\n| vegetationID                        |\n| vegetationStatus            
        |\n| SPECIES{{{us}}}suitability |\n\n**** Dynamic, i.e. over time 
changing, raster maps\nThe maps have the following naming structure:\n\n# 
=SPECIES= {{{us}}} =TYPE= {{{us}}} 
=YEAR=\n\n\\texttt{SPECIES}{{{us}}}\\texttt{TYPE}{{{us}}}\\texttt{YEAR}\n\n\nBlocks
 of combinations are separated by ------ and all combinations are available for 
all =YEAR=\n\n#+begin_src R :colnames yes :exports results\n<<initR>>\nx <- 
getMapNames(\n    site     = \"CapePeninsula\",\n    strategy = \"Random\",\n   
 budget   = \"CapePeninsula_1_0\",\n    run      = 5,\n    type     = 
\"raster\",\n    pattern  = \"*\",\n    fullMapNames = FALSE\n) %>%\n    
strsplit(split=\"_\") %>%\n    subset(sapply(., FUN=\"length\") == 3) %>%\n    
data.frame(stringsAsFactors = FALSE) %>%\n    t() %>%\n    
data.frame(stringsAsFactors = FALSE)\n##\nrownames(x) <- NULL\n\n##\nSP <- x$X1 
%in% c(\"ACyclops\", \"HSericea\", \"PPinaster\")\nALL <- x$X1 %in% 
\"all\"\nOTHER <- !SP & !ALL\n\n##\nxsp <- x[SP,] %>%\n    
lapply(unique)\nyears <- sort(xsp[[3]])\nmn <- max(sapply (xsp[-3], 
length))\nxsp <- lapply(\n    xsp[-3],\n    function(y) {\n        y <- 
c(sort(y), rep(\"\", mn - length(y)))\n    }\n)\n\n##\nxall <- x[ALL,] %>%\n    
lapply(unique)\nmn <- max(sapply (xall[-3], length))\nxall <- lapply(\n    
xall[-3],\n    function(y) {\n        y <- c(sort(y), rep(\"\", mn - 
length(y)))\n    }\n)\n\n##\nxother <- x[OTHER,] %>%\n    lapply(unique)\nmn <- 
max(sapply (xother[-3], length))\nxother <- lapply(\n    xother[-3],\n    
function(y) {\n        y <- c(sort(y), rep(\"\", mn - length(y)))\n    
}\n)\n\n##\n\nx <- list(\n    SPECIES = c( xsp$X1, \"------------\", xall$X1, 
\"------------\", xother$X1),\n    TYPE    = c( xsp$X2, 
\"--------------------\", xall$X2, \"--------------------\", 
xother$X2)\n)\nx$YEAR <- c(years, rep(\"\", 
length(x$SPECIES)-length(years)))\ndata.frame(x)\n#+end_src\n\n#+CAPTION: Names 
label:tab-MapNames of the rastermaps in the simulations. They have the 
structure 
\\texttt{SPECIES}{{{us}}}\\texttt{TYPE}{{{us}}}\\texttt{YEAR}\n#+RESULTS:\n| 
SPECIES      | TYPE                 | YEAR 
|\n|--------------+----------------------+------|\n| ACyclops     | age         
         | 2006 |\n| HSericea     | ageClass             | 2007 |\n| PPinaster  
  | ageClassFire         | 2008 |\n|              | clearingCost         | 2009 
|\n|              | dc                   | 2010 |\n|              | 
dcEstablished        | 2011 |\n|              | dcFire               | 2012 
|\n|              | dcSeedlings          | 2013 |\n|              | 
disturbances         | 2014 |\n|              | fuelModel            | 2015 
|\n|              | individuals          | 2016 |\n|              | 
noEstablished        | 2017 |\n|              | noSeedlings          | 2018 
|\n|              | personDay            | 2019 |\n|              | pGerm       
         | 2020 |\n|              | seedsDisperse        | 2021 |\n|            
  | seedsPlant           | 2022 |\n|              | seedsProduced        | 2023 
|\n|              | seedsSoil            | 2024 |\n| ------------ | 
-------------------- | 2025 |\n| all          | cleared              | 2026 
|\n|              | clearingCosts        | 2027 |\n|              | dc          
         | 2028 |\n|              | fuelModel            | 2029 |\n|            
  | personDay            | 2030 |\n|              | prioStand            | 2031 
|\n| ------------ | -------------------- | 2032 |\n| clearing     | 1h          
         | 2033 |\n| fire         | count                | 2034 |\n| ignition   
  | fuelModel            | 2035 |\n| moisture     | last                 | 2036 
|\n| NatVeg       | live                 | 2037 |\n|              | Points      
         |      |\n|              | stage                |      |\n|            
  |                      |      |\n\n* Tool Functions                           
                        :noexport:\n#+begin_src sh :results output \nmogrify 
-format png -density 300 -quality 100 ./fig-*.pdf 
\n#+end_src\n\n#+RESULTS:\n#+begin_example\n12\n3\n1\n17541\n0\n3\n0\n3\n17541\n(3
 0 
obj\\350\\262}\\303\\327\\330\\312\\334\\330-\\336\\017m8\\223\\337p\\)i\\302\\257\\304h\\267\\376-\\267\\024-\\370\\225\\030,\\365\\370\\226\\237\\203&\\374R\\2642\\222\\215\\276\\301\\302=\\013`\\303\\225h\\355\\t\\351\\316o\\370=h\">\\032c\\321\\241\\205\\177\\374\\364\\377\\000\\t\\235\\273\\207endstream\\331\\177\\305\\315\\262\\365\\317\\255\\360\\272\\320\\312z\\267|\\376\\033\\355\\367\\347Vx]h\\305\\257\\313\\327\\256\\356q~n\\205\\327\\205V~\\372\\272\\234\\341\\272l\\317BR\\303u\\331\\3721\\226\\247p]\\276v\\353FZL+\\274.\\264\\342\\327\\3457\\337}e\\222\\370\\365\\337\\265W}}\\367o\\257:address@hidden)\n65535\n21250\n12\n4\n1\n17624\n0\n4\n0\n4\n17624\n(4
 0 obje /Pages /Kids [ 7 0 R ] /Count 1 /MediaBox [0 0 504 324] 
>>=h\">\\032c\\321\\241\\205\\177\\374\\364\\377\\000\\t\\235\\273\\207endstream\\331\\177\\305\\315\\262\\365\\317\\255\\360\\272\\320\\312z\\267|\\376\\033\\355\\367\\347Vx]h\\305\\257\\313\\327\\256\\356q~n\\205\\327\\205V~\\372\\272\\234\\341\\272l\\317BR\\303u\\331\\3721\\226\\247p]\\276v\\353FZL+\\274.\\264\\342\\327\\3457\\337}e\\222\\370\\365\\337\\265W}}\\367o\\257:address@hidden)\n65535\n21250\n12\n5\n1\n17747\n0\n5\n0\n5\n17747\n(5
 0 objpace << /sRGB 5 0 R >> >>/Count 1 /MediaBox [0 0 504 324] 
>>=h\">\\032c\\321\\241\\205\\177\\374\\364\\377\\000\\t\\235\\273\\207endstream\\331\\177\\305\\315\\262\\365\\317\\255\\360\\272\\320\\312z\\267|\\376\\033\\355\\367\\347Vx]h\\305\\257\\313\\327\\256\\356q~n\\205\\327\\205V~\\372\\272\\234\\341\\272l\\317BR\\303u\\331\\3721\\226\\247p]\\276v\\353FZL+\\274.\\264\\342\\327\\3457\\337}e\\222\\370\\365\\337\\265W}}\\367o\\257:address@hidden)\n65535\n21250\n12\n6\n1\n17780\n0\n6\n0\n6\n17780\n(6
 0 objsed 6 0 R]RGB 5 0 R >> >>/Count 1 /MediaBox [0 0 504 324] 
>>=h\">\\032c\\321\\241\\205\\177\\374\\364\\377\\000\\t\\235\\273\\207endstream\\331\\177\\305\\315\\262\\365\\317\\255\\360\\272\\320\\312z\\267|\\376\\033\\355\\367\\347Vx]h\\305\\257\\313\\327\\256\\356q~n\\205\\327\\205V~\\372\\272\\234\\341\\272l\\317BR\\303u\\331\\3721\\226\\247p]\\276v\\353FZL+\\274.\\264\\342\\327\\3457\\337}e\\222\\370\\365\\337\\265W}}\\367o\\257:address@hidden)\n65535\n21250\n#+end_example\n\n\n\n*
 File Local Variables                                             
:noexport:\n\n# Local Variables:\n# eval: (visual-line-mode 1)\n# End:\n\n\n") 
(narrow-to-region 1 57482) (goto-char 1))
|   (lambda nil (let ((inhibit-modification-hooks t)) (let ((org-mode-hook nil) 
(org-inhibit-startup t)) (org-mode)) (set (make-local-variable (quote 
org-table-may-need-update)) (quote t)) (set (make-local-variable (quote 
org-latex-and-related-regexp)) (quote "")) (set (make-local-variable (quote 
org-todo-line-tags-regexp)) (quote "^\\(\\*+\\)\\(?: 
+\\(C\\(?:ANCELED\\|HECK\\|ODE\\)\\|DONE\\|EXECUTE\\|T\\(?:EXT\\|ODO\\)\\|WAIT\\)\\)?\\(?:
 +\\(.*?\\)\\)??\\(?:[         ]+\\(:[[:alnum:]:address@hidden:\\)\\)?[        
]*$")) (set (make-local-variable (quote org-complex-heading-regexp-format)) 
(quote "^\\(\\*+\\)\\(?: 
+\\(C\\(?:ANCELED\\|HECK\\|ODE\\)\\|DONE\\|EXECUTE\\|T\\(?:EXT\\|ODO\\)\\|WAIT\\)\\)?\\(?:
 +\\(\\[#.\\]\\)\\)?\\(?: +\\(?:\\[[0-9%%/]+\\] *\\)*\\(%s\\)\\(?: 
*\\[[0-9%%/]+\\]\\)*\\)\\(?:[         ]+\\(:[[:alnum:address@hidden:]+:\\)\\)?[ 
      ]*$")) (set (make-local-variable (quote org-complex-heading-regexp)) 
(quote "^\\(\\*+\\)\\(?: 
+\\(C\\(?:ANCELED\\|HECK\\|ODE\\)\\|DONE\\|EXECUTE\\|T\\(?:EXT\\|ODO\\)\\|WAIT\\)\\)?\\(?:
 +\\(\\[#.\\]\\)\\)?\\(?: +\\(.*?\\)\\)??\\(?:[         
]+\\(:[[:alnum:address@hidden:]+:\\)\\)?[       ]*$")) (set 
(make-local-variable (quote org-todo-line-regexp)) (quote "^\\(\\*+\\)\\(?: 
+\\(C\\(?:ANCELED\\|HECK\\|ODE\\)\\|DONE\\|EXECUTE\\|T\\(?:EXT\\|ODO\\)\\|WAIT\\)\\)?\\(?:
 +\\(.*?\\)\\)?[      ]*$")) (set (make-local-variable (quote 
org-not-done-heading-regexp)) (quote "^\\(\\*+\\)\\(?: 
+\\(C\\(?:HECK\\|ODE\\)\\|EXECUTE\\|T\\(?:EXT\\|ODO\\)\\|WAIT\\)\\)\\(?: 
+\\(.*?\\)\\)?[         ]*$")) (set (make-local-variable (quote 
org-not-done-regexp)) (quote 
"\\(C\\(?:HECK\\|ODE\\)\\|EXECUTE\\|T\\(?:EXT\\|ODO\\)\\|WAIT\\)")) (set 
(make-local-variable (quote org-todo-regexp)) (quote 
"\\(C\\(?:ANCELED\\|HECK\\|ODE\\)\\|DONE\\|EXECUTE\\|T\\(?:EXT\\|ODO\\)\\|WAIT\\)"))
 (set (make-local-variable (quote org-not-done-keywords)) (quote ("TODO" "WAIT" 
"CHECK" "EXECUTE" "CODE" "TEXT"))) (set (make-local-variable (quote 
org-todo-log-states)) (quote nil)) (set (make-local-variable (quote 
org-todo-sets)) (quote (("TODO" "WAIT" "CHECK" "EXECUTE" "CODE" "TEXT" "DONE" 
"CANCELED")))) (set (make-local-variable (quote org-todo-heads)) (quote 
("TODO"))) (set (make-local-variable (quote org-done-keywords)) (quote ("DONE" 
"CANCELED"))) (set (make-local-variable (quote org-todo-keywords-1)) (quote 
("TODO" "WAIT" "CHECK" "EXECUTE" "CODE" "TEXT" "DONE" "CANCELED"))) (set 
(make-local-variable (quote org-todo-key-trigger)) (quote (116 119 99 101 111 
121 100 120))) (set (make-local-variable (quote org-todo-key-alist)) (quote 
((:startgroup) ("TODO" . 116) ("WAIT" . 119) ("CHECK" . 99) ("EXECUTE" . 101) 
("CODE" . 111) ("TEXT" . 121) ("DONE" . 100) ("CANCELED" . 120) (:endgroup)))) 
(set (make-local-variable (quote org-todo-kwd-alist)) (quote (("TODO" sequence 
"TODO" "DONE" "CANCELED") ("WAIT" sequence "TODO" "DONE" "CANCELED") ("CHECK" 
sequence "TODO" "DONE" "CANCELED") ("EXECUTE" sequence "TODO" "DONE" 
"CANCELED") ("CODE" sequence "TODO" "DONE" "CANCELED") ("TEXT" sequence "TODO" 
"DONE" "CANCELED") ("DONE" sequence "TODO" "DONE" "CANCELED") ("CANCELED" 
sequence "TODO" "DONE" "CANCELED")))) (set (make-local-variable (quote 
org-hide-block-startup)) (quote t)) (set (make-local-variable (quote 
org-use-sub-superscripts)) (quote t)) (set (make-local-variable (quote 
org-table-formula-constants-local)) (quote nil)) (set (make-local-variable 
(quote org-file-properties)) (quote (("header-args:R" . ":session test 
:comments link") ("header-args" . ":tangle-mode (identity #o444) :tangle no 
:mkdirp yes :exports both :padline no :eval never-export :noweb yes")))) (set 
(make-local-variable (quote org-tag-alist)) (quote nil)) (set 
(make-local-variable (quote org-tag-groups-alist)) (quote nil)) (set 
(make-local-variable (quote org-file-tags)) (quote nil)) (set 
(make-local-variable (quote buffer-file-name)) (quote 
"/Users/rainerkrug/Documents/Projects/ASM_Optimization/asmOptim.org")) (set 
(make-local-variable (quote default-directory)) (quote 
"/Users/rainerkrug/Documents/Projects/ASM_Optimization/")) (set 
(make-local-variable (quote buffer-file-coding-system)) (quote utf-8-unix)) 
(insert "#+TITLE: Optimizing management actions for invasive alien plants under 
different budgetary scenarios\n#+AUTHOR: Rainer M. Krug, Núria Roura-Pascual & 
David M. Richardson\n#+EMAIL: 
address@hidden:\n#+KEYWORDS:\n\n:CONFIG:\n#+OPTIONS: ':nil *:t -:t ::t <:t H:3 
\\n:nil ^:t arch:headline\n#+OPTIONS: author:t c:nil creator:comment d:(not 
\"LOGBOOK\") date:t\n#+OPTIONS: e:t email:nil f:t inline:t num:t p:nil pri:nil 
prop:nil\n#+OPTIONS: stat:t tags:t tasks:t tex:t timestamp:t toc:t todo:t 
|:t\n#+LANGUAGE: en\n#+SELECT_TAGS: export\n#+EXCLUDE_TAGS: 
noexport\n#+CREATOR: Emacs 24.4.1 (Org mode 8.3beta)\n#+OPTIONS: 
H:6\n#+OPTIONS: toc:6\n#+STARTUP: hideblocks\n#+TODO: TODO(t) WAIT(w) CHECK(c) 
EXECUTE(e) CODE(o) TEXT(y) | DONE(d) 
CANCELED(x)\n:END:\n:LATEXHEADER:\n#+LaTeX_CLASS_OPTIONS: 
[a4paper,usenames,dvipsnames,table]\n\n#+LATEX_HEADER: 
\\lstset{%\n#+LATEX_HEADER:     basicstyle=\\ttfamily\\footnotesize,       % 
the font that is used for the code\n#+LATEX_HEADER:     tabsize=4,              
         % sets default tabsize to 4 spaces\n#+LATEX_HEADER:     numbers=left,  
                  % where to put the line numbers\n#+LATEX_HEADER:     
numberstyle=\\tiny,               % line number font size\n#+LATEX_HEADER:     
stepnumber=0,                    % step between two line 
numbers\n#+LATEX_HEADER:     breaklines=true,                 %!! don't break 
long lines of code\n#+LATEX_HEADER:     showtabs=false,                  % show 
tabs within strings adding particular underscores\n#+LATEX_HEADER:     
showspaces=false,                % show spaces adding particular 
underscores\n#+LATEX_HEADER:     showstringspaces=false,          % underline 
spaces within strings\n#+LATEX_HEADER:     
keywordstyle=\\color{blue},\n#+LATEX_HEADER:     
identifierstyle=\\color{black},\n#+LATEX_HEADER:     
stringstyle=\\color{ForestGreen},\n#+LATEX_HEADER:     
commentstyle=\\color{red},\n#+LATEX_HEADER:     
backgroundcolor=\\color{light-gray},   % sets the background 
color\n#+LATEX_HEADER:     columns=fullflexible,  \n#+LATEX_HEADER:     
basewidth={0.5em,0.4em}, \n#+LATEX_HEADER:     captionpos=b,                    
% sets the caption position to `bottom'\n#+LATEX_HEADER:     
extendedchars=false              %!?? workaround for when the listed file is in 
UTF-8\n#+LATEX_HEADER: }\n\n#+LATEX_HEADER: 
\\usepackage[round,semicolon,authoryear]{natbib}\n\n#+LATEX_CLASS_OPTIONS: 
[colorlinks=true]\n\n#+LATEX_HEADER: 
\\usepackage[section]{placeins}\n#+LATEX_HEADER: 
\\usepackage{subcaption}\n\n#+LATEX_HEADER: \\usepackage{bm}\n\n#+LATEX_HEADER: 
%% \\usepackage{showframe}\n#+LATEX_HEADER: 
\\usepackage{float}\n\n#+LaTeX_header: \\usepackage{amsmath}\n\n#+LaTeX_header: 
\\usepackage{todonotes}\n\n#+LaTeX_header: \\usepackage{soul}\n# See 
[[http://tex.stackexchange.com/a/139500/6941]] for why\n#+LaTeX_header: 
\\soulregister\\cite7\n#+LaTeX_header: \\soulregister\\citep7\n#+LaTeX_header: 
\\soulregister\\citet7\n#+LaTeX_header: 
\\soulregister\\emph7\n\n:END:\n:HTMLHEADER:\n#+SETUPFILE: 
/Users/rainerkrug/.emacs.d/org-html-themes/setup/theme-readtheorg.setup\n:END:\n:MATHMACROS:\n#+LATEX_HEADER:
 \\newcommand{\\cua}{\\mathit{a} (t)}\n#+LATEX_HEADER: 
\\newcommand{\\cov}{\\mathit{cov} (t)}\n#+LATEX_HEADER: 
\\newcommand{\\ac}{\\mathit{c} (t)}\n#+LATEX_HEADER: 
\\newcommand{\\bpc}{\\mathit{b}}\n#+LATEX_HEADER: 
\\newcommand{\\bpci}{\\mathit{b_{inv}}}\n\n#+LATEX_HEADER: 
\\newcommand{\\tmg}{\\mathit{t_{95}}}\n#+LATEX_HEADER: 
\\newcommand{\\bmg}{\\mathit{B_{95}}}\n\n#+LATEX_HEADER: 
\\newcommand{\\pmg}{\\mathit{p_{95}}}\n\n#+LATEX_HEADER: 
\\newcommand{\\bc}{\\mathit{\\hat{b}}}\n#+LATEX_HEADER: 
\\newcommand{\\bci}{\\mathit{\\hat{b}_{inv}}}\n\n#+LATEX_HEADER: 
\\newcommand{\\idb}{\\mathit{I^{b}_{95}}}\n#+LATEX_HEADER: 
\\newcommand{\\idt}{\\mathit{I^{t}_{95}}}\n\n:END:\n:MACROS:\n#+INCLUDE: 
~/.emacs.d/org-macros/org-macros.setup\n\n#+MACRO: us        (eval (if 
(org-export-derived-backend-p org-export-current-backend 'latex) 
\"\\\\textunderscore{}\" \"_\"             ))\n#+MACRO: clearpage (eval (if 
(org-export-derived-backend-p org-export-current-backend 'latex) 
\"\\\\clearpage\"        \"\"               ))\n#+MACRO: img       (eval (if 
(org-export-derived-backend-p org-export-current-backend 'latex) 
\"[[file:$1.pdf]]\"    \"[[file:$1.png]]\"))\n#+MACRO: sc        (eval (if 
(org-export-derived-backend-p org-export-current-backend 'latex) 
\"\\\\textsc{$1}\"    \"$1\"))\n\n#+MACRO: pandoc    (eval (if 
(org-export-derived-backend-p org-export-current-backend 'latex) 
\"@@latex:%forPandoc%$1@@\"   \"$1\"))\n:END:\n:BABEL:\n#+PROPERTY: header-args 
 :tangle-mode (identity #o444)\n#+PROPERTY: header-args+ :tangle 
no\n#+PROPERTY: header-args+ :mkdirp yes\n#+PROPERTY: header-args+ :exports 
both\n#+PROPERTY: header-args+ :padline no\n#+PROPERTY: header-args+ :eval 
never-export \n#+PROPERTY: header-args+ :noweb yes\n\n#+PROPERTY: header-args:R 
:session test\n#+PROPERTY: header-args:R+ :comments link\n\n#+Bind: 
org-babel-use-quick-and-dirty-noweb-expansion \"t\"\n:END:\n\n# #+LaTeX_header: 
\\usepackage[]{endfloat}\n\n* List Of Figures                                   
          :ignoreheading:\n{{{if-latex-else(\\\\listoffigures, \"\")}}}\n\n* 
List Of Tables                                              
:ignoreheading:\n{{{if-latex-else(\\\\listoftables, \"\")}}}\n* List Of TODOs   
                                            
:ignoreheading:\n{{{if-latex-else(\\\\listoftodos, \"\")}}}\n\n\n\n* Version 
src_sh{sed -n '/^Version: /s///p' ./DESCRIPTION}  \n:PROPERTIES:\n:header-args: 
:exports results\n:header-args+: :tangle no\n:END:\nVersion src_sh{sed -n 
'/^Version: /s///p' ./DESCRIPTION}\n\n* #### clearpage ####                     
                    :ignoreheading:\n{{{clearpage}}}\n\n\n\n* 
Abstract\n#+begin_abstract\nNeeds top be written\n#+end_abstract\n\n\n* TODO 
DESCRIPTION File                                            
:noexport:\n:PROPERTIES:\n:header-args: :comments no\n:header-args+: :padline 
no\n:header-args+: :no-expand TRUE\n:header-args+: :eval 
never\n:END:\n\n#+begin_src RDescr :tangle ./DESCRIPTION\nPackage: 
ASMOptim\nType: Paper\nTitle: Analysis transcripts and Paper Alanysis\nVersion: 
0.2.0.+\nAuthor: Rainer M. Krug\nMaintainer: Rainer M Krug 
<address@hidden>\nDepends: ASMOptimPackage (>= 0.2.0)\n#+end_src\n\n\n* TODO 
Setup .Rprofile file                                        :noexport:\nThis 
file will only be used when R is not started with --vanilla!!!!\n#+begin_src R 
:tangle 
./.Rprofile\n.libPaths(normalizePath(\"library\"))\nlibrary(devtools)\n# 
load_all(\"./package/asm\")\n#+end_src\n\n* Code Snippets for Analysis and 
Results                           :noexport:\n:PROPERTIES:\n:header-args+: 
:tangle no\n:header-args+: :eval never\n:END:\n** initR\nLoad lEnergyBalance 
and WindProfilePaper packages\n#+NAME: initR\n#+begin_src R\n\n##  
<initR>\nlibrary(devtools)\n## install_bitbucket(repo=\"rkrug/WindProfiles\", 
ref=\"v_0.7.0\", auth_user=\"rkrug\", 
password=\"\")\nload_all(\"./package/ASMOptimPaper/ASMOptimPaper.org/\")\n## 
gInit()\n##  </initR>\n\n#+end_src\n\n** getMapsetTypes\nThis is a template to 
be remembered and to be used as a base for getting the results types from a 
simulation.\n\n#+NAME: getMapsetTypes\n#+begin_src R \n    getMapNames(\n       
 site     = \"CapePeninsula\",\n        strategy = \"Consensus\",\n        
budget   = \"CapePeninsula_1_0\",\n        run      = 5,\n        type     = 
\"raster\",\n        pattern  = \"*\",\n        fullMapNames = FALSE\n    ) 
%>%\n        strsplit(split=\"_\") %>%\n        subset(sapply(., 
FUN=\"length\") == 2) %>%\n        sapply(FUN=\"[[\", 2) %>%\n        
unique()\n\n#+end_src\n* emails                                                 
          :noexport:\n[[notmuch:id:address@hidden from Núria Roura-Pascual: RE: 
Missing piece ...]]\n\n* Data preparation                                       
          :noexport:\n** Split complete data into different 
types\n:PROPERTIES:\n:heade-args: :eval never-export\n:END:\n- csv 
::\n#+begin_src sh :session data :results none\nmkdir ./inputdata/csv/  \nrsync 
-avz --include=\"*/\" --include=\"*.csv\" --exclude=\"*\" 
/Volumes/Seagate_1TB/HomeExternal/Documents/ASM_Optimization ./inputdata/csv/  
\nfind . -type f -name \"*.asc\" -exec gzip -v {} \\;\nrsync -avz 
--include=\"*/\" --include=\"*.csv\" --exclude=\"*\" 
address@hidden:~/clusterResults/clusterResults/simASM/RandomClearingPaper/results/simASMRightFire
 ./inputdata/csv/\n#+end_src\n\n- png ::\n#+begin_src sh :session data :results 
none\nmkdir ./inputdata/png//  \nrsync -avz --include=\"*/\" 
--include=\"*.png\" --exclude=\"*\" 
/Volumes/Seagate_1TB/HomeExternal/Documents/ASM_Optimization ./inputdata/png/  
\nrsync -avz --include=\"*/\" --include=\"*.png\" --exclude=\"*\" 
/Volumes/Home\\ on\\ 
Pogoplug/clusterResults/clusterResults/simASM/RandomClearingPaper/results/simASMRightFire/
 ./inputdata/csv/\nrsync -avz --include=\"*/\" --include=\"*.png\" 
--exclude=\"*\" 
address@hidden:~/clusterResults/clusterResults/simASM/RandomClearingPaper/results/simASMRightFire
 ./inputdata/png/\n#+end_src\n\n** Merge directory structure 
into\n./inputdata/csv/ASM_Otimization/Simulations/SITE/simASM/STRATEGY/BUDGET/FIRE/RUN\n\n*
 Bash scripts for data preparation and handling                   
:noexport:\n** tar2grass  - extract grass/simulation directories and create 
single grass location\n:PROPERTIES:\n:header-args:sh: :tangle 
./tar2grass\n:header-args:sh: :comments no\n:header-args:sh+: :tangle-mode 
(identity #o755)\n:END:\nThis script extracts the =grass/simulation= directory 
from a tar.gz\nfile of the simulation and moves it into the folder =./simASM= 
folder\nand renames it to the name of the =tar.gz= without the 
=.tar.gz=.\n\nAfter adding the \n#+begin_src sh \nTAR=\"$1\"\necho $TAR 
...\ntar -xvzf $TAR  --include='*/grass/simulation/*'\nmkdir -p simASM\ncd 
tmp\ncd $(ls)\nSIM=$(ls)\ncd $(ls)\ncd grass\nmv simulation $SIM\nmv $SIM 
./../../../../simASM/\ncd ./../../../../\nrm -rf ./tmp\n#+end_src\n\n** make 
the squashfs\n:PROPERTIES:\n:header-args:sh: :tangle 
./addPERMANENT\n:header-args:sh: :comments no\n:header-args:sh+: :tangle-mode 
(identity #o755)\n:END:\nCopies =PERMANENT= from =./inputdata/PERMANENT= into 
the location and\nadds the link to a mapset =./../grassAnalysis= which can be 
used for\nwrite access outside the mapset, i.e. the complete mapset can 
be\nconverted into a SquashFS and be mounted afterwards.\n\n#+begin_src sh \ncp 
-R ./inputdata/PERMANENT ./simASM/\nln ln -s ./../../grassAnalysis 
./simASM/grassAnalysis\n#+end_src\n\n#+begin_src sh  :tangle no\nmksquashfs 
./simASM ./simASM.squashfs -processors 6\n#+end_src\n\n** COMMENT tar2sqfs  - 
Prepare .tar.gz files and convert to SquashFS\n:PROPERTIES:\n:header-args:sh: 
:tangle ./tar2sqfs\n:header-args:sh+: :comments no\n:header-args:sh+: 
:tangle-mode (identity #o755)\n:END:\nThis script converts is converting tar.gz 
fines in tto .squashfs files\nin the current directory. It should be run in the 
./input directory.\n\n*** Extract .tar.gz simulation but exclude certain 
redundant files\n#+begin_src sh\nTAR=\"$1\"\ntar -xvzf $TAR  
--exclude='*/output/*' --exclude='input.tar.gz' 
--exclude='output.tar.gz'\n#+end_src\n\n*** Climb in dirrectory into single 
unique directory\n#+begin_src sh \ncd tmp\ncd `ls`\n#+end_src\n\n*** Replace 
link to =PERMANENT= with link to existing =PERMANENT= \n#+begin_src sh \nfind . 
-type \"link\" -name \"PERMANENT\" -exec ln -fhs ./../../PERMANENT {} 
\\;\n#+end_src\n\n*** Create squashfs in base folder and delete original 
folder\n#+begin_src sh \nNAME=$(ls)\nmksquashfs $NAME ./../../$NAME.squashfs -b 
1048576 -comp xz -Xdict-size 100%\ncd ./../../\nrm -rf 
./tmp\n#+end_src\n\n\n\n** COMMENT oneGrass\n:PROPERTIES:\n:header-args:sh: 
:tangle ./oneGRASS\n:header-args:sh+: :comments no\n:header-args:sh+: 
:tangle-mode (identity #o755)\n:END:\n#+begin_src sh 
\nDEST=./DEST$$\nGRASS=./GRASS$$/simASM\n\nfunction finish {\n    rm -rf 
\"$DEST\"\n    rm -rf \"$GRASS\"\n}\ntrap finish EXIT\n\nmkdir -p 
\"$GRASS\"\n\necho Copying ./inputdata/PERMANENT to $GRASS ...\ncp -R 
./inputdata/PERMANENT $GRASS/\nfor F in ./inputdata/simASM.*.squashfs; do \n    
BN=$(basename $F)\n    DN=$(dirname $F)\n    DIR=\"${BN%.*}\"\n    echo 
\"<<<<<\"\n    echo Extracting grass/simulation from $F to 
./$DEST/grass/simulation\n    unsquashfs -dest $DEST \"$F\" -e 
grass/simulation/*\n    echo Moving \"./$DEST/grass/simulation\" to 
\"$GRASS/simASM/grass/$DIR\"\n    mv \"./$DEST/grass/simulation\" \"$GRASS\"\n  
  mv \"$GRASS/simulation\" \"$GRASS/$DIR\"\n    echo Deleting \"$DEST\"\n    rm 
-rf \"$DEST\"\n    echo \">>>>>\"\ndone  \necho Create link $GRASS/analysis out 
of the squashfs for editable mapset\nln -s \"./../../grassAnalysis\" 
\"$GRASS/analysis\"\necho Making SquashFS ./input/simASM.grass.squashfs from 
$GRASS/simASM ...\nmksquashfs \"$GRASS\" ./input/simASM.grass.squashfs -b 
1048576 -comp xz -Xdict-size 100%\necho Done\n#+end_src\n\n** COMMENT 
mountSimASM - mount simASM.grass.squashfs to 
./inputdata/simASM\n:PROPERTIES:\n:header-args:sh: :tangle 
./mountSimASM\n:header-args:sh+: :comments no\n:header-args:sh+: :tangle-mode 
(identity #o755)\n:END:\n#+begin_src sh 
\nDIR=./inputdata/simASM\nSFS=./inputdata/simASM.grass.squashfs\nFN=./umountSimASM\necho
 \"#!/bin/sh\" > $FN\necho \"umount $DIR\" >> $FN\necho \"rm $DIR/NOT_MOUNTED\" 
>> $FN\necho \"rmdir $DIR\" >> $FN\necho \"rm $FN\" >> $FN\nchmod +x $FN\nmkdir 
-p \"$DIR\"\ntouch \"$DIR/NOT_MOUNTED\"\nsquashfuse \"$SFS\" 
\"$DIR\"\n#+end_src\n\n\n** COMMENT mountSims - mount all 
./input/simASM.*.squashfs \n:PROPERTIES:\n:header-args:sh: :tangle 
./mountsimASM\n:header-args:sh+: :comments no\n:header-args:sh+: :tangle-mode 
(identity #o755)\n:END:\n#+begin_src sh \nFN=./umountsimASM\necho \"#!/bin/sh\" 
> $FN\nchmod +x umountsimASM\nfor F in ./inputdata/simASM.*.squashfs; do \n    
BN=$(basename $F)\n    DN=$(dirname $F)\n    DIR=$DN/\"${BN%.*}\"\n    echo 
###\n    echo Mounting $F to $D\n    mkdir -p \"$DIR\"\n    squashfuse \"$F\" 
\"$DIR\" \n    echo \"umount $DIR; rmdir $DIR\" >> $FN\ndone  \necho \"rm 
./umountsimASM\" >> $FN\n#+end_src\n\n\n\n* Introduction                        
                             :noexport:\nInvasive alien plants pose a 
significant threat to the environment and society. They are known to cause 
significant changes in species, communities and ecosystems citep:Vila2011 and 
to be responsible for major economic losses citep:Pimentel2005. Economic 
expenses are in the form of losses to provisioning services, but more 
importantly in the form of management costs, including eradication, control, 
and monitoring citep:Vila2010. This is particularly certain for strongly 
dominating plant species, since eradication is not always an option and the 
maintenance and effectiveness of control measures are largely uncertain. 
Economics are known to play an important role in clearing operations 
citep:Higgins1997a,Marais2004a.\n \n[[comment:Needs to be reworded.][For 
example, cite:Odom2005 showed that investment in managing the Scotch broom 
(/Cytisus scoparius/) is economically justified and that higher budgets yield 
higher value for the society. citep:Cacho2008 used a decision model based on 
economic analysis to identify the most appropriate management goal 
(eradication, containment or no management). Both studies coincide in 
indicating that the major factor determining the management goal is the 
available budget, with higher budgets resulting in more eradication oriented 
goals.]]\n\nBesides the overreaching importance of budget, the effectivity of 
management actions is also constrained by the characteristics of species} and 
the environment citep:Cacho2008,Krug2010_rmk and the strategy adopted for 
clearing invasive alien plants ([[comment:Ref needed][REF]]). Investment needs 
to be adjusted to the particularities of each study site and maintained over 
time to maximize the efficiency of clearing programs citep:Krug2010_rmk. The 
maintenance of management measures over time is, however, not exempt of 
nuances.  [[comment:TAlk about the problems associated with clearing the same 
site over time][TALK ABOUTTHE PROBLEMS ASSOCIATED WITH CLEARING THE SAME SITE 
OVER TIME]] The selection of the optimal clearing strategy, based on the 
characteristics of the environment and the allocation of resources over time, 
is thus crucial to provide practical guidelines for use in fiscal and policy 
decisions of IAP management. \n\nThis study builds on our previous work that 
examined the impact of different budget scenarios on the effectivity of 
clearing actions on a selected prioritization strategy citep:Krug2010_rmk, but 
instead of focusing on a single prioritization strategy we also examine the 
effect of several prioritization strategies. In particular, we aim to identify 
the optimal combination of elements –budget and clearing strategy– that ensures 
the effective management of IAPs at regional scales, while taking into account 
the particularities of invasive species and the hosting environment.\n\nIn this 
study, we use the three sites in the South Africa’s Cape Floristic Region as a 
case study (Agulhas Plains, Cape Peninsula, Outeniqua, see ref:map-All), an 
area subject to extensive control operations to reduce the expansion of woody 
IAPs that threaten the persistence of its high biological diversity. \n\n** 
#### clearpage ####                                       
:ignoreheading:\n{{{clearpage}}}\n\n\n* Methods\n\n** Study sites\nThe 
simulations for this study are based on three study sites within South Africa’s 
Cape Floristic Region: Agulhas Plain, Cape Peninsula and Outeniqua (see Fig. 
ref:map-All and Table ref:tab-All for details). All three sites contain large 
areas that are formally protected. Whereas the Cape Peninsula and Outeniqua 
regions have large areas of natural or seminatural vegetation, the Agulhas 
Plains consists of a mosaic of agricultural landscapes and conservation areas. 
All sites are invaded by IAPs, albeit by different species and to different 
degrees (see ref:tab-All for details). The most important IAP groups in the 
study sites and in the CFR overall are major woody plants, particularly species 
of /Acacia/, /Hakea/ and /Pinus/ 
citep:Richardson1986_rmka,Richardson1992_rmk,Richardson1994_rmk,Wilgen1994_rmk,Richardson2008_rmk
 [[comment:Further References needed?]]). \n\nDifferent usage and management 
pattern as well as topography of the three sites result in different fire 
patterns, e.g. with respect to the average area burned per year and the average 
number of fires per year (see supplemental material from cite:Krug2010_rmk for 
details).\n\n#+CAPTION: Study label:map-All sites in South Africa's Cape 
Floristic Region\n[[file:map-All.png]]\n\n#+ATTR_LATEX: :caption 
\\caption{Details \\label{tab-All} the study sites used in this study. $\\bpc$ 
is the budget per year per cell, $\\bpci$ is the budget per year per invaded 
cell (1ha = 1cell).} \\todo[inline]{Units in headers only or in table 
itself?}\n|                | Area    | Area invaded       | Budget       |      
2007/2008 |                  |\n|                | in ha   | in ha              
| Overall in R | $\\bpc$ in R/ha | $\\bpci$ in  R/ha 
|\n|----------------+---------+--------------------+--------------+----------------+------------------|\n|
 Agulhas Plains | 215,982 | 142,672 ( 66.1 % ) | 3,691,728    |          17.09 
|            25.88 |\n| Cape Peninsula | 49,179  | 19,226  ( 39.1 % ) | 
6,675,539    |         135.74 |           347.21 |\n| Outeniqua      | 57,697  
| 57,454  ( 99.6 % ) | 1,937,220    |          33.58 |            33.72 |\n|    
            |         |                    |              |                |    
              
|\n|----------------+---------+--------------------+--------------+----------------+------------------|\n\n\n\n**
 Model description\nTo model the spread of species under different management 
strategies, we used the spatio-temporal explicit simulation model 
{{{sc(SpreadSim)}}} ( [[comment:This needs to be added][The source code is 
available at]]  [[comment:Merge all different into one - the only difference 
should be the prioritisation file!]]). In this section, we present a short 
overview of the model, a detailed description can be found in 
cite:Krug2010_rmk. \n\nThe purpose of the model is to simulate the spread of 
three IAPs groups, namely /Acacia/, /Hakea/ and /Pinus/ citep:Krug2010_rmk, by 
incorporating spatial population dynamics (seed production, seed dispersal, 
germination and establishment), fire dynamics and the clearing of IAPs based on 
a certain prioritization strategy, the costs of clearing actions and the budget 
available per year. The aim is to assess the effectiveness of different 
clearing strategies and budget scenarios over time. \n\nThe model 
{{{sc(SpreadSim)}}} was written in R citep:R2008_rmk, (with additional packages 
by 
cite:Pebesma2005_rmk,Petzoldt2007_rmk,Bivand2009_rmk,James2009_rmk,Keitt2009_rmk,Lewin-Koh2009_rmk,Urbanek_rmk)
 and uses GRASS citep:GRASS2007 for the storage of the spatial results and 
spatial calculations. It can be separated into five different modules, namely 
{{{sc(clearing)}}}, {{{sc(fire)}}}, {{{sc(seedProduction)}}}, 
{{{sc(seedDispersal)}}} and {{{sc(germEst)}}}, which are executed consecutively 
(see Figure ref:fig-Model for the flowchart of the model). Each module contains 
parameter controlling the stochastic spread and management of IAPs of the 
genera /Acacia/, /Hakea/ and /Pinus/ citep:Krug2010_rmk.  \n\nDue to the 
stochastic nature of the model, each *simulation* (defined by the =site=, 
prioritization =strategy= and =budget=) was repeated five times. For further 
analysis, we defined a *simulation set* as different =budget= scenarios for the 
same =site= and clearing =strategy=.\n\nThe input data for the simulations was 
provided by the relevant nature conservation agencies and Working for Water 
(see cite:Roura-Pascual2009_rmkb,Roura-Pascual2009_rmkc for details 
[[comment:REF for topography and natural vegetation data  needed? I don't think 
so, as referred to the papers)]]. \n\nSimulations were done on a raster with a 
resolution of $100m \\times 100m$ cells and with a time step of one year.  
\n\n#+ATTR_LATEX: :caption \\caption{\\label{fig-Model} from 
\\protect\\cite{Krug2010_rmk}} \\todo[inline]{If we need this here, I will redo 
it - just let me know.}\n{{{if-latex-else([[file:fig-Model.pdf]], 
[[file:fig-Model.png]])}}}\n\n\n** Prioritization =strategy=\n\nThe 
prioritization =strategy= assigns each individual cell a priority value for 
clearing of the IAPs out of these cells. Subsequently, cells are cleared in 
descending order of their priority until the budget is spend (see 
cite:Krug2010_rmk). \n\nThe strategies are based on weights and consider the 
following factors:\n\n- Area burnt recently\n- Density of IAPs\n- Spread based 
on topography\n- Area at fire risk\n- Age of IAPs\n- Identity of IAPs\n- Last 
clearing operation\n\nFor a detailed description of these factors and how they 
were derived, see citep:Roura-Pascual2009_rmkb,Roura-Pascual2009_rmkc. \n\nThe 
prioritization strategies evaluated in this study are (Fig. 
ref:fig-Strategies):\n\n- =consensus= :: this strategy was developed through a 
participatory process with managers and researchers experts on various aspects 
of IAPs citep:Roura-Pascual2009_rmkb. This resulted in priority was given to 
areas burnt recently and the density of the IAPs was reduced 
citep:Roura-Pascual2009_rmkc. The following =strategies= are based on the 
=consensus strategy= and were modified based on certain aims.\n- =maintain 
follow-ups= :: (aka =past=) aims at prioritizing areas based on previous 
clearing operations, i.e. giving higher priority to areas which have been 
cleared already or in follow-ups. It relies on accurate information of fire and 
clearing history of the site citep:Roura-Pascual2009_rmkc;\n- =keep clean= :: 
(aka =present=) is a strategy where management operations do not rely on fire 
opportunities to clear invaded stands and the potential of a stand to be a 
major source of invasion is minimized. It relies on accurate information of the 
present, i.e. present density of the IAPs and spread potential based on 
topography citep:Roura-Pascual2009_rmkc;\n- =water production= :: (aka 
=future=)is orientated towards increasing water production in the future, with 
higher priority given to riparian areas in lower parts of the catchment invaded 
by dense stands of /Acacia/ species. It uses mainly static information, i.e. 
spread based on topography citep:Roura-Pascual2009_rmkc;\n- =random= :: is a 
null-strategy which does not require any knowledge about the past and randomly 
assigns priorities citep:Krug2010_rmk.\n\nA visualization of these 
prioritization strategies can be seen in Fig. 
ref:fig-Strategies.\n\n#+ATTR_LATEX: :caption \\caption{\\label{fig-Strategies} 
from \\protect\\cite{Roura-Pascual2009_rmkc}} \\todo[inline]{This figure needs 
to be redone and further info 
added}\n{{{if-latex-else([[file:fig-Strategies.pdf]], 
[[file:fig-Strategies.png]])}}}\n\n** Budget\nThe budget as well as the costs 
used in this study are based on the actual budget for the three areas of the 
financial year 2007/2008. They are specified in South African Rand (R) as 
$\\boldmath\\bpc$ (IAP clearing budget per year per cell) and  
$\\boldmath\\bpci$ (IAP clearing budget per year per invaded cell).\n\nThe 
actual budgets were multiplied with a factor ranging from 0.1 to 6.0 to obtain 
14 to 15 different budget scenarios for each simulation set defined by a =site= 
and a =strategy= (see Figure ref:fig-Budgets and Table ref:tab-Budgets in the 
Appendix for values from cite:Krug2010_rmk).\n\nThe budgets and the factors 
used for the three sites are[[comment:We could leave the factors out here but I 
think it is a useful addition. All information also also in the table in the 
Appendix]]:\n\n|                   budget | Agulhas   | CapePeninsula | 
Outeniqua |\n|                   factor |           |               |           
|\n|--------------------------+-----------+---------------+-----------|\n| 
$\\bpc$  $\\frac{R}{cell}$ | 17.09     | 135.05        | 33.58     |\n|         
         $\\bpci$ | 25.88     | 347.21        | 33.72     
|\n|--------------------------+-----------+---------------+-----------|\n|      
                0.1 | C M K W - | C M K W R     | C M K W R |\n|                
      0.2 |           | - - - - R     | - - - - R |\n|                      0.3 
|           | - - - - R     | - - - - R |\n|                      0.4 |         
  | - - - - R     | - - - - R |\n|                      0.5 | - - - - R | C M K 
W R     | C M K W R |\n|                      0.6 |           | - - - - R     | 
- - - - R |\n|                      0.7 |           | C M K W R     | - - - - R 
|\n|                      0.8 |           | - - - - R     | - - - - R |\n|      
                0.9 |           | - - - - R     | - - - - R |\n|                
       1. | - - - - R | C M K W R     | - - - - R |\n|                      1.1 
|           |               |           |\n|                      1.2 | - - - - 
R |               |           |\n|                      1.3 |           | - - - 
- R     | C M K W R |\n|                      1.4 |           |               | 
          |\n|                      1.5 | - - - - R | C M K W R     | C M K W R 
|\n|                      1.6 |           |               |           |\n|      
                1.7 | - - - - R | - - - - R     |           |\n|                
      1.8 |           |               |           |\n|                      1.9 
|           |               |           |\n|                       2. | - - - - 
R | - - - - R     | C M K W R |\n|                      2.2 | - - - - R |       
        |           |\n|                      2.5 | C M K W R |               | 
          |\n|                       3. | - - - - R |               |           
|\n|                      3.5 | - - - - R |               |           |\n|      
                 4. | - - - - R |               |           |\n|                
      4.5 | - - - - R |               |           |\n|                       5. 
| C M K W R |               |           |\n|                      5.5 | C M K W 
R |               |           |\n|                       6. | C M K W R |       
        |           |\n\n\n- Agulhas Plains :: $\\bpc =$ 17.09 R/cell, $\\bpci 
=$ 25.88 R/cell\n  - Consensus, Maintain Follow Ups, Keep clean, Water 
production :: 0.1; 2.5; 5.0; 5.5; 6.0\n  - Random :: 0.5; 1.0; 1.2; 1.5; 1.7; 
2.0; 2.2; 2.5; 3.0; 3.5; 4.0; 4.5; 5.0; 5.5; 6.0; 6.5; 7.0\n- CapePeninsula :: 
$\\bpc =$ 135.047 R/cell, $\\bpci =$ 347.21R/cell\n  - Consensus, Maintain 
Follow Ups, Keep clean, Water production :: 0.1; 0.5; 0.7; 1.0; 1.5\n  - Random 
:: 0.1; 0.2; 0.3; 0.4; 0.5; 0.6; 0.7; 0.8; 0.9; 1.0; 1.3; 1.5; 1.7; 2.0\n- 
Outeniqua :: $\\bpc =$ 33.58R/cell, $\\bpci =$ 33.72R/cell\n  - Consensus, 
Maintain Follow Ups, Keep clean, Water production :: 0.1; 0.5; 1.3; 1.5; 2.0\n  
- Random :: 0.1; 0.2; 0.3; 0.4; 0.5; 0.6; 0.7; 0.8; 0.9; 1.0; 1.3; 1.5; 1.7; 
2.0\n\n#+CAPTION: Different label:fig-Budgets budgets of the different sites in 
comparison. Colours indicate different sites, pattern indicate if the budget is 
\"per all cells\" or \"per invaded 
cells\"\n{{{if-latex-else([[file:fig-Budgets.pdf]], 
[[file:fig-Budgets.png]])}}}\n\n** TODO Analysis\nThe analysis follows the 
analysis done in cite:Krug2010_rmk and uses very similar measures and 
indicators to assess the efficiency of the different strategies. We therefore 
calculated for each individual =simulation= run (i.e. five per 
=simulation=)\n\n# - $\\cua$ :: number of cells covered by IAPs per year, where 
*covered* is defined as $dc \\leq 1$ i.e. *rare* or less\n- $\\cov$ :: as the 
proportion of the cells covered by aliens in year $t$\n     (i.e. all cells for 
which the density class of aliens is higher\n     than *rare*). $\\cov = 0$ 
indicates no alien infestation and $\\cov\n     = 1$ indicates complete cover 
of IAPs. (From cite:Krug2010_rmk) \n# - $\\ac$ :: number of cells cleared of 
IAPs in year $t$\n\nTo assess the effectiveness of the =simulation= run, we 
defined a\n- management goal :: as to be having 95% of the area (cells) alien 
free (density class of aliens smaller or equal *rare*), i.e. $\\cov \\leq 
0.95$\nwhere each individual simulation run is regarded as successful after 
reaching the *management goal*.\n\nIf the *management goal* was reached, we 
calculated for each =simulation= run\n- $\\tmg$ :: as the time when we reached 
the management goal\n- $\\bmg$ :: as the cumulative budget needed to achieve 
the management goal\n\nFor each =simulation= (i.e. over the five simulation 
runs) we then calculated\n+ $\\pmg$ :: proportions of all the runs (here five 
simulation runs) in one =simulation= which reached the *management goal*\n\nTo 
accumulate over each =simulation set=, i.e. one =site= and one =strategy= and 
multiple =budget=s, we calculated\n- $\\bc$ :: the *critical budget* is the 
lowest budget at which more than 50% of all simulations resulted in achieving 
the *management goal* of 95% alien free within the time-frame of 30 years,\n- 
$\\bci$ :: as $\\bc$ but the using $\\bpci$ instead of $\\bpc$\n\n# Finally, we 
calculated for each set of =site= and =strategy= a\n# - budget index :: 
$\\bm{\\idb} = \\frac{\\bpc}{\\bc}$\n# - time index :: $\\bm{\\idt} = 
\\frac{\\tmg(\\bc)-1}{\\mathit{mean}\\left(\\tmg(\\bc)-1\\right)}$ [[comment:I 
have to confess I am not sure what I did here!]]\n\n# The variables used to 
evaluate the efficiency of the clearing operations under different 
prioritization strategies and budgetary scenarios were: area covered by IAPs 
per year, IAP clearing budget per year, and area cleared of IAPs per year. The 
proportion of the site covered by aliens in year t, i.e. all cells for which 
the density class of aliens is higher than ‘‘rare’’, is called cov(t). cov(t) = 
0 indicates no alien infestation and cov(t) = 1 indicates complete cover of 
IAPs.\n\n# We set our ‘‘management goal’’ arbitrarily at clearing 95% (and for 
some scenarios 90%) of the area of IAPs. This ‘‘management goal’’ represents 
the threshold cover, below which the management is considered as being 
successful. An eradication of all IAPs would be ideal, but would require much 
higher resources.\n \n# If during the simulation the cover of IAPs was reduced 
below the ‘‘management goal’’, we determined the year in which it occurred 
(tnf95) and the cumulative costs per cell up to tnf95 (BPC 95). Note that BPC 
95 <= bPC·tnf95 as the whole budget might not be spent. The lowest budget at 
which more than 50% of all simulations resulted in a reduction of the alien 
cover to less than 5% within the time-frame of 30 years, was called the 
‘‘critical budget’’ (bPC relating to bPC and bPCINV relating to bPCINV). Each 
budget scenario was simulated five times.\n\n# In addition, we calculated a 
budget index and a time index for each species separately. The budget index was 
calculated by dividing the actual budget bPC by the critical budget ^ bPC. 
Consequently, the budget index was one for the critical budget. The time index 
was calculated as follow:\n\n# ??ADD FORMULA??\n\n# By subtracting one from 
tnf95 we achieved that the lowest value of the index is zero, while 1 
represents the average tnf95ð ^ bPCÞ.\n\n** #### clearpage ####                 
                      :ignoreheading:\n{{{clearpage}}}\n\n\n\n\n#  LocalWords:  
IAPs\n\n* TODO [2/6] Make Analysis and Graphs                              
:noexport:\n:PROPERTIES:\n:COOKIE_DATA: todo recursive\n:header-args+: :eval 
no-export\n:END:\n** DONE Budget graph fig-budgets\n\n\n#+NAME: tabBudgets\n| 
budget | Agulhas |            | CapePeninsula |            | Outeniqua |        
    |\n| factor |  R/Cell | R/Cell_inv |        R/Cell | R/Cell_inv |    R/Cell 
| R/Cell_inv 
|\n|--------+---------+------------+---------------+------------+-----------+------------|\n|
    0.1 |   1.709 |      2.588 |        13.504 |     34.721 |     3.358 |      
3.372 |\n|    0.2 |         |            |        27.008 |     69.442 |     
6.716 |      6.744 |\n|    0.3 |         |            |        40.512 |    
104.163 |    10.074 |     10.116 |\n|    0.4 |         |            |        
54.016 |    138.884 |    13.432 |     13.488 |\n|    0.5 |         |            
|         67.52 |    173.605 |     16.79 |      16.86 |\n|    0.6 |         |   
         |        81.024 |    208.326 |    20.148 |     20.232 |\n|    0.7 |    
     |            |        94.528 |    243.047 |    23.506 |     23.604 |\n|    
0.8 |         |            |       108.032 |    277.768 |    26.864 |     
26.976 |\n|    0.9 |         |            |       121.536 |    312.489 |    
30.222 |     30.348 |\n|     1. |   17.09 |      25.88 |        135.04 |     
347.21 |     33.58 |      33.72 |\n|    1.1 |         |            |            
   |            |           |            |\n|    1.2 |  20.508 |     31.056 |   
            |            |           |            |\n|    1.3 |         |       
     |       175.552 |    451.373 |    43.654 |     43.836 |\n|    1.4 |        
 |            |               |            |           |            |\n|    1.5 
|  25.635 |      38.82 |        202.56 |    520.815 |     50.37 |      50.58 
|\n|    1.6 |         |            |               |            |           |   
         |\n|    1.7 |  29.053 |     43.996 |       229.568 |    590.257 |    
57.086 |     57.324 |\n|    1.8 |         |            |               |        
    |           |            |\n|    1.9 |         |            |               
|            |           |            |\n|     2. |   34.18 |      51.76 |      
  270.08 |     694.42 |     67.16 |      67.44 |\n|    2.2 |  37.598 |     
56.936 |               |            |           |            |\n|    2.5 |  
42.725 |       64.7 |               |            |           |            |\n|  
   3. |   51.27 |      77.64 |               |            |           |         
   |\n|    3.5 |  59.815 |      90.58 |               |            |           
|            |\n|     4. |   68.36 |     103.52 |               |            |  
         |            |\n|    4.5 |  76.905 |     116.46 |               |      
      |           |            |\n|     5. |   85.45 |      129.4 |             
  |            |           |            |\n|    5.5 |  93.995 |     142.34 |    
           |            |           |            |\n|     6. |  102.54 |     
155.28 |               |            |           |            |\n\n\n#+NAME: 
fig-Budgets\n#+begin_src R :var BUDGET=tabBudgets  :exports results :file-ext 
pdf :results graphics :width 7 :height 7\n<<initR>>\nlibrary(magrittr)\nx <- 
BUDGET\nx <- BUDGET %>%\n    extract(-(1:2),) %>%\n    set_names(\n        c(\n 
           \"f\",\n            \"Agulhas\", \"Agulhas_I\",\n            
\"CapePeninsula\", \"CapePeninsula_I\",\n            \"Outeniqua\", 
\"Outeniqua_I\"\n        )\n    )\n\n##\nfor (i in 1:length(x)) {\n    x[[i]] 
<-  as.numeric(x[[i]])\n}\n\n##\nx %<>%\n    extract(-1) %>%\n    unlist %>%\n  
  extract(!is.na(.)) %>%\n    sort(decreasing = TRUE)\n\n##\nAG_I <- x %>%\n    
names %>%\n    grep(\"Agulhas_I\", .)\nAG <- x %>%\n    names %>%\n    
grep(\"Agulhas[1-9]\", .)\n##\nCP_I <- x %>%\n    names %>%\n    
grep(\"CapePeninsula_I\", .)\nCP <- x %>%\n    names %>%\n    
grep(\"CapePeninsula[1-9]\", .)\n##\nOU_I <- x %>%\n    names %>%\n    
grep(\"Outeniqua_I\", .)\nOU <- x %>%\n    names %>%\n    
grep(\"Outeniqua[1-9]\", .)\n\n##\ncols <- rep(\"black\", 
length(x))\ncols[c(AG, AG_I)] <- \"green\"\ncols[c(CP, CP_I)] <- 
\"red\"\ncols[c(OU, OU_I)] <- \"blue\"\n\n##\ndens <- rep(-1, 
length(x))\ndens[c(AG_I, CP_I, OU_I)] <- 30\n\n##\npar(\n    mar = c(4.1, 0.3, 
0.1, 0.8)\n)\nbarplot(\n    x,\n    xlab = \"Budget per cell\",\n    xlim = 
c(0, 700),\n    names.arg = \"\",\n    horiz = TRUE,\n    col = cols,\n    
density = dens\n)\nsiteNames <- c(\"Agulhas Plains\", \"Cape Peninsula\", 
\"Outeniqua\")\nlegend(\n    x = \"topright\",\n    legend  = c( siteNames, 
\"\", \"per all cells\", \"per invaded cells\"),\n    fill    = c(\"green\", 
\"red\", \"blue\", NA, \"black\", \"black\"),\n    border  = c(\"black\", 
\"black\", \"black\", NA, \"black\", \"black\"),\n    density = c(-1, -1, -1, 
NA, -1, 30)\n)\n#+end_src\n\n#+RESULTS: 
fig-Budgets\n[[file:fig-Budgets.pdf]]\n\n\n** DONE Calculate dc\n#+begin_src R 
:results output :tangle 
./package/ASMOptimPaper/inst/scripts/analysis.calculate.dc.R :eval never 
\n<<initR>>\ndc <- getDc( new = TRUE, cores = 6 
)\n#+end_src\n\n#+RESULTS:\n#+begin_example\nLoading ASMOptimPaper\nLoading 
required package: sp\nLoading required package: raster\nLoading required 
package: rgrass7\nLoading required package: XML\nGRASS GIS interface loaded 
with GRASS version: (GRASS not running)\nLoading required package: 
magrittr\n\nAttaching package: ‘magrittr’\n\nThe following object is masked 
from ‘package:raster’:\n\n    extract\n\nLoading required package: 
parallel\ngisdbase    ./inputdata \nlocation    simASM \nmapset      
grassAnalysis \nrows        210 \ncolumns     790 \nnorth       6263000 \nsouth 
      6242000 \nwest        574000 \neast        653000 \nnsres       100 
\newres       100 \nprojection  +proj=utm +south +zone=34 +a=6378137 
+rf=298.257223563 +no_defs\n+towgs84=0.000,0.000,0.000 
+to_meter=1.0\n#+end_example\n\n** TODO Examples of some simulations            
                  :noexport:\n#+begin_src R \nua <- getUaWide(site = 
\"Agulhas\", strategy=\"Consensus\", species = \"all\")\n\ndcs <- split(\n    
dc, dc$run\n)\nmatplot(x = dc$year, dc[as.character(1:7)])\nua <- 
rowSums(dc[as.character(1:7)])\n\nplot(ua)\n\nua <- getUa(site = \"Agulhas\", 
budget=\"None\", species = \"all\", 
proportion=TRUE)\nplot(ua$cl)\nb\n#+end_src\n** CHECK Figures --- =simulation 
sets= by site\n:PROPERTIES:\n:header-args+: :epilogue rm(ST, 
SI)\n:END:\n\n:CODESNIPPETS:\n#+NAME: plotScenarios\n#+begin_src R :eval 
never\n<<initR>>\npar(\n    mfcol = c(length(STRATEGIES)-1, 1),\n    mar   = 
c(1.2, 4.1, 1.1, 0.1),\n    cex   = 0.7\n)\nfor (i in 1:(length(STRATEGIES)-1)) 
{\n    if (i == length(STRATEGIES)-1) {\n        par(\n            mar   = 
c(4.2, 4.1, 1.1, 0.1)\n        )        \n    }\n    plotScenario( site = SI, 
strategy = STRATEGIES[i])\n}\n#+end_src\n:END:\n\n#+NAME: 
fig-ScenAgulhas\n#+HEADER: :var SI=\"Agulhas\"\n#+begin_src R :exports results 
:file-ext pdf :results graphics :width 7 :height 
7\n<<plotScenarios>>\n#+end_src\n\n#+RESULTS: 
fig-ScenAgulhas\n[[file:fig-ScenAgulhas.pdf]]\n\n\n#+NAME: 
fig-ScenCapePeninsula\n#+HEADER: :var SI=\"CapePeninsula\"\n#+begin_src R 
:exports results :file-ext pdf :results graphics :width 7 :height 
7\n<<plotScenarios>>\n#+end_src\n\n#+RESULTS: 
fig-ScenCapePeninsula\n[[file:fig-ScenCapePeninsula.pdf]]\n\n\n#+NAME: 
fig-ScenOuteniqua\n#+HEADER: :var SI=\"Outeniqua\"\n#+begin_src R :exports 
results :file-ext pdf :results graphics :width 7 :height 
7\n<<plotScenarios>>\n#+end_src\n\n\n#+RESULTS: 
fig-ScenOuteniqua\n[[file:fig-ScenOuteniqua.pdf]]\n\n{{{clearpage}}}\n\n** 
CHECK Figures --- Proportion reaching Management Goal\n#+NAME: 
fig-CritBudProp\n#+begin_src R :exports results :file-ext pdf :results graphics 
:width 7 :height 7\n<<initR>>\npar(\n    mfcol = c(length(SITES), 1),\n    mar  
 = c(1.2, 4.1, 1.1, 0.1),\n    cex   = 0.7\n)\nfor (i in 1:length(SITES)) {\n   
 if (i == length(SITES)) {\n        par(\n            mar   = c(4.2, 4.1, 1.1, 
0.1)\n        )        \n    }\n    plotCritBud( \n        site = SITES[i],\n   
     ylab = \"Prop Man. Goal\",\n        dx = 0.6,\n        xlim = c(0, 150)\n  
  )\n}\n#+end_src\n\n#+RESULTS: 
fig-CritBudProp\n[[file:fig-CritBudProp.pdf]]\n\n** CHECK Plot of Critical 
Budgets[[ comment:Here is something not right and needs to be checked. It could 
be the functions?]] :noexport:\n#+NAME: fig-BcOverview\n#+begin_src R :exports 
results :file-ext pdf :results graphics :width 7 :height 4.5\n<<initR>>\ncb <- 
getCriticalBudget(species = \"all\")\n\n\nplot(\n    bc$budgetPerCell ~ 
bc$tmg.mean,\n    xlab = \"mean time until management goal is achieved at 
critical budget\",\n    ylab = \"critical budget ber cell\",\n    cex = 1,\n    
col = as.factor(bc$strategy),\n    pch = 
as.integer(as.factor(bc$site))\n)\n\nsite <- unique(bc$site)\nstrategy <- 
unique(bc$strategy)\nlegend(\n    \"bottomright\",\n    legend = c(\n        
site,\n        \"\",\n        strategy\n    ),\n    pch = c(\n        
as.integer(as.factor(site)),\n        1,\n        rep(15, length(strategy))\n   
 ),\n    col = c(\n        rep(\"black\", length(site)),\n        \"white\",\n  
      as.factor(strategy)\n    )\n)\n\npar(op)\n#+end_src\n\n#+RESULTS: 
fig-BcOverview\n[[file:fig-BcOverview.pdf]]\n\n* Results\n** =simulation sets= 
by Site\n\n#+CAPTION: Proportion label:fig-ScenAgulhas of cells under aliens 
for the different strategies at *Agulhas Plains*. Horizontal line at y = 0.05 
indicates the management 
target.\n{{{if-latex-else([[file:fig-ScenAgulhas.pdf]], 
[[file:fig-ScenAgulhas.png]])}}}\n\n#+CAPTION: Proportion 
label:fig-ScenCapePeninsula of cells under aliens for the different strategies 
at *Cape Peninsula*. Horizontal line at y = 0.05 indicates the management 
target.\n{{{if-latex-else([[file:fig-ScenCapePeninsula.pdf]], 
[[file:fig-ScenCapePeninsula.png]])}}}\n\n#+CAPTION: Proportion 
label:fig-ScenOuteniqua of cells under aliens for the different strategies at 
*Outeniqua*. Horizontal line at y = 0.05 indicates the management 
target.\n{{{if-latex-else([[file:fig-ScenOuteniqua.pdf]], 
[[file:fig-ScenOuteniqua.png]])}}}\n\n*** #### clearpage ####                   
                  :ignoreheading:\n{{{clearpage}}}\n\n** Proportion reaching 
Management Goal\n#+CAPTION: label:fig-CritBudProp  Proportion of five 
simulation runs which reached the Management Goal. Colors depict different 
sites. Horizontal line at y = 0.05 indicates the critical budget 
$\\bc$\n{{{if-latex-else([[file:fig-CritBudProp.pdf]], 
[[file:fig-CritBudProp.pdf]])}}}\n\n*** #### clearpage ####                     
                :ignoreheading:\n{{{clearpage}}}\n\n* Discussion\n- Based on 
Figure ref:fig-CritBudProp, it is clear that the choice of\n  strategy is 
heavily site dependent. E.g. for Cape Peninsula, it\n  really doesn't matter 
what strategy is used - just go in and clear\n  what you see. While in the case 
of Agulhas Plains and Outeniqua, there are\n  considerable differences with for 
Agulhas Plains =Future= and =Random=\n  being the worst, this is not true for 
Outeniqua, where =Future= and\n  =Consensus= is the worst.\n\n- No clear 
pattern which one is better - heavily site dependent\n\n- Random is not 
necessarily the worst - sometimes better than wrong choice\n\n- ???\n\n* 
Acknowledgements\n* References\nbibliographystyle:plainnat\n# <<bibliography 
link>>\nbibliography:asmOptim.bib\n\n \n* Appendix\n\\appendix\n* 
Simulations\nSimulations are differentiated by their =site=, =strategy= 
and\n=budget= (see Table ref:tab-simulations for the 
different\ncombinations).\n\n#+CAPTION: Parameter label:tab-simulations sets 
used forthe different simulations.\n| =site=        | =strategy= | =budget=   
|\n|---------------+------------+------------|\n|               | Consensus  | 
depends    |\n| Agulhas       | Future     | on         |\n| CapePeninsula | 
Past       | =site=     |\n| Outeniqua     | Present    | and        |\n|       
        | Random     | =strategy= |\n|               |            |            
|\n|---------------+------------+------------|\n\n* Budget\n#+CAPTION: 
label:tab-Budgets Different budget factors and their actual values per cell.\n| 
budget | Agulhas |            | CapePeninsula |            | Outeniqua |        
    |\n| factor |  R/Cell | R/Cell_inv |        R/Cell | R/Cell_inv |    R/Cell 
| R/Cell_inv 
|\n|--------+---------+------------+---------------+------------+-----------+------------|\n|
    0.1 |   1.709 |      2.588 |        13.504 |     34.721 |     3.358 |      
3.372 |\n|    0.2 |         |            |        27.008 |     69.442 |     
6.716 |      6.744 |\n|    0.3 |         |            |        40.512 |    
104.163 |    10.074 |     10.116 |\n|    0.4 |         |            |        
54.016 |    138.884 |    13.432 |     13.488 |\n|    0.5 |         |            
|         67.52 |    173.605 |     16.79 |      16.86 |\n|    0.6 |         |   
         |        81.024 |    208.326 |    20.148 |     20.232 |\n|    0.7 |    
     |            |        94.528 |    243.047 |    23.506 |     23.604 |\n|    
0.8 |         |            |       108.032 |    277.768 |    26.864 |     
26.976 |\n|    0.9 |         |            |       121.536 |    312.489 |    
30.222 |     30.348 |\n|     1. |   17.09 |      25.88 |        135.04 |     
347.21 |     33.58 |      33.72 |\n|    1.1 |         |            |            
   |            |           |            |\n|    1.2 |  20.508 |     31.056 |   
            |            |           |            |\n|    1.3 |         |       
     |       175.552 |    451.373 |    43.654 |     43.836 |\n|    1.4 |        
 |            |               |            |           |            |\n|    1.5 
|  25.635 |      38.82 |        202.56 |    520.815 |     50.37 |      50.58 
|\n|    1.6 |         |            |               |            |           |   
         |\n|    1.7 |  29.053 |     43.996 |       229.568 |    590.257 |    
57.086 |     57.324 |\n|    1.8 |         |            |               |        
    |           |            |\n|    1.9 |         |            |               
|            |           |            |\n|     2. |   34.18 |      51.76 |      
  270.08 |     694.42 |     67.16 |      67.44 |\n|    2.2 |  37.598 |     
56.936 |               |            |           |            |\n|    2.5 |  
42.725 |       64.7 |               |            |           |            |\n|  
   3. |   51.27 |      77.64 |               |            |           |         
   |\n|    3.5 |  59.815 |      90.58 |               |            |           
|            |\n|     4. |   68.36 |     103.52 |               |            |  
         |            |\n|    4.5 |  76.905 |     116.46 |               |      
      |           |            |\n|     5. |   85.45 |      129.4 |             
  |            |           |            |\n|    5.5 |  93.995 |     142.34 |    
           |            |           |            |\n|     6. |  102.54 |     
155.28 |               |            |           |            |\n\n\n* Figures 
and tables for pandoc\n\n{{{pandoc(\\\\section*{List of 
Figures})}}}\n\n\n{{{pandoc(FiguresHere\\\\par)}}}\n\n{{{pandoc(\\\\section*{List
 of Tables})}}}\n\n\n{{{pandoc(TablesHere\\\\par)}}}\n\n\n* Some initial plots 
of histograms                                 :noexport:\n\n#+begin_src R 
\n<<initR>>\n\nsim <- getDir(\n    type = \"csv\",\n    site = 
\"CapePeninsula\",\n    strategy = \"Consensus\",\n    budget   = 
\"CapePeninsula_1_0\",\n    run = 1)\n\nh <- read.csv(file.path(sim, 
\"all_dc_hist.csv\"))\n#+end_src\n\n#+RESULTS:\n\n* Results from Simulations    
                                     :noexport:\n** Directory structure         
                                   :noexport:\n*** 
Example\n#+begin_example\n./inputdata/csv/ASM_Optimization/\n└── Simulations\n  
  ├── Agulhas\n    │   └── simASM\n    │       ├── Consensus\n    │       │   
├── Agulhas_0_1\n    │       │   │   └── Agulhas\n    │       │   │       ├── 
47835.1\n    │       │   │       ├── 47835.2\n    │       │   │       ├── 
47835.3\n    │       │   │       ├── 47835.4\n    │       │   │       └── 
47835.5\n    │       │   ├── Agulhas_2_5\n    │       │   │   └── ...\n    │    
   │   ├── Agulhas_5_0\n    │       │   │   └── ...\n    │       │   ├── 
Agulhas_5_5\n    │       │   │   └── ...\n    │       │   └── Agulhas_6_0 \n    
│       │       └── ...\n    │       ├── Future\n    │       ├── Past ...\n    
│       └── Present ...\n    ├── CapePeninsula ...\n    ├── Outeniqua ...\n    
└── 
log\n#+end_example\n\n./inputdata/*csv*/SITE/simASM/STRATEGY/BUDGET/FIRE/RUN\n\n***
 R functions\nsee package ASMOptimPaper for the functions used in the analysis. 
\n\n** GRASS simASM input data\n*** Mapset name structure\nThe 
[[file:inputdata/simASM/][GRASS location]] contains the following mapsets:\n- 
[[file:inputdata/simASM/PERMANENT/][PERMANENT]] mapset - read-only :: which 
contains the South Africa wide data used in the simulations\n- 
[[file:inputdata/simASM/grassAnalysis/][grassAnalysis]] - read-write :: which 
can be used for analysis\n- 
[[file:inputdata/simASM/simASM.Outeniqua.Random.Outeniqua_2_0.Outeniqua.41719.5/][simulations]]
 :: about 530 mapsets whose names are build as follow:\n\n     
{{{if-latex-else(simASM.\\\\texttt{SITE}.\\\\texttt{STRATEGY}.\\\\texttt{BUDGET}.\\\\texttt{FIREREGIME}.\\\\texttt{JOBID}.\\\\texttt{ARRAYID},
 simASM . =SITE= . =STRATEGY= . =BUDGET= . =FIREREGIME= . =JOBID= . 
=ARRAYID=)}}}\n     #+CAPTION: Simulations conducted and combination of 
different parameter values. =f= is the factor which, multiplied with the yearly 
original budget of year 2006 [[comment:Check!]] becomes the initial budget of 
the simulation. The factor f is written with underscore ({{{us}}}) instead of 
the decimal point (e.g. 1.5 becomes 1{{{us}}}1).\n     | =SITE=        | 
=STRATEGY= | =BUDGET=               | =FIREREGIME= | =JOBID= | =ARRAYID= |\n    
 
|---------------+------------+------------------------+--------------+---------+-----------|\n
     |               | Consensus  |                        |              |     
    |         1 |\n     | Agulhas       | Future     | =SITE= {{{us}}}f       | 
             |         |         2 |\n     | CapePeninsula | Past       |       
                 | =SITE=       | number  |         3 |\n     | Outeniqua     | 
Present    | none                   |              |         |         4 |\n    
 |               | Random     |                        |              |         
|         5 |\n     
|---------------+------------+------------------------+--------------+---------+-----------|\n\n***
 Map name structure in the =simulation= mapsets\nUsing 
=simASM.CapePeninsula.Random.CapePeninsula_1_0.CapePeninsula.xxx.5= as an 
exapmle.\n**** Static data\n#+begin_src R :colnames yes :exports 
results\n<<initR>>\nx <- getMapNames(\n    site     = \"CapePeninsula\",\n    
strategy = \"Random\",\n    budget   = \"CapePeninsula_1_0\",\n    run      = 
5,\n    type     = \"raster\",\n    pattern  = \"*\",\n    fullMapNames = 
FALSE\n) %>%\n    strsplit(split=\"_\") %>%\n    subset(sapply(., 
FUN=\"length\") == 1) %>%\n    sapply(FUN=\"[[\", 1) %>%\n    unique()\nx <- 
c(x, \"SPECIES\\{{{us}}}suitability\")\ndata.frame(\"names\" = 
x)\n#+end_src\n\n#+RESULTS:\n| names                               
|\n|-------------------------------------|\n| MASK                              
  |\n| NBALs                               |\n| TPI                             
    |\n| ignitionRisk                        |\n| region                        
      |\n| vegetationID                        |\n| vegetationStatus            
        |\n| SPECIES{{{us}}}suitability |\n\n**** Dynamic, i.e. over time 
changing, raster maps\nThe maps have the following naming structure:\n\n# 
=SPECIES= {{{us}}} =TYPE= {{{us}}} 
=YEAR=\n\n\\texttt{SPECIES}{{{us}}}\\texttt{TYPE}{{{us}}}\\texttt{YEAR}\n\n\nBlocks
 of combinations are separated by ------ and all combinations are available for 
all =YEAR=\n\n#+begin_src R :colnames yes :exports results\n<<initR>>\nx <- 
getMapNames(\n    site     = \"CapePeninsula\",\n    strategy = \"Random\",\n   
 budget   = \"CapePeninsula_1_0\",\n    run      = 5,\n    type     = 
\"raster\",\n    pattern  = \"*\",\n    fullMapNames = FALSE\n) %>%\n    
strsplit(split=\"_\") %>%\n    subset(sapply(., FUN=\"length\") == 3) %>%\n    
data.frame(stringsAsFactors = FALSE) %>%\n    t() %>%\n    
data.frame(stringsAsFactors = FALSE)\n##\nrownames(x) <- NULL\n\n##\nSP <- x$X1 
%in% c(\"ACyclops\", \"HSericea\", \"PPinaster\")\nALL <- x$X1 %in% 
\"all\"\nOTHER <- !SP & !ALL\n\n##\nxsp <- x[SP,] %>%\n    
lapply(unique)\nyears <- sort(xsp[[3]])\nmn <- max(sapply (xsp[-3], 
length))\nxsp <- lapply(\n    xsp[-3],\n    function(y) {\n        y <- 
c(sort(y), rep(\"\", mn - length(y)))\n    }\n)\n\n##\nxall <- x[ALL,] %>%\n    
lapply(unique)\nmn <- max(sapply (xall[-3], length))\nxall <- lapply(\n    
xall[-3],\n    function(y) {\n        y <- c(sort(y), rep(\"\", mn - 
length(y)))\n    }\n)\n\n##\nxother <- x[OTHER,] %>%\n    lapply(unique)\nmn <- 
max(sapply (xother[-3], length))\nxother <- lapply(\n    xother[-3],\n    
function(y) {\n        y <- c(sort(y), rep(\"\", mn - length(y)))\n    
}\n)\n\n##\n\nx <- list(\n    SPECIES = c( xsp$X1, \"------------\", xall$X1, 
\"------------\", xother$X1),\n    TYPE    = c( xsp$X2, 
\"--------------------\", xall$X2, \"--------------------\", 
xother$X2)\n)\nx$YEAR <- c(years, rep(\"\", 
length(x$SPECIES)-length(years)))\ndata.frame(x)\n#+end_src\n\n#+CAPTION: Names 
label:tab-MapNames of the rastermaps in the simulations. They have the 
structure 
\\texttt{SPECIES}{{{us}}}\\texttt{TYPE}{{{us}}}\\texttt{YEAR}\n#+RESULTS:\n| 
SPECIES      | TYPE                 | YEAR 
|\n|--------------+----------------------+------|\n| ACyclops     | age         
         | 2006 |\n| HSericea     | ageClass             | 2007 |\n| PPinaster  
  | ageClassFire         | 2008 |\n|              | clearingCost         | 2009 
|\n|              | dc                   | 2010 |\n|              | 
dcEstablished        | 2011 |\n|              | dcFire               | 2012 
|\n|              | dcSeedlings          | 2013 |\n|              | 
disturbances         | 2014 |\n|              | fuelModel            | 2015 
|\n|              | individuals          | 2016 |\n|              | 
noEstablished        | 2017 |\n|              | noSeedlings          | 2018 
|\n|              | personDay            | 2019 |\n|              | pGerm       
         | 2020 |\n|              | seedsDisperse        | 2021 |\n|            
  | seedsPlant           | 2022 |\n|              | seedsProduced        | 2023 
|\n|              | seedsSoil            | 2024 |\n| ------------ | 
-------------------- | 2025 |\n| all          | cleared              | 2026 
|\n|              | clearingCosts        | 2027 |\n|              | dc          
         | 2028 |\n|              | fuelModel            | 2029 |\n|            
  | personDay            | 2030 |\n|              | prioStand            | 2031 
|\n| ------------ | -------------------- | 2032 |\n| clearing     | 1h          
         | 2033 |\n| fire         | count                | 2034 |\n| ignition   
  | fuelModel            | 2035 |\n| moisture     | last                 | 2036 
|\n| NatVeg       | live                 | 2037 |\n|              | Points      
         |      |\n|              | stage                |      |\n|            
  |                      |      |\n\n* Tool Functions                           
                        :noexport:\n#+begin_src sh :results output \nmogrify 
-format png -density 300 -quality 100 ./fig-*.pdf 
\n#+end_src\n\n#+RESULTS:\n#+begin_example\n12\n3\n1\n17541\n0\n3\n0\n3\n17541\n(3
 0 
obj\\350\\262}\\303\\327\\330\\312\\334\\330-\\336\\017m8\\223\\337p\\)i\\302\\257\\304h\\267\\376-\\267\\024-\\370\\225\\030,\\365\\370\\226\\237\\203&\\374R\\2642\\222\\215\\276\\301\\302=\\013`\\303\\225h\\355\\t\\351\\316o\\370=h\">\\032c\\321\\241\\205\\177\\374\\364\\377\\000\\t\\235\\273\\207endstream\\331\\177\\305\\315\\262\\365\\317\\255\\360\\272\\320\\312z\\267|\\376\\033\\355\\367\\347Vx]h\\305\\257\\313\\327\\256\\356q~n\\205\\327\\205V~\\372\\272\\234\\341\\272l\\317BR\\303u\\331\\3721\\226\\247p]\\276v\\353FZL+\\274.\\264\\342\\327\\3457\\337}e\\222\\370\\365\\337\\265W}}\\367o\\257:address@hidden)\n65535\n21250\n12\n4\n1\n17624\n0\n4\n0\n4\n17624\n(4
 0 obje /Pages /Kids [ 7 0 R ] /Count 1 /MediaBox [0 0 504 324] 
>>=h\">\\032c\\321\\241\\205\\177\\374\\364\\377\\000\\t\\235\\273\\207endstream\\331\\177\\305\\315\\262\\365\\317\\255\\360\\272\\320\\312z\\267|\\376\\033\\355\\367\\347Vx]h\\305\\257\\313\\327\\256\\356q~n\\205\\327\\205V~\\372\\272\\234\\341\\272l\\317BR\\303u\\331\\3721\\226\\247p]\\276v\\353FZL+\\274.\\264\\342\\327\\3457\\337}e\\222\\370\\365\\337\\265W}}\\367o\\257:address@hidden)\n65535\n21250\n12\n5\n1\n17747\n0\n5\n0\n5\n17747\n(5
 0 objpace << /sRGB 5 0 R >> >>/Count 1 /MediaBox [0 0 504 324] 
>>=h\">\\032c\\321\\241\\205\\177\\374\\364\\377\\000\\t\\235\\273\\207endstream\\331\\177\\305\\315\\262\\365\\317\\255\\360\\272\\320\\312z\\267|\\376\\033\\355\\367\\347Vx]h\\305\\257\\313\\327\\256\\356q~n\\205\\327\\205V~\\372\\272\\234\\341\\272l\\317BR\\303u\\331\\3721\\226\\247p]\\276v\\353FZL+\\274.\\264\\342\\327\\3457\\337}e\\222\\370\\365\\337\\265W}}\\367o\\257:address@hidden)\n65535\n21250\n12\n6\n1\n17780\n0\n6\n0\n6\n17780\n(6
 0 objsed 6 0 R]RGB 5 0 R >> >>/Count 1 /MediaBox [0 0 504 324] 
>>=h\">\\032c\\321\\241\\205\\177\\374\\364\\377\\000\\t\\235\\273\\207endstream\\331\\177\\305\\315\\262\\365\\317\\255\\360\\272\\320\\312z\\267|\\376\\033\\355\\367\\347Vx]h\\305\\257\\313\\327\\256\\356q~n\\205\\327\\205V~\\372\\272\\234\\341\\272l\\317BR\\303u\\331\\3721\\226\\247p]\\276v\\353FZL+\\274.\\264\\342\\327\\3457\\337}e\\222\\370\\365\\337\\265W}}\\367o\\257:address@hidden)\n65535\n21250\n#+end_example\n\n\n\n*
 File Local Variables                                             
:noexport:\n\n# Local Variables:\n# eval: (visual-line-mode 1)\n# End:\n\n\n") 
(narrow-to-region 1 57482) (goto-char 1)))()
|   org-export-copy-buffer()
|   org-export-as(latex nil nil nil (:output-file "./asmOptim.tex"))
|   org-export-to-file(latex "./asmOptim.tex" nil nil nil nil nil)
|   org-latex-export-to-latex(nil nil nil nil)
|   org-export-dispatch(nil)
|   funcall-interactively(org-export-dispatch nil)
|   call-interactively(org-export-dispatch nil nil)
|   command-execute(org-export-dispatch)
`----

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]