<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://cs.gmu.edu/feed.xml" rel="self" type="application/atom+xml" /><link href="https://cs.gmu.edu/" rel="alternate" type="text/html" /><updated>2026-06-25T11:58:09+00:00</updated><id>https://cs.gmu.edu/feed.xml</id><title type="html">personal-website</title><subtitle>The personal website of Prof. Gregory J. Stein (mirrored from https://cs.gmu.edu/~gjstein )</subtitle><entry><title type="html">RAIL Group Paper Preparation and Style Guide</title><link href="https://cs.gmu.edu/2025/6/lab-writing-advice/" rel="alternate" type="text/html" title="RAIL Group Paper Preparation and Style Guide" /><published>2025-06-26T06:42:43+00:00</published><updated>2025-06-26T06:42:43+00:00</updated><id>https://cs.gmu.edu/2025/6/lab-writing-advice</id><content type="html" xml:base="https://cs.gmu.edu/2025/6/lab-writing-advice/"><![CDATA[<style>
ul {margin-top:-1em;}
ul>li {padding-bottom:0em!important; padding-top:0em!important; padding-left:1em;}
</style>

<p>This living guide is a collection of best practices surrounding paper preparation, which grows every so often as I realize that I’ve given the same advice multiple times. All my students are required to read through this guide before distributing drafts, even internally. Addressing any issues incrementally avoids a last-minute scramble to fix them later.</p>

<blockquote>
  <p>Note: This guide is a work in progress.</p>
</blockquote>

<h2 id="typography-and-typography-related-latex-tips">Typography and Typography-Related LaTeX Tips</h2>

<p><strong>Prefer to use small caps for acronyms.</strong> Full capital acronyms, like MDP or POMDP, tend to stand out in the text and draw the eye. Instead, using small caps—like <sc>mdp</sc> or <sc>pomdp</sc>—look nicer when used frequently in the text. This can be achieved in LaTeX via <code class="language-plaintext highlighter-rouge">\textsc{mdp}</code> for <sc>mdp</sc>, noting that text inside <code class="language-plaintext highlighter-rouge">\textsc</code> is itself lowercase to achieve this effect. If you use the <code class="language-plaintext highlighter-rouge">glossary</code> package for acronym management, this becomes easier; see details below.
<span class="marginnote note no-word-break invisible-sm" style="margin-top:-9.5em;" aria-label="margin note">Using small caps isn’t always the best choice, especially when you inherit acronyms or, worse, mixed-case terms like LaTeX or ProcTHOR aren’t easily dealt with. I have done odd things before like <code class="language-plaintext highlighter-rouge">\textsc{l}</code>​<code class="language-plaintext highlighter-rouge">a\textsc{t}</code>​<code class="language-plaintext highlighter-rouge">e\textsc{x}</code>, which results in the unconventional <sc>l</sc>a<sc>t</sc>e<sc>x</sc> or the not-as-bad <sc>p</sc>roc<sc>thor</sc>, but really it’s non-ideal. Use your judgment.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">Using small caps isn’t always the best choice, especially when you inherit acronyms or, worse, mixed-case terms like LaTeX or ProcTHOR aren’t easily dealt with. I have done odd things before like <code class="language-plaintext highlighter-rouge">\textsc{l}</code>​<code class="language-plaintext highlighter-rouge">a\textsc{t}</code>​<code class="language-plaintext highlighter-rouge">e\textsc{x}</code>, which results in the unconventional <sc>l</sc>a<sc>t</sc>e<sc>x</sc> or the not-as-bad <sc>p</sc>roc<sc>thor</sc>, but really it’s non-ideal. Use your judgment.
</p>

<p><strong>Know the difference between hyphens, en dashes, and em dashes.</strong></p>
<ul>
  <li>A <em>hyphen</em> is for connecting words with a combined meaning, e.g., <em>learning-augmented</em>. It is a single <code class="language-plaintext highlighter-rouge">-</code> in LaTeX.</li>
  <li>The <em>en dash</em> is for ranges of values, e.g., pp 3–4. It is a double <code class="language-plaintext highlighter-rouge">--</code> in LaTeX.</li>
  <li>The <em>em dash</em> is for surrounding phrases or clarifications at the end of a sentence—just like this. I use these on occasion when I might have otherwise thought to surround a phrase in parentheses. They are achieved via a triple <code class="language-plaintext highlighter-rouge">---</code> in LaTeX.<span class="marginnote note no-word-break invisible-sm" style="margin-top:-4em;" aria-label="margin note">Most style guides recommend not puting spaces around an em dash. The dash should touch the text on both sides, as I have done here.</span></li>
</ul>
<p class="note no-word-break visible-sm" aria-label="footnote">Most style guides recommend not puting spaces around an em dash. The dash should touch the text on both sides, as I have done here.
</p>

<p><strong>Never use double-quotes <code class="language-plaintext highlighter-rouge">"</code> in LaTeX; use single quotes and backticks.</strong> LaTeX is not designed to identify double quotes, so surrounding a word or phrase by quotes requires the following syntax: <code>``something''</code>.</p>

<p><strong>Punctuation goes before footnotes and closing quotes.</strong> Proper use looks like <code class="language-plaintext highlighter-rouge">`something.'</code> or <code class="language-plaintext highlighter-rouge">bar.\footnote{A footnote.}</code>.</p>

<p><strong>Internal links should be neither colored nor surrounded by a colored box.</strong>
By default the <code class="language-plaintext highlighter-rouge">hyperref</code> package, upon which many other packages depend, tends to color internal links or puts colored boxes around links, which means that every use of <code class="language-plaintext highlighter-rouge">\cite</code> or <code class="language-plaintext highlighter-rouge">\ref</code> results in some ugly markup. These should be disabled. This fix can be achieved either during import <code class="language-plaintext highlighter-rouge">\usepackage</code>​<code class="language-plaintext highlighter-rouge">[hidelinks]</code>​<code class="language-plaintext highlighter-rouge">{hyperref}</code> or later with <code class="language-plaintext highlighter-rouge">\hypersetup</code>​<code class="language-plaintext highlighter-rouge">{hidelinks}</code>.</p>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-7em;" aria-label="margin note">Some conferences or publishers will require that the colored reference boxes remain. RA-L is one of these.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">Some conferences or publishers will require that the colored reference boxes remain. RA-L is one of these.
</p>

<p><strong>Understand proper use of e.g. and i.e.</strong>
Use <em>e.g.</em> for examples and <em>i.e.</em> for clarification. Both of these should be followed by a single comma and proceeded by either a comma, parenthesis, or an em dash—e.g., or surrounded as in this example.</p>

<h4 id="references-and-bibliography-management">References and Bibliography Management</h4>

<p><strong>Enforce proper capitalization in BibTeX.</strong> Many BibTeX styles automatically update convert titles to sentence case, lower-casing many of the words. This behavior is <a href="https://tex.stackexchange.com/a/10775">by design</a>, but does not play nice with acronyms. For example, a BibTeX entry with <code class="language-plaintext highlighter-rouge">title = {DESPOT: Online POMDP Planning with Regularization}</code> will produce “Despot: Online pomdp planning with regularization.” Instead, you can enforce capitalization with an extra set of curly braces around words you would like to preserve: <code class="language-plaintext highlighter-rouge">title = {</code><code class="language-plaintext highlighter-rouge">{DESPOT}: Online {POMDP} Planning with Regularization}</code> will produce the correct “DESPOT: Online POMDP planning with regularization.”</p>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-12em;" aria-label="margin note">Surrounding the entire title with additional curly braces will preserve capitalization for the entire title and is not recommended, since it will then over-enforce capitalization and thus deviate from the BibTeX-recommended style.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">Surrounding the entire title with additional curly braces will preserve capitalization for the entire title and is not recommended, since it will then over-enforce capitalization and thus deviate from the BibTeX-recommended style.
</p>

<p><strong>Use a non-breaking space before cite commands and other cross-references.</strong> The reference number should not begin a line, as it is both unpleasant asthetically and hurts readability. LaTeX uses the tilde character <code class="language-plaintext highlighter-rouge">~</code> to signify a non-breaking space, which allows a space between what it connects, yet will not break the line.</p>
<ul>
  <li><em>Bad</em>: “<code class="language-plaintext highlighter-rouge">Stein \cite{stein}</code>”</li>
  <li><em>Bad</em>: “<code class="language-plaintext highlighter-rouge">Stein ~\cite{stein}</code>” <em>Note: This adds two spaces</em></li>
  <li><em>Good</em>: “<code class="language-plaintext highlighter-rouge">Stein~\cite{stein}</code>”</li>
  <li><em>Good</em>: <code class="language-plaintext highlighter-rouge">See Sec.~\ref{sec:method}.</code></li>
  <li><em>Good</em>: <code class="language-plaintext highlighter-rouge">See Fig.~\ref{fig:overview}.</code></li>
  <li><em>Good</em>: <code class="language-plaintext highlighter-rouge">See Eq.~\eqref{eq:bellman}.</code></li>
</ul>

<p><strong>You must manually maintain and clean BibTeX entries; Google Scholar and automated systems are imperfect.</strong> Simply downloading the BibTeX entries and using them will result in poor quality citations. Similarly, bibliography managers are not perfect. It is your responsibility to clean those entries.</p>

<p><strong>Reference document elements in a way that matches the template, e.g., Fig. versus Figure.</strong>
Many LaTeX templates are opinionated about how figures, tables, and algorithms are referenced. If the template displays “Fig. 1” when placing a figure, all mentions of that figure in the text should also read “Fig. 1” and not “Figure 1.”</p>

<p><strong>Every section, figure, table, and equation must have a label.</strong>
Add <code class="language-plaintext highlighter-rouge">\label{...}</code> at creation time for every sectioning command and every float/equation environment. This makes cross-referencing fast, avoids fragile “search for the number” workflows, and reduces errors during late-stage edits.</p>

<p><strong>Do not refer to “subsections” in prose.</strong>
When referencing a subsection, the template will format it appropriately. For example, prefer <code class="language-plaintext highlighter-rouge">Sec.~\ref{sec:related}</code> (or “Sec. II-A” depending on the style) rather than “subsection A of section II.”</p>

<p><strong>In the final document, references must appear homogeneous.</strong> If you collected BibTeX entries from multiple locations, it is possible that you will have a mix of different ways to reference conferences or journals, e.g., “<sc>icra</sc>” or “2024 <sc>ieee</sc> International Conference on Robotics and Automation” or “International Conference on Robotics and Automation (<sc>icra</sc>).” It is your responsibility to homogenize the references and comply with the norms for the particular conference or journal.</p>

<p><strong>Avoid using references as nouns.</strong>
When referring to a paper, refer to the authors or to the algorithm rather than using the reference number. Instead of “<em>[5] uses a novel approach.</em>”, say “<em>Stein and Roy [5] use a novel approach.</em>” as this is both nicer to look at and also easier to follow.</p>

<p><strong>When referencing a paper by its authors, the author names should not reappear in the citation.</strong>
For example, “<em>Work by Khanal and Stein (2024)…</em>” is preferred to “<em>Work by Khanal and Stein (Khanal and Stein, 2018).</em>” Some citation packages have the <code class="language-plaintext highlighter-rouge">\citet</code> <em>textual citation</em> command, which will add the authors and year automatically. If that command is unavailable, manually typing the authors and using <code class="language-plaintext highlighter-rouge">\citeyear</code> is preferred. If the citation style is numeric and so does not use author names, this change is not needed.</p>

<p><strong>Peer-reviewed venues should be cited over ArXiv versions.</strong> It is you responsibility to make sure your citations are up-to-date. Citing papers uploaded to the ArXiv is okay, but only if the paper has not be published elsewhere. Before a final submission, do a quick search for all ArXiV papers in your references to see if they have been accepted to another venue.</p>

<h4 id="math-and-equations">Math and Equations</h4>

<p><strong>Equation subsubscripts must use <code class="language-plaintext highlighter-rouge">\text</code> for words or abbreviations.</strong>
When using subscripts that are words, enclose them with <code class="language-plaintext highlighter-rouge">\text{}</code> (or sometimes <code class="language-plaintext highlighter-rouge">\textit{}</code>) to ensure proper formatting and letter spacing. For example: <code class="language-plaintext highlighter-rouge">V_{\text{known}}</code> ($V_{\text{known}}$) is correct, while <code class="language-plaintext highlighter-rouge">V_{known}</code> ($V_{known}$) is not. Even when full words are not used, this may be an appropriate choice. Additionally, use text size commands—e.g., <code class="language-plaintext highlighter-rouge">\tiny</code>—to control the size of the text.</p>

<p><strong>All equations should have a number and be followed by appropriate punctuation.</strong> 
This rule is fairly standard practice. All equations should have an equation number. They should also include punctuation as if they were part of the inline text. Thus, if the equation is the end of the sentence, it should be followed by a period, and a comma if the sentence continues.</p>

<p><strong>Use <code class="language-plaintext highlighter-rouge">Eq.~\eqref</code> to refer to equations.</strong> Equations are often referenced in the text as “Eq. (1).” Using <code class="language-plaintext highlighter-rouge">\eqref{eq:name}</code> ensures that the equation number will be in parentheses. Using <code class="language-plaintext highlighter-rouge">Eq.~\ref{eq:name}</code> will result in “Eq. 1,” which is incorrect.</p>

<p><strong>Max, min, argmax, and similar should be in body-text font and defined as <em>operators</em>.</strong> The <code class="language-plaintext highlighter-rouge">\max</code> and <code class="language-plaintext highlighter-rouge">\min</code> operators are built in and are in the body text font. For more complex and custom operators, the <code class="language-plaintext highlighter-rouge">amsmath</code> package provides support to define operators as follows: <code class="language-plaintext highlighter-rouge">\DeclareMathOperator*</code>​<code class="language-plaintext highlighter-rouge">{\argmax}</code>​<code class="language-plaintext highlighter-rouge">{arg\,max}</code>. Defining this as an operator means that the subscript will be placed below the middle of the text, which is expected behavior.</p>

<h2 id="working-with-latex-best-practices-and-useful-packages">Working with LaTeX: Best Practices and Useful Packages</h2>

<p><strong>Prefer smaller <code class="language-plaintext highlighter-rouge">.tex</code> files, each added to a main file via <code class="language-plaintext highlighter-rouge">\input</code>.</strong>
It is often easier to navigate and edit smaller files than having a single massive file with all of the content in it. This guideline is particularly important when collaboratively editing via Overleaf, where jointly editing a single large file can lead to rendering issues in the editor.</p>

<p><strong>Tables and figures should each get their own <code class="language-plaintext highlighter-rouge">.tex</code> file and added via <code class="language-plaintext highlighter-rouge">\input</code>.</strong>
It is almost always necessary to move around figures within the <code class="language-plaintext highlighter-rouge">.tex</code> document. Putting the code for figures and tables in their own files means they can be added via the <code class="language-plaintext highlighter-rouge">\input</code> macro and moved around with ease. I usually have a separate top-level folder called “inputs” that includes such files.</p>

<p><strong>If allowed, use <code class="language-plaintext highlighter-rouge">booktabs</code> for professional tables.</strong>
The <code class="language-plaintext highlighter-rouge">booktabs</code> package makes for some very nice looking tables. If you are using <code class="language-plaintext highlighter-rouge">booktabs</code>, use <code class="language-plaintext highlighter-rouge">\toprule</code>, <code class="language-plaintext highlighter-rouge">\midrule</code>, and <code class="language-plaintext highlighter-rouge">\bottomrule</code>, and do not use <code class="language-plaintext highlighter-rouge">\hline</code>. In general, avoid vertical rules in tables unless the venue explicitly requires them.</p>

<p><strong>The <code class="language-plaintext highlighter-rouge">glossary</code> package should be used for managing acronyms and abbreviations.</strong>
The glossary package is incredibly useful for managing acronyms. For example, <code class="language-plaintext highlighter-rouge">\newacronym{TAMP}{\textsc{tamp}}{task and motion planning}</code> at the top of the file will expand <code class="language-plaintext highlighter-rouge">\gls{TAMP}</code> as “task and motion planning (<sc>tamp</sc>)” on the first use and then simply <sc>tamp</sc> on subsequent calls. It is also possible to define custom abbreviation styles for abbreviations that shouldn’t be expanded at the outset. Here is an example configuration one might use:</p>

<div class="language-latex highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">\usepackage</span><span class="na">[acronym]</span><span class="p">{</span>glossaries-extra<span class="p">}</span>
<span class="k">\glsdisablehyper</span> <span class="c">% Avoid hyperref</span>
<span class="k">\setabbreviationstyle</span><span class="na">[acronym]</span><span class="p">{</span>long-short<span class="p">}</span>
<span class="k">\setabbreviationstyle</span><span class="na">[short]</span><span class="p">{</span>short-nolong<span class="p">}</span>
<span class="k">\newacronym</span><span class="p">{</span>POMDP<span class="p">}{</span><span class="k">\textsc</span><span class="p">{</span>pomdp<span class="p">}}{</span>partially observable Markov decision process<span class="p">}</span>
<span class="k">\newacronym</span><span class="na">[category={short}]</span><span class="p">{</span>PDDL<span class="p">}{</span><span class="k">\textsc</span><span class="p">{</span>pddl<span class="p">}}{</span>The Planning Domain Definition Language<span class="p">}</span>
</code></pre></div></div>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-20em;" aria-label="margin note">The glossary has helpful macros for other automatic formatting as well: <code class="language-plaintext highlighter-rouge">\glspl</code> will pluralize the acronym and <code class="language-plaintext highlighter-rouge">\Gls</code> will ensure the first letter is capitalized, useful at the beginning of the sentence.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">The glossary has helpful macros for other automatic formatting as well: <code class="language-plaintext highlighter-rouge">\glspl</code> will pluralize the acronym and <code class="language-plaintext highlighter-rouge">\Gls</code> will ensure the first letter is capitalized, useful at the beginning of the sentence.
</p>

<ul>
  <li>Other commonly-used terms should be defined via custom functions. TODO with an example</li>
  <li>Make a custom todo or notes function for draft text, which clearly highlights/colors comments and other items and makes it easy to edit them out. I like to use the <code class="language-plaintext highlighter-rouge">todonotes</code> package for this. TODO</li>
</ul>

<h2 id="figures">Figures</h2>

<h3 id="figure-design">Figure Design</h3>

<p><strong>Try to make the most of the space you have and avoid large white space.</strong> TODO</p>

<p><strong>Prefer labeling figure elements to describing them in the caption.</strong>
Try to avoid captions like “the frontier to the left of the robot has high success probability.” Instead, place a short label and/or arrow directly on the figure indicating the frontier (or region, failure case, threshold, etc.). The reader should not be forced to glance back and forth between the figure and the caption to understand the figure’s meaning. Having labels for various items or subfigures appear near to the entities being discussed helps readability quite a lot. The tradeoff is that the figure becomes more cluttered, so use your judgment to maximize clarity.</p>

<p><strong>Match figure typography to the paper typography whenever possible.</strong>
Use the same (or visually compatible) font family as the paper, and choose sizes so the figure text does not “pop out” as mismatched relative to the surrounding body text.</p>

<p><strong>Figure captions should be as self-contained as possible.</strong>
A reader should be able to understand what the figure shows (and why it matters) by looking at the figure and reading the caption, without needing to hunt through the main text for basic context.</p>

<h3 id="figure-preparation">Figure Preparation</h3>

<p><strong>TODO: Always use software with a grid; powerpoint is not allowed for figure preparation.</strong></p>

<p><strong>Create figures at the size they will appear in the paper.</strong>
Start with a canvas sized to the intended final footprint (e.g., one-column width vs. two-column width). Doing so makes it much easier to choose correct font sizes and line weights.</p>

<p><strong>Figures take iteration.</strong>
You rarely get a figure “right” by thinking about it. Expect multiple passes: adjust layout, typography, and annotation until it reads clearly at paper scale.</p>

<h2 id="preparing-drafts">Preparing Drafts</h2>

<h3 id="best-practices">Best Practices</h3>

<p><strong>When writing a draft, always start by using the template for the submission venue.</strong> TODO: important since it lets you format as you go and gives you an impression of the rough length of the document so far.</p>
<ul>
  <li>(use the template provided by the conference or journal you plan to use).</li>
</ul>

<p><strong>Construct results figures and captions while writing the results section.</strong> 
What figures you include are often defined by what you say in the writing and what you write will be defined by what results you decide to show. Relatedly, write figure captions as you write the body text, as crafting captions is similarly informative.</p>

<p><strong>Floats should not break columns of prose.</strong>
Figures, tables, and code listings should typically appear at the top of a column (or page) unless there is a clear reason not to. With limited exceptions, avoid placements that split paragraphs or interrupt the reading flow in awkward places.</p>

<p><strong>When asking for feedback, specify what kind of feedback you want.</strong>
If you share a draft section or figure and ask “what do you think,” you will receive feedback on everything–including formatting. To avoid wasted cycles, include 1-2 sentences stating what you are ready for: e.g., “Please focus on the experimental story and caption clarity; ignore typography,” or “Please review the color scheme and readability at one-column scale.”</p>

<p><strong>Do not outsource interpretation of your results.</strong>
You cannot simply show plots/statistics and say “the results aren’t good” or ask “what do you think.” Come with a claim you are trying to support, your best interpretation of what the data says, and (if applicable) a short list of plausible causes/follow-ups.</p>

<p><strong>Avoid the question “Do I have enough results?”</strong>
Instead, ask a concrete question tied to the paper’s claims: “Do these results support Claim X?” “What ablation is missing to rule out Y?” “Is the comparison set adequate for the story we’re telling?”</p>

<p><strong>Use visually distinct draft-note macros and keep them easy to remove.</strong>
When drafting, use a dedicated macro or package (e.g., <code class="language-plaintext highlighter-rouge">todonotes</code>) so comments, open questions, and placeholders are obvious and can be cleanly disabled/removed for submission.</p>

<h2 id="language-use">Language Use</h2>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-3em;" aria-label="margin note">This guide’s section on <em>Language Use</em> is far from comprehensive. I strongly recommend purchasing Strunk &amp; White’s famous <a href="https://en.wikipedia.org/wiki/The_Elements_of_Style">Elements of Style</a>.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">This guide’s section on <em>Language Use</em> is far from comprehensive. I strongly recommend purchasing Strunk &amp; White’s famous <a href="https://en.wikipedia.org/wiki/The_Elements_of_Style">Elements of Style</a>.
</p>

<p><strong>Ensure proper use of <em>which</em> vs. <em>that</em>.</strong> When used to describe or clarify something, <em>which</em> follows a comma while <em>that</em> never does.</p>

<p><strong>Avoid an <em>unqualified this</em> in your writing.</strong> The word “this” is a <em>deictic reference</em>: its meaning depends on context. Rather than the potentially ambiguous “This can be overcome by […],” prefer to ground “this” to avoid the ambiguity: “This pervasive challenge can be […].”</p>

<p><strong>Avoid using <em>etc.</em>, particularly at the end of a sentence.</strong> I have been trying to avoid the use of “etc.” in general, since its use tends to be lazy writing. Prefer instead to clarify the point or say something a bit more descriptive, such as <em>other items</em>.</p>

<h2 id="writing-suggestions-and-guidance">Writing suggestions and guidance</h2>

<h2 id="technical-details">Technical Details</h2>

<p><strong>For work involving planning or reinforcement learning: know the difference between $Q$ and $V$.</strong> $Q$ takes two arguments; $V$ takes one. If you have more inputs, they should be grouped into a single object, e.g., $V(\{x, y, z\})$</p>]]></content><author><name>Gregory J. Stein</name></author><category term="[&quot;Communication &amp; Learning&quot;]" /><category term="Communication" /><category term="Pedagogy" /><category term="Getting a PhD" /><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Anticipatory Planning for Performant Long-Lived Robot in Large-scale Home-like Environments</title><link href="https://cs.gmu.edu/2025/5/anticipatory-planning-at-scale/" rel="alternate" type="text/html" title="Anticipatory Planning for Performant Long-Lived Robot in Large-scale Home-like Environments" /><published>2025-05-01T04:00:00+00:00</published><updated>2025-05-01T04:00:00+00:00</updated><id>https://cs.gmu.edu/2025/5/anticipatory-planning-at-scale</id><content type="html" xml:base="https://cs.gmu.edu/2025/5/anticipatory-planning-at-scale/"><![CDATA[<p>Imagine a service robot deployed in a household setting, assigned a sequence of tasks to complete—one at a time—within an environment that persists throughout the sequence. However, the robot is not told subsequent tasks in advance, mimicing a realistic scenario when the robot is assigned tasks as the user decides they need to be done.</p>

<p>Consider this example: the robot is asked to serve water at a desk. If it behaves myopically—focusing only on the current task—it might pick up an empty cup from the desk, fill it with water at the sink, and return it to the desk. This solution is reasonable, as it efficiently completes the immediate task.
If the user drinks the water and then asks for more, the robot must then repeat the same sequence of operations to pick up the cup, go all the way back to the sink, fill it up, and then return. 
Over time, this short-sighted approach of only caring about the current task and ignoring the future tasks can lead to higher cumulative effort or cost.</p>

<p>Instead, if the robot were to know that the user would ask for more water on a few occasions, the robot should choose a different strategy: instead of using a cup, the robot could bring a larger water-filled jar to the desk. While using a jar may initially seem more costly from the perspective of completing a <em>single task</em>, yet becomes more efficient when considering the entire task sequence, since the jar can serve <em>multiple future refillings</em> without requiring repeated trips to the sink. Clearly, being able to anticipate how its actions may impact future tasks. <strong>The goal of our <em>anticipatory planning</em> is just this: to estimate the impact immediate actions are expected to have on subsequent tasks the robot may later be assigned</strong></p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
<strong>Myopic Approach:</strong> Completes the first task with a lower immediate cost but ignores the possible higher expected cost for the next task.

</note>

<img src="/assets/posts/antlar-bad-example.png" class="img-responsive center-block " title="bad-behavior" style="max-height:350px;" />

<note class="img-caption visible-sm" aria-label="image caption"><strong>Myopic Approach:</strong> Completes the first task with a lower immediate cost but ignores the possible higher expected cost for the next task.
</note>
  </p>

<!-- > To navigate efficiently, the robot may need to remember what it has seen and make use of that information to inform its decision-making. -->

<!-- <hr/> -->

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
<strong>Our Approach:</strong> Completes the first task with a slightly higher cost now but reduces the cost of the future tasks thus reduces the overall cost of completing all the tasks.

</note>

<img src="/assets/posts/antlar-good-example.png" class="img-responsive center-block " title="good-behavior" style="max-height:350px;" />

<note class="img-caption visible-sm" aria-label="image caption"><strong>Our Approach:</strong> Completes the first task with a slightly higher cost now but reduces the cost of the future tasks thus reduces the overall cost of completing all the tasks.
</note>
  </p>

<p><em>Anticipatory planning</em> [1] is formalized as planning to reduce the joint cost of (i) completing the current task and (ii) the expected cost of completing future tasks. 
We use learning to esimate the expected future cost, so as to mitigate the computational burden of computing expected future cost directly.
Scaling up anticipatory planning to home-scale environments is difficult. Such spaces often have many rooms, dozens or even hundreds of objects, and a wide variety of possible tasks the robot may be assigned. As the environment grows in size and complexity, it becomes harder for the robot to both <em>estimate</em> and <em>plan effectively</em> at scale.</p>

<p>In our most recent work, we present a learning-augmented model-based anticipatory task planning framework tailored for home-scale environments. In the post below, we discuss <a href="https://arxiv.org/pdf/2411.12837">our recent ICRA 2025 paper</a> <em>Anticipatory Planning for Performant Long-Lived Robot in Large-Scale Home-Like Environments</em> which seeks to provide answers to these questions. This post is geared towards a somewhat technically minded audience. However, we have tried to provide enough context that we expect it will also be of interest to non-roboticists.</p>

<p>There is also a 3 minute video presentation that has significant overlap with this post that you may enjoy instead:</p>
<div class="embed-responsive embed-responsive-16by9"> <iframe class="embed-responsive-item" src="https://www.youtube.com/embed/s8AwQGAme0g?si=Lz5aikZSUwteqcxS" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>

<h2 id="real-world-challenge-planning-in-home-like-environments">Real-World Challenge: Planning in Home-like Environments</h2>

<p>While planning in a home like environment the environment is often going to be large and have many objects present. As the number of objects and possible tasks increases, it becomes harder both to estimate future costs accurately and to find efficient plans in a reasonable amount of time. But both issues need to be addressed if we are to use anticipatory planning in large environments.</p>

<h3 id="challenge-planning-at-scale">Challenge: Planning at scale</h3>
<p>In everyday household settings where there are many objects around, a task can often be done in several different ways. But checking every possible option of plan while also considering all the other objects takes too much time and computing power to be practical.</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
Given a task, there are often many plans that solve it. As the environments grows the number of plans that solve the task grows exponentially with more assets, making exhaustive search intractable.

</note>

<img src="/assets/posts/antlar-plan-challenge.png" class="img-responsive center-block " title="plan-challenge" style="max-height:450px;" />

<note class="img-caption visible-sm" aria-label="image caption">Given a task, there are often many plans that solve it. As the environments grows the number of plans that solve the task grows exponentially with more assets, making exhaustive search intractable.
</note>
  </p>

<h3 id="challenge-learning-at-scale">Challenge: Learning at scale</h3>
<p>Anticipatory planning [1] on robotics domain relies on learning to mitigate the computational burden of computing expected future costs, providing cost estimates that guide planning toward behaviors that avoid side effects and improve long-lived performance. However, to compute the expected future cost for large environment learning needs to scale such that anticipatory planning gains the flexibility to operate on any kind of home layout with any large number of objects present. At the same time the learning needs to be good enough to guide the search effectively. How to represent the environment so that learning can effectively scale for anticipatory planning remains a challenge.</p>

<h2 id="approach-anticipatory-planning-in-large-scale-environment">Approach: Anticipatory planning in large scale environment</h2>
<p>We present an approach for anticipatory planning at scale that seeks to minimize the immediate and future planning costs.  Our approach involves (1) sampling plans that complete the given task and (2) iterating over the sampled plans to get the plan that minimizes the sum of immediate plan cost and future expected cost.</p>

<h3 id="we-use-focused-sampling-to-reduce-the-planning-search-space-to-allow-anticipatory-planning-at-scale">We use focused sampling to reduce the planning search space to allow anticipatory planning at scale</h3>
<p>When the environment is large and diverse set of objects are present, a given task can be completed in multiple different ways. However, the number of such solution plan grows exponentially with more assets that limits exhaustive search. To help the robot come up with better ways to complete a task, we give it slightly modified versions of the original task. These versions include an additional task related to objects the robot might pass by while doing its job. By focusing only on objects in the vicinity of the base solution we limit the number of extra tasks it needs to consider. This helps the robot explore useful options within its computational budget.</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
To search over the space of solutions, we perturb the task specification by proposing alternate states for objects in the vicinity of the base plan.

</note>

<img src="/assets/posts/antlar-plan-solution.png" class="img-responsive center-block " title="plan-solution" style="max-height:350px;" />

<note class="img-caption visible-sm" aria-label="image caption">To search over the space of solutions, we perturb the task specification by proposing alternate states for objects in the vicinity of the base plan.
</note>
  </p>

<p>The robot then searches over these modified tasks to see which plan leads to the best outcome. For each version, it checks how much effort it takes to finish the task now (immediate cost) and how much it might help with tasks in the near future (expected future cost). It uses this information to pick the plan that saves the most overall time and effort. By narrowing down the choices and only keeping the helpful ones, our robot avoids wasting time on plans that do not lead to long-term benefits.</p>

<h3 id="we-use-a-gnn-on-the-3d-scene-graph-representation-to-estimate-expected-future-cost-at-scale">We use a <sc>gnn</sc> on the 3D scene graph representation to estimate expected future cost at scale</h3>

<p>We represent the environment using a 3D scene graph—a structured, layered map that shows the layout of objects and how they relate to each other. This kind of graph helps us to represent environments with any number of assets presents and then use powerful learning tools such as Graph Neural Networks (<sc>gnn</sc>s), which can learn patterns from the structure of the environment. In the graph, each object is a node with useful details like what it is, where it is, and what condition it’s in (for example, whether a cup is full or empty). The connections between objects (edges) show how they are arranged or interact. By using this graph structure, the <sc>gnn</sc> learns to estimate how much effort future tasks might take depending on how the environment currently looks while maintaining scalability for large environment.</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
The map is converted to a 3D Scene Graph to define the GNN.

</note>

<img src="/assets/posts/antlar-learn-solution.png" class="img-responsive center-block " title="learn-solution" style="max-height:350px;" />

<note class="img-caption visible-sm" aria-label="image caption">The map is converted to a 3D Scene Graph to define the GNN.
</note>
  </p>

<h3 id="preparation-anticipatory-planning-in-advance-of-receiving-a-task">Preparation: Anticipatory Planning in advance of receiving a task</h3>

<p>Preparation means the robot takes some time in advance—before it is given any task or it is idle—to get the environment ready in a way that makes future tasks easier. To do this, the robot tries out small changes to where things are or how they are arranged, one step at a time. If a change looks helpful or has a chance of being helpful, the robot keeps it and tries more changes from there. After repeating this process many times, it settles on a state of the environmental that is expected to make its upcoming tasks faster and less costly.</p>

<h2 id="results-anticipatory-planning-in-home-scale-environment">Results: anticipatory planning in home-scale environment</h2>

<p>We test our approach in large simulated environments using <sc>ProcTHOR</sc> and a custom-designed restaurant setting. The tasks for <sc>ProcTHOR</sc> come from the <sc>alfred</sc> dataset and mainly involve moving objects from one place to another. To better evaluate our method in more complex situations, we also create a restaurant environment with tasks that involve serving, cleaning, and interacting with objects in more diverse ways. To highlight the scale and complexity of the environment, <sc>ProcTHOR</sc> includes a wide range of home layouts—from small 1-room apartments to large 14-room houses. Across these homes, there are over 1,600 household objects grouped into more than 100 categories. Each environment can have 50 to 200 different tasks based on the <sc>alfred</sc> dataset.</p>

<p>As our robot minimizes both the immediate plan cost and the future expected cost so while completing the current task of serving water at Table 1, it anticipates the possible future need to serve another cup of water at a nearby location. Thus, it decides to fill a jar with water that can hold multiple cups of water and keep it on Table 1, so that when it is asked to serve water again, it can do so at a lower cost.</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
<strong>Myopic Baseline: cost 2982.</strong> Not knowing what the future task would be, myopic planning serves water in cup going back and forth and incuring more cost for the total sequence.

</note>

<img src="/assets/posts/antlar-myopic.gif" class="img-responsive center-block " title="myopic-video" style="max-height:300px;" />

<note class="img-caption visible-sm" aria-label="image caption"><strong>Myopic Baseline: cost 2982.</strong> Not knowing what the future task would be, myopic planning serves water in cup going back and forth and incuring more cost for the total sequence.
</note>
  </p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
<strong>Our Anticipatory Planner: cost 1655.</strong> With anticiaptory planning our approach predicts possible future tasks and serves water in jar that saves another trip to water refill resulting in lower cost for the total sequence.

</note>

<img src="/assets/posts/antlar-ant.gif" class="img-responsive center-block " title="anticipatory-planning-video" style="max-height:300px;" />

<note class="img-caption visible-sm" aria-label="image caption"><strong>Our Anticipatory Planner: cost 1655.</strong> With anticiaptory planning our approach predicts possible future tasks and serves water in jar that saves another trip to water refill resulting in lower cost for the total sequence.
</note>
  </p>

<p>Additionally, our robot can prepare the environment in advance. It does this by finding a setup where future tasks are likely to be easier and quicker to complete. The robot then adjusts the environment step by step, trying different changes. It repeats this process as many times as allowed before a new task is given. Preparing environment like this further improves performance by minimizing both current task future expected costs and thus reducing the total planning cost.</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
<strong>Example Showing Preparation</strong> Our robot can prepare the enviornment given enough time. Once the environment is prepared, the expected cost of future tasks is reduced.

</note>

<img src="/assets/posts/antlar-prepare.gif" class="img-responsive center-block " title="anticipatory-planning-preparation-video" style="max-height:300px;" />

<note class="img-caption visible-sm" aria-label="image caption"><strong>Example Showing Preparation</strong> Our robot can prepare the enviornment given enough time. Once the environment is prepared, the expected cost of future tasks is reduced.
</note>
  </p>

<h2 id="conclusion--references">Conclusion &amp; References</h2>

<p>We introduce a planning approach that helps a robot perform better in large, home-like environments. This approach helps the robot plan ahead by learning from experience. To make planning manageable at a large scale, we use a sampling strategy that narrows down the best options. We also combine a Graph Neural Network (<sc>gnn</sc>) with a 3D scene graph to help the robot learn from its surroundings and make learning possible at scale. Our results show that the robot can use this learning to prepare the environment in advance and make better decisions during tasks. As a result, it performs more efficiently across long sequences of tasks. We also want to highlight the fact that we care about using robots efficiently for task that human usually finds mundane (like folding laundry, cleaning up after meals) and allow humans instead to spend more time on creative things (like designing, acting, singing, drawing etc).</p>

<!-- In future work, we envision passing more complex sensory input to the robot, allowing it to estimate the goodness of its actions using information collected from image sensors or semantically-segmented images. -->

<!-- Read [our full paper](https://arxiv.org/pdf/2307.14501.pdf) or feel free to explore our code [on GitHub](https://github.com/RAIL-group/RAIL-group-software/tree/main/modules/lsp_gnn). -->

<p><img src="/assets/posts/lsp-gnn-art.jpg" class="img-responsive center-block " title="LSP GNN Artwork" /></p>

<h2 id="references">References</h2>

<ul>
  <li>R. Dhakal, M. R. Hossain Talukder and G. J. Stein, “Anticipatory Planning: Improving Long-Lived Planning by Estimating Expected Cost of Future Tasks,” <em>2023 IEEE International Conference on Robotics and Automation (ICRA)</em>, <a href="https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;arnumber=10160260">paper</a>.</li>
</ul>]]></content><author><name>Raihan Islam Arnob, Md. Ridwan Hossain Talukder</name></author><category term="[&quot;Research&quot;]" /><category term="Taskplan" /><category term="Planning Under Uncertainty" /><category term="Deep Learning" /><summary type="html"><![CDATA[Imagine a service robot deployed in a household setting, assigned a sequence of tasks to complete—one at a time—within an environment that persists throughout the sequence. However, the robot is not told subsequent tasks in advance, mimicing a realistic scenario when the robot is assigned tasks as the user decides they need to be done.]]></summary></entry><entry><title type="html">When should PhD students meet with their advisor? A guide</title><link href="https://cs.gmu.edu/2024/12/why-have-meetings/" rel="alternate" type="text/html" title="When should PhD students meet with their advisor? A guide" /><published>2024-12-06T04:30:00+00:00</published><updated>2024-12-06T04:30:00+00:00</updated><id>https://cs.gmu.edu/2024/12/why-have-meetings</id><content type="html" xml:base="https://cs.gmu.edu/2024/12/why-have-meetings/"><![CDATA[<p>As an advisor to a team of PhD students as well as a smattering of undergraduate researchers and a PI on a few federal grants, meetings to mentor and manage make up a large portion of my time. Making sure those meetings are maximally productive for everyone involved is critical. That objective is hard to measure: what does it mean for a meeting to be <em>maximally productive</em>? How often should my students meet with me to maximize their benefit? How long should meetings be? What should students work on between meetings? And how can I be sure to be productive of my own time so that meetings don’t entirely consume my life, taking away from the time I also need to consider next steps?</p>

<p>This document gives an overview of how I, as a faculty mentor, think about when and how often my PhD students need to meet with me and what the substance of those meetings should be. While every student and their needs are different, my hope with this guide is to outline a set of principles rather than a set of hard-coded meeting policies, so that the resulting set of meeting practices is flexible to changes in circumstance.</p>

<h2 id="why-have-meetings-what-characterizes-a-worthwhile-meeting">Why have meetings? What characterizes a “worthwhile” meeting?</h2>

<p>My PhD students are both students and researchers: working to advance the forefront of human knowledge while also learning the skills necessary to do so. Meetings exist to help them along that path, to bring me up to speed about how their projects are going, and also make sure they and I come to a shared understanding of what we think are the best next steps. When I meet with a student, I am trying to determine if a student needs <em>course correction</em>: feedback from me to best guide them towards more productive learning or research progress.</p>

<p>With this in mind, I consider a meeting most worthwhile if:
<span class="marginnote note no-word-break invisible-sm" style="margin-top:1em;" aria-label="margin note">I have found that many students seem to believe that being stuck is a reason not to have a meeting, but in reality it’s quite the opposite. A student unable to make progress is often the best reason to have a meeting, so that we can work together towards a solution.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">I have found that many students seem to believe that being stuck is a reason not to have a meeting, but in reality it’s quite the opposite. A student unable to make progress is often the best reason to have a meeting, so that we can work together towards a solution.
</p>

<ul>
  <li><strong>I give a student direction on how to become unstuck</strong>: to make independent progress where they were previously unable. This can include also giving them references to papers or learning materials to better understand something they were not aware of before.</li>
  <li><strong>The student and I collectively come to a new understanding about a problem.</strong> I don’t always (usually?) have the answers, and so discussions surrounding shared problems can be incredibly productive. As I’ll mention later, meetings are only typically productive in this way if the student has already put in considerable time or thought into trying to understand these problems on their own in advance of the meeting. Coming to my office with a simple <em>I don’t know what to do next</em> is rarely particularly valuable.</li>
  <li><strong>I point out something the student has missed.</strong> This is a much more “organic” or “soft” consequence of having meetings and the most difficult to predict. When a student thinks they are making progress but may have overlooked or misunderstood something, my pointing it out can save them days of time or more. <strong>This third element—the “unknown unknowns” for meetings with one’s advisor—is the hardest for students to anticipate, and is a core reason to have meetings even when students don’t believe a meeting is needed.</strong></li>
</ul>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-23em;" aria-label="margin note">Even being able to clearly articulate a new problem is productive! Understanding <em>that</em> a problem exists and making an effort to write it down are important steps towards being able to solve it.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">Even being able to clearly articulate a new problem is productive! Understanding <em>that</em> a problem exists and making an effort to write it down are important steps towards being able to solve it.
</p>

<p>Notably, a consequence of this rather utilitarian list is that “good news” isn’t valued, since it doesn’t really help me to help the student. Of course, I’m a human person, and so collectively celebrating progress or good news can make a meeting worthwhile, even if it usually isn’t time-effective to have an entire meeting devoted to <em>everything we hoped would work now works and I don’t need any guidance</em>.</p>

<h2 id="how-long-should-students-go-between-having-meetings-how-often-should-meetings-discuss-long-horizon-goals">How long should students go between having meetings? How often should meetings discuss long-horizon goals?</h2>

<p>On the other side of the above equation is <em>time</em>: meetings have a cost for everyone involved and if meetings are not likely to prove useful, scheduling a meeting might be counterproductive. In short, students should typically not expect a meeting every day, as the meeting schedule then becomes burdensome. So how long should a student go between having a meeting?</p>

<h4 id="discussing-short-term-progress">Discussing Short-Term Progress</h4>

<p>Students, even newer researchers, are generally pretty good at determining when their progress has slowed or when they have problems that could use further discussion. Thus, this is usually the easiest sort of meeting to schedule and most students will reach out to me unprompted to check in with the aim of getting unstuck every couple of weeks. I generally trust my students to see this sort of hurdle and so leave it to them to schedule this sort of meeting.<span class="marginnote note no-word-break invisible-sm" style="margin-top:-4em;" aria-label="margin note">As I discuss in the next section, students won’t <em>always</em> notice when they are stuck and so I still recommend that they provide a short written weekly check in to ensure they aren’t missing an avenue to improve.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">As I discuss in the next section, students won’t <em>always</em> notice when they are stuck and so I still recommend that they provide a short written weekly check in to ensure they aren’t missing an avenue to improve.
</p>

<h4 id="discussing-long-term-goals">Discussing Long-Term Goals</h4>

<p>It is the tendency of most students to look at this question only through the lens of short term progress: <em>Am I stuck right now? Do I know what task I’m working on next?</em> However, it is just as important that meetings at least occasionally discuss the students overarching goals, including what projects they may want to work on next, the experiments they aim to conduct farther down the line, their graduation timeline, etc. In the absence of these discussions, most students will consider those questions only when necessary, and so it becomes more difficult to do much to change course.</p>

<p>As such, I ask that my students have a chat about their long-horizon objectives for at least 10–15 minutes every meeting, just so that they keep those in mind when thinking about their more immediate aims. I have found that this forces the students to think more broadly about the context in which their short-term goals exist and has led to a steady stream of <em>aha</em> moments where either I or the students realize there exist opportunities to spend a bit of effort now to preemptively advance these longer-term goals or to better align their short-term goals to advance the long-term ones. Though discussing long-term goals isn’t always how the students want to spend their time, I have seen these discussions result in compounding positive effects over time for the students that commit to thinking about them.</p>

<h2 id="regular-check-ins-are-essential-even-absent-a-full-meeting">Regular check-ins are essential, even absent a “full meeting”</h2>

<p>By definition, students cannot anticipate the <em>unknown unknowns</em> in their research. Meeting with their advisor is sometimes the only way that issues in their work will be discovered in advance of it becoming a significant problem. <strong>Short, written status updates between meetings can save considerable time.</strong></p>

<blockquote>
Not every interaction between student and advisor should be an hour-long meeting!
</blockquote>

<p>Recently, I have been recommending that students who go more than a week without having an in-depth meeting provide me with a short written update of what they are working on and their progress. When I see something that I think requires following up, this becomes a trigger to have a meeting together to make sure we are on the same page and that no issue exists. This has proven a happy middle ground for everyone, since it means we don’t have to have as many meetings, but students don’t completely miss out on the benefits of chatting with me.</p>

<h2 id="how-should-one-on-one-meetings-be-structured-how-should-students-prepare-for-meetings">How should one-on-one meetings be structured? How should students prepare for meetings?</h2>

<p>This is the part of the guide that I change most often and so I won’t include my <em>exhaustive</em> thoughts here.<span class="marginnote note no-word-break invisible-sm" style="margin-top:-4em;" aria-label="margin note"><a href="https://rail-group.notion.site/RAIL-One-on-One-Meeting-Guide-cf0ff6e4541e489381301a0e0f86402f">My lab’s meeting guide is available on Notion</a> if you’d like to see my more comprehensive thoughts on the subject of meeting structure and preparation.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote"><a href="https://rail-group.notion.site/RAIL-One-on-One-Meeting-Guide-cf0ff6e4541e489381301a0e0f86402f">My lab’s meeting guide is available on Notion</a> if you’d like to see my more comprehensive thoughts on the subject of meeting structure and preparation.
</p>

<p>I require my students to prepare both the meeting agenda as well as putting together figures, updates, questions, etc. the evening before we meet and add it to our shared meeting space on Notion. This ensures that the student will have ample time to collect their thoughts and ensures that the meeting does not mostly consist of “oh, I forgot” items that significantly diminish productivity. In the morning before we meet, I’ll take a look at this document and add agenda items, my thoughts or insights, or questions for clarification. These additions help to make sure we don’t waste time and can be most productive.</p>

<p><strong>Preparation in advance, mostly by the student by also by me, is essential for effective meetings.</strong> Absent preparation in advance, meetings tend to be unfocused and rambling. Relatedly, a clear agenda is a helpful starting point for a meeting, as it ensures that important topics are not missed.</p>

<p>Finally, meetings conclude with a discussion of long-term goals (as mentioned above) as well as goal setting for the next meeting. My student and I will end the meeting by establishing what they are working towards next and add a few <em>stretch goals</em> to the list for what else they might also try to make progress towards. During my preparation for subsequent meetings, I frequently review this list to ensure we are meeting our internal goals and, if we are falling behind, what we can do to improve or pivot.</p>

<h2 id="there-is-no-one-size-fits-all-meeting-style">There is no one-size-fits-all meeting style</h2>

<p>Different students have different needs. Over the past few years—including the fully-remote COVID years—I have gone through a number of meeting styles, each with their own merits. Some students need the routine of regular meetings while other students might find them a distraction. At different stages of their research or level of experience, meetings may take on a different tone or even be entirely devoted to long-term goals or progress. This guide is just that: <em>a guide</em>. I am flexible with most students, particularly my more senior students, to let them take direction to structure meetings the way they feel most productive.</p>

<p>My general philosophy: try to meet fairly regularly, but always ensure that students check in even when a real-time meeting is not possible. Without these check-ins, progress will slow, as neither I nor the student see hidden opportunities to accelerate or course correct.</p>

<p>And if a student says they need your time, listen to them.</p>]]></content><author><name>Gregory J. Stein</name></author><category term="[&quot;Communication &amp; Learning&quot;]" /><category term="Pedagogy" /><category term="Getting a PhD" /><summary type="html"><![CDATA[As an advisor to a team of PhD students as well as a smattering of undergraduate researchers and a PI on a few federal grants, meetings to mentor and manage make up a large portion of my time. Making sure those meetings are maximally productive for everyone involved is critical. That objective is hard to measure: what does it mean for a meeting to be maximally productive? How often should my students meet with me to maximize their benefit? How long should meetings be? What should students work on between meetings? And how can I be sure to be productive of my own time so that meetings don’t entirely consume my life, taking away from the time I also need to consider next steps?]]></summary></entry><entry><title type="html">PaperOps: run experiments and add results to a PDF with a single Make command</title><link href="https://cs.gmu.edu/2024/5/paperops-demo/" rel="alternate" type="text/html" title="PaperOps: run experiments and add results to a PDF with a single Make command" /><published>2024-05-01T04:29:49+00:00</published><updated>2024-05-01T04:29:49+00:00</updated><id>https://cs.gmu.edu/2024/5/paperops-demo</id><content type="html" xml:base="https://cs.gmu.edu/2024/5/paperops-demo/"><![CDATA[<p>In my work as research faculty and a PhD supervisor, I constantly try to streamline the research process.
Much of that work involves automating running (or re-running) of experiments so that we can quickly test new hypotheses, change parameters, or even just change colors in a figure.</p>

<p>My most recent project has been to develop a simple proof-of-concept in which <em>every aspect</em> of running results to including them in a paper is automated. Simply download the repo from GitHub, run <code class="language-plaintext highlighter-rouge">make paper</code>, and it outputs a PDF file with the results from some simple experiments.</p>

<h2 id="the-demo">The Demo</h2>

<p>After <a href="https://github.com/RAIL-group/paperops-demo">pulling the repository</a> and moving to that directory, we can run:</p>

<pre class="pre-scrollable"><code class="lang-bash">make paper NUM_EXPERIMENTS=25</code></pre>

<p>This simple command runs 25 “experiments”—a simple example task that fits a line to noisy data with and without outlier rejection and compares the two—and generates a plot that contains a scatter plot of those results and computes statistics for the results.
This results in the following PDF, manually cropped to highlight the important bits:</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
<strong>Make paper: 25 experiments.</strong>   The PDF includes the correct number of experiments, statistics, and a scaterplot of those results, all via <code class="language-plaintext highlighter-rouge">make paper NUM_EXPERIMENTS=25</code>.

</note>

<img src="/assets/posts/2024-paperops-example-25-exp.png" class="img-responsive center-block " title="Example with 25 experiments." style="max-height:450px;" />

<note class="img-caption visible-sm" aria-label="image caption"><strong>Make paper: 25 experiments.</strong>   The PDF includes the correct number of experiments, statistics, and a scaterplot of those results, all via <code class="language-plaintext highlighter-rouge">make paper NUM_EXPERIMENTS=25</code>.
</note>
  </p>

<p>The PDF includes the number of experiments run, the mean performance with and without outlier rejection, and a scatter plot of the results: all of which are automatically read from the results and included when the PDF is generated via LaTeX.</p>

<p>Let’s say we now wanted more experiments. No problem! We run the command again, but increasing that parameter and add a <code class="language-plaintext highlighter-rouge">-j20</code> for convenience so that the experiments run 20-at-a-time in parallel:</p>

<pre class="pre-scrollable"><code class="lang-bash">make paper NUM_EXPERIMENTS=800 -j20</code></pre>

<p>which results in the following:</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
<strong>Make paper: 800 experiments.</strong>   The PDF includes the correct number of experiments, statistics, and a scaterplot of those results.

</note>

<img src="/assets/posts/2024-paperops-example-800-exp.png" class="img-responsive center-block " title="Example with 800 experiments." style="max-height:450px;" />

<note class="img-caption visible-sm" aria-label="image caption"><strong>Make paper: 800 experiments.</strong>   The PDF includes the correct number of experiments, statistics, and a scaterplot of those results.
</note>
  </p>

<p>Notice that <em>all</em> the relevant information has been updated automatically, including the plot and the number of experiments and statistics. This is because <code class="language-plaintext highlighter-rouge">make</code> takes care of updating the scatterplot as necessary to reflect the updated results and including the newly-computed statistics.</p>

<p>What happens if we rerun the command?</p>

<pre class="pre-scrollable"><code class="lang-bash">make paper NUM_EXPERIMENTS=800 -j20</code></pre>

<p>We get the following:</p>

<pre class="pre-scrollable"><code class="lang-bash">make: Nothing to be done for `paper'.</code></pre>

<p><code class="language-plaintext highlighter-rouge">make</code> is designed so that it doesn’t redo computation. Since no new results have been added or changes made, the paper is already up-to-date and nothing needs to be done.</p>

<p>How does it all work? Take a look <a href="https://github.com/RAIL-group/paperops-demo">at the code</a> or read on to learn more.</p>

<h2 id="high-level-overview-of-the-process">High-level overview of the process</h2>

<p>We rely on GNU Make to build the outputs. Upong running <code class="language-plaintext highlighter-rouge">make paper</code> all targets upon which the paper relies—including things like the results statistics and the scatterplot—are generated. To generate those, the outputs upon which <em>they</em> rely are also generated, a process that repeats all the way back to the underlying experiments, run automatically to generated the</p>

<p>The following schematic of the dependency structure of <a href="https://github.com/RAIL-group/paperops-demo/blob/main/Makefile">the Makefile</a> and so an overview of the outputs generated automatically to build the PDF of the paper:</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
<strong>A schematic of the Make target dependencies.</strong>   This schematic shows how the different outputs from the code, including the paper itself, depend on others. When running <code class="language-plaintext highlighter-rouge">make paper</code>, all upstream outputs are built as necessary to get the results the paper requires.

</note>

<img src="/assets/posts/2024-paperops-schematic.png" class="img-responsive center-block no-shadow" title="Example with 800 experiments." style="max-height:550px;" />

<note class="img-caption visible-sm" aria-label="image caption"><strong>A schematic of the Make target dependencies.</strong>   This schematic shows how the different outputs from the code, including the paper itself, depend on others. When running <code class="language-plaintext highlighter-rouge">make paper</code>, all upstream outputs are built as necessary to get the results the paper requires.
</note>
  </p>

<h2 id="run-experiments-with-gnu-make">Run experiments with GNU Make</h2>

<p>While the <a href="https://rail-group.notion.site/Using-GNU-Make-to-build-code-and-run-experiments-beb78c4f0afe4956813dd4cb7e387415?pvs=74">fundamentals of GNU Make</a> are beyond the scope of this post, we take advantage of some fairly-specific setup to support changing the number of experiments.</p>

<p>The Make “target” is what is called whenever we want to generate a result. Let’s say we wanted to generate a result for random seed 105 using the least squares line fitting method, accomplished via</p>

<pre class="pre-scrollable"><code>make results/results_lstsq_105.csv</code></pre>

<p>We use the <code class="language-plaintext highlighter-rouge">%</code> wildcard character to define the Make target and use some simple string processing (via <code class="language-plaintext highlighter-rouge">grep</code>) to extract the <em>seed</em> and curve fitting <em>approach</em> from the name of the intended file:</p>

<div class="listing-caption visible-sm">The make target for a single experiment. We use Docker to show how this can all be containerized, but its use is optional. <code class="code-language">makefile</code></div>
<div class="sidenote listing-caption invisible-sm"><div>The make target for a single experiment. We use Docker to show how this can all be containerized, but its use is optional.</div><div class="unit-line-height"><code class="code-language">makefile</code></div></div>
<pre><code class="lang-makefile pre-scrollable">results/results_%.csv: seed = $(shell echo $@ | grep -Eo '[0-9]+' | tail -1)
results/results_%.csv: approach = $(shell echo $@ | grep -Eo '(lstsq|ransac)' | tail -1)
results/results_%.csv:
        @echo "Evaluating result for $(approach): $(seed)\n"
        @mkdir -p results/
        @$(DOCKER_BASE) python3 /src/evaluate_approach.py \
                --seed $(seed) --approach $(approach)</code></pre>

<p>The Python script here is just a simple example, meant to show how extracting some information from the name of the file to be generated can be passed as inputs to the script.</p>

<p>We separately define two variables in Make that automatically populate two lists with all the file names that we would like generated, corresponding to <code class="language-plaintext highlighter-rouge">NUM_EXPERIMENTS</code> experiments for each of the least squares (<code class="language-plaintext highlighter-rouge">lstsq</code>) and <sc>ransac</sc> outlier rejection (<code class="language-plaintext highlighter-rouge">ransac</code>) line fitting strategies:</p>

<div class="listing-caption visible-sm">Creating the list of files to be generated through our experiments. <code class="code-language">makefile</code></div>
<div class="sidenote listing-caption invisible-sm"><div>Creating the list of files to be generated through our experiments.</div><div class="unit-line-height"><code class="code-language">makefile</code></div></div>
<pre><code class="lang-makefile pre-scrollable">eval-lstsq-seeds = \
        $(shell for ii in $$(seq 10000 $$((10000 + $(NUM_EXPERIMENTS) - 1))); \
                do echo "results/results_lstsq_$${ii}.csv"; done)
eval-ransac-seeds = \
        $(shell for ii in $$(seq 10000 $$((10000 + $(NUM_EXPERIMENTS) - 1))); \
                do echo "results/results_ransac_$${ii}.csv"; done)</code></pre>

<p>Now, if we had a separate make target that depended on <code class="language-plaintext highlighter-rouge">eval-lstsq-seeds</code>, it would automatically generate all those experiments before it could be run. Adding dependencies like this allows us to enforce that all experiments be finished before we try to perform operations to compute statistics from the data or generate the scatterplot.</p>

<h2 id="process-results-and-output-figures">Process results and output figures</h2>

<p>Generating results and statistics requires a few more Make targets. For example, here is the Make target used to generate the scatterplot via Python:</p>

<div class="listing-caption visible-sm">Make target for generating the base scatterplot. <code class="code-language">makefile</code></div>
<div class="sidenote listing-caption invisible-sm"><div>Make target for generating the base scatterplot.</div><div class="unit-line-height"><code class="code-language">makefile</code></div></div>
<pre><code class="lang-makefile pre-scrollable">results/processed_scatterplot.png: src/process_results.py $(eval-lstsq-seeds) $(eval-ransac-seeds)
	@echo "Generating the results scatterplot."
	@$(DOCKER_BASE) python3 /src/process_results.py --output scatterplot</code></pre>

<p>This yields the following figure:</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
The scatterplot automatically output from Python. Note that it lacks the annotations that appear in the examples above.

</note>

<img src="/assets/posts/2024-paperops-scatter-base.png" class="img-responsive center-block " title="Base scatterplot output from Python." style="max-height:250px;" />

<note class="img-caption visible-sm" aria-label="image caption">The scatterplot automatically output from Python. Note that it lacks the annotations that appear in the examples above.
</note>
  </p>

<p>You might notice that the figure lacks the annotations that appear in the PDF. It is often unrealistic to add every annotation and highlight in the Python specification, and so other design software is often used to include such additions by hand, manually placing annotations and text where appropriate to make an effective figure.</p>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-8em;" aria-label="margin note">For those of you who have used Python’s Matplotlib to make figures, you will understand why trying to place every bit of text or annotation with code is typically non-ideal, often requiring far more time and effort than simply drawing a circle and adding a text box in some other program.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">For those of you who have used Python’s Matplotlib to make figures, you will understand why trying to place every bit of text or annotation with code is typically non-ideal, often requiring far more time and effort than simply drawing a circle and adding a text box in some other program.
</p>

<p>We use Inkscape—a free and open source vector design software—to add annotations to the figure. Inkscape, like other design software, supports <em>linking resources</em>: the Inkscape .svg file includes only a <em>reference</em> to the underlying scatterplot, so that the Inkscape version of the figure will reflect any changes to the linked images. The Inkscape document uses the underlying scatterplot and includes annotations:</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
Scatterplot with annotations from Inkscape.

</note>

<img src="/assets/posts/2024-paperops-scatter-inkscape.png" class="img-responsive center-block " title="Scatterplot with annotations from Inkscape." style="max-height:300px;" />

<note class="img-caption visible-sm" aria-label="image caption">Scatterplot with annotations from Inkscape.
</note>
  </p>

<p>We have a <a href="https://github.com/RAIL-group/paperops-demo/blob/main/Makefile#L49">separate Make target</a> that converts the .svg Inkscape file to a .png, so that it may be included in the PDF document later on. For this purpose, we run a headless instance of Inkscape inside a Docker container, avoiding the need to find or run a local instance of Inkscape.</p>

<h2 id="adding-result-statistics-to-the-pdf">Adding result statistics to the PDF</h2>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:;" aria-label="margin note"><strong>On Using Pure LaTeX:</strong> I show off Emacs here, since it is what I use when composing papers, but there <em>are</em> pure LaTeX solutions to this problem. See <a href="https://stackoverflow.com/questions/29078107/insert-values-from-a-file-in-a-latex-document">this Stack Overflow post</a> about how to use the <code class="language-plaintext highlighter-rouge">datatool</code> package for this purpose.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote"><strong>On Using Pure LaTeX:</strong> I show off Emacs here, since it is what I use when composing papers, but there <em>are</em> pure LaTeX solutions to this problem. See <a href="https://stackoverflow.com/questions/29078107/insert-values-from-a-file-in-a-latex-document">this Stack Overflow post</a> about how to use the <code class="language-plaintext highlighter-rouge">datatool</code> package for this purpose.
</p>

<p>In this demo, I use Emacs’ Org-mode as a markup language to compose the paper. Org-mode is a powerful and customizable note taking environment that lets me write a document in a fairly simple syntax and then export it to a .tex file, from which a PDF can be generated. In addition, Org-mode lets me run arbitrary Python code upon export, letting me load a Python .pickle file from data and incorporate the data contained within in the document.</p>

<p>Here is a simple example with code from the paper that: (1) defines the <code class="language-plaintext highlighter-rouge">pythonval</code> macro for printing values from Python; (2) defines some LaTeX-specific export options; (3) runs a <code class="language-plaintext highlighter-rouge">src</code> block that loads the data file output from our Python commands above; and (4) includes some exmple text:</p>

<div class="listing-caption visible-sm">An example block of text in org-mode that loads in variables from a Python pickle file and includes those values when exporting to a PDF via LaTeX. For more, <a href="https://github.com/RAIL-group/paperops-demo/blob/main/paper/main.org?plain=1">see our repo</a>. <code class="code-language">org-mode</code></div>
<div class="sidenote listing-caption invisible-sm"><div>An example block of text in org-mode that loads in variables from a Python pickle file and includes those values when exporting to a PDF via LaTeX. For more, <a href="https://github.com/RAIL-group/paperops-demo/blob/main/paper/main.org?plain=1">see our repo</a>.</div><div class="unit-line-height"><code class="code-language">org-mode</code></div></div>
<pre><code class="lang-org-mode pre-scrollable">* LaTeX Configuration :noexport:

#+macro: pythonval src_python[:session :results raw]{$1}
#+LATEX_CLASS_OPTIONS: [10pt]

#+begin_src python :session :results none :exports none
import pickle
with open("../results/processed_results_data.pickle", 'rb') as handle:
    d = pickle.load(handle)
#+end_src

* Some text for the paper

We ran {{{pythonval(d['num_seeds'])}}} experiments 
and saw an improvement of {{{pythonval(f"{100*(d['mse_lstsq'] - 
d['mse_ransac'])/d['mse_lstsq']:0.1f}")}}}%.</code></pre>

<p>Exporting this code to a PDF, the resulting .tex file includes the values computed via python and so yields the examples above.</p>

<h2 id="conclusion-automation-in-the-rail-group">Conclusion: automation in the RAIL Group</h2>

<p>This pipeline gives an overview of how we automate and streamline experimentation in my research lab. We routinely build research pipelines around automated running of experiments as necessary.
This level of automated running of experiments dramatically helps facilitate the trying of new ideas. Not only has it proven an effective tool for reproducible research, but also it has made it easy to quickly run additional experiments in the run up to a paper deadline and generate new results in response to reviewers.</p>

<p>See also <a href="https://github.com/RAIL-group/RAIL-group-software">our lab’s public code repository</a> for examples of our Make- and Docker-based workflow in practice.</p>

<p>Any questions or comments, feel free to reach out to me <a href="https://twitter.com/GregoryJStein">on Twitter</a>.</p>]]></content><author><name>Gregory J. Stein</name></author><category term="[&quot;Workflow &amp; Process&quot;]" /><category term="Development" /><summary type="html"><![CDATA[In my work as research faculty and a PhD supervisor, I constantly try to streamline the research process. Much of that work involves automating running (or re-running) of experiments so that we can quickly test new hypotheses, change parameters, or even just change colors in a figure.]]></summary></entry><entry><title type="html">Improving Reliable Navigation under Uncertainty with Non-Local Information Informed Predictions</title><link href="https://cs.gmu.edu/2023/10/reliable-non-local-nav/" rel="alternate" type="text/html" title="Improving Reliable Navigation under Uncertainty with Non-Local Information Informed Predictions" /><published>2023-10-01T04:00:00+00:00</published><updated>2023-10-01T04:00:00+00:00</updated><id>https://cs.gmu.edu/2023/10/reliable-non-local-nav</id><content type="html" xml:base="https://cs.gmu.edu/2023/10/reliable-non-local-nav/"><![CDATA[<p>We focus on the task of goal-directed navigation in a partially-mapped environment, in which a robot is expected to reach an unseen goal in minimum expected time.  To perform well, a robot must understand how parts of the environment the robot cannot currently see (i.e., non-locally available information) to inform where it should go next, a challenging problem for many existing planning strategies that rely on learning. For example, consider the following:</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
(1) Trying to reach a faraway goal, the robot sees the sign and turns right. (2) Taking right, the sign is no longer in view. If the robot does not remember what it has seen before, it cannot predict about the unseen space

</note>

<img src="/assets/posts/lsp-gnn-intro-fig.png" class="img-responsive center-block " title="lsp-gnn-intro-fig" />

<note class="img-caption visible-sm" aria-label="image caption">(1) Trying to reach a faraway goal, the robot sees the sign and turns right. (2) Taking right, the sign is no longer in view. If the robot does not remember what it has seen before, it cannot predict about the unseen space
</note>
  </p>

<blockquote>
  <p>To navigate efficiently, the robot may need to remember what it has seen and make use of that information to inform its decision-making.</p>
</blockquote>

<hr />

<p>Consider the following scenario, in which the robot starts in a location where it must decide whether to head left or right at an intersection, yet lacks the information it needs to determine which way it should go.
If the robot remembers what lies around the corner—a region whose color indicates which hallway it should follow—it can make more effective decisions about where to head and reach the goal more quickly.</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
In order to plan, the robot makes predictions about unseen space. Those prediction may require non-local information.

</note>

<img src="/assets/posts/lsp-gnn-j-explain.png" class="img-responsive center-block " title="lsp-gnn-j-explain" style="max-height:200px;" />

<note class="img-caption visible-sm" aria-label="image caption">In order to plan, the robot makes predictions about unseen space. Those prediction may require non-local information.
</note>
  </p>

<p>The robot cannot effectively decide where to go if it cannot make use of the non-local information from its starting location in the center of the map.</p>

<h2 id="challenge-reliable-navigation-under-uncertainty-that-leverages-non-local-information">Challenge: reliable navigation under uncertainty that leverages <em>non-local information</em></h2>

<p>To improve long-horizon navigation in partiallly-mapped environments, we want an approach that:</p>
<ul>
  <li><code class="language-plaintext highlighter-rouge">(1)</code> is reliable, guarantee to reach the goal when there exists a solution, and</li>
  <li><code class="language-plaintext highlighter-rouge">(2)</code> has the capacity to make use of non-local information to make prediction about unseen space to guide navigation</li>
</ul>

<p>Many learning-driven approaches—including many model-free approaches trained via deep reinforcement learning—have demonstrated the capacity to perform well in this domain. However, in the absence of an explicit map, many of these approaches are unreliable and so lack a guarantee to reach the goal.</p>

<p><em>Learning over Subgoals Planning</em> The recent Learning over Subgoals Planning (LSP) approach of <a href="#stein2018subgoal">Stein et al. (2018)</a> introduces a high-level action abstraction for planning in a partial map where actions represent exploring boundaries beyond known space into unseen space. This abstraction allows for both state-of-the-art performance when planning for long horizon and reliability-by-design. However, LSP is limited: its ability to make predictions about unseen space only makes use of locally observable information, limiting its performance.</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
When goal is around 100 meters away in the direction of a classroom door, the  Learing over Subgoal Planning approach avoids entering the classroom, predicting it will likely be a dead-end.

</note>

<img src="/assets/posts/s21-hallway-example.png" class="img-responsive center-block " title="lsp-intro" style="max-height:270px;" />

<note class="img-caption visible-sm" aria-label="image caption">When goal is around 100 meters away in the direction of a classroom door, the  Learing over Subgoal Planning approach avoids entering the classroom, predicting it will likely be a dead-end.
</note>
  </p>

<h2 id="approach">Approach</h2>
<ul>
  <li><code class="language-plaintext highlighter-rouge">1</code> Use the <em>reliable-by-design</em> model-based LSP planning abstraction</li>
  <li><code class="language-plaintext highlighter-rouge">2</code> Create a graph representation for <em>non-local information</em> and use a graph neural network (GNN) for <em>learning</em> to inform good behavior</li>
</ul>

<h3 id="we-maintain-reliability-using-lsp-action-abstraction">We maintain reliability using LSP action abstraction</h3>
<!-- ### We use action abstraction put forth by Learning over Subgoal Planning approach to maintain reliability -->
<p>LSP uses high-level action abstraction to navigate long-horizon efficiently under uncertainty. This model-based planning abstraction alleviates the computational requirements of POMDP planning. For LSP planning, actions available to the robot have binary outcomes of either reaching the goal and incurring a success cost or failing and accumulating exploration cost.</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
The simplified high-level action abstraction of LSP allows for reliable-by-design long horizon navigation under uncertainty even when predictions about unseen space are not good.

</note>

<img src="/assets/posts/lsp-gnn-explain-lsp-action.png" class="img-responsive center-block " title="lsp-gnn-explain-lsp-action" />

<note class="img-caption visible-sm" aria-label="image caption">The simplified high-level action abstraction of LSP allows for reliable-by-design long horizon navigation under uncertainty even when predictions about unseen space are not good.
</note>
  </p>

<p>Under this abstraction, the expected cost of a high-level action is determined via a Bellman Equation:</p>

\[Q(\{m_t, q_t\}, a_t\in  \mathcal{A}) = D(m_t, q_t, a_t) + P_S(a_t) R_S(a_t) + (1-P_S(a_t)) \left[R_E(a_t) + \min_{a_{t+1}}Q(\{m_t, q(a_t)\},a_{t+1}) \right]\]

<p>where $D$ is the known space travel cost from robot pose $q_t$ with the partial map $m_t$ by taking the action $a_t$, $P_S$ is the likelihood of success for an action, $R_S$ is the expected success cost if goal can be reached, and $R_E$ is the expected exploration cost otherwise.</p>

<p>For more details on how the Learning over Subgoal Planning approach works, please see our <a href="../../../2021/11/explainable-navigation-under-uncertainty">blog post</a>.</p>

<h3 id="we-compute-a-graph-representation-of-the-map-for-learning-via-a-graph-neural-network-gnn">We compute a graph representation of the map for learning via a graph neural network (GNN)</h3>
<p>To learn from non-local information, we generate a simplified (few-node) graph of the environment using a skeletonization process that preserves the high-level topological structure, where nodes exist at (i) intersections, (ii) dead-ends, and (iii) subgoals. Then we feed the graph into a Graph Neural Network (GNN) to estimate the subgoal properties.</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
A schematic of our graph creation process, in which a skeletonize routine spartisifies the map and adds nodes at dead ends, intersections, and frontiers.

</note>

<img src="/assets/posts/lsp-gnn-compute-graph.png" class="img-responsive center-block " title="lsp-gnn-compute-graph" />

<note class="img-caption visible-sm" aria-label="image caption">A schematic of our graph creation process, in which a skeletonize routine spartisifies the map and adds nodes at dead ends, intersections, and frontiers.
</note>
  </p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
In the graph—shown on the right side—the dead-end nodes (with degree 1) and the intersection nodes (with degree &gt; 2) are represented by the structural nodes: ‘+’, and the subgoals are represented by subgoal nodes: ‘•’

</note>

<img src="/assets/posts/lsp-gnn-sample-graph.png" class="img-responsive center-block " title="lsp-gnn-sample-graph" />

<note class="img-caption visible-sm" aria-label="image caption">In the graph—shown on the right side—the dead-end nodes (with degree 1) and the intersection nodes (with degree &gt; 2) are represented by the structural nodes: ‘+’, and the subgoals are represented by subgoal nodes: ‘•’
</note>
  </p>

<p>Here, we show a short video of the robot navigating through the environment alongside a graph representation of the environment:</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
Left: subgoal abstraction view. Right: skeleton view overlaied on underlying known map.

</note>

<img src="/assets/posts/lsp-gnn-skeleton-trajectory.gif" class="img-responsive center-block " title="lsp-gnn-skeleton-trajectory" style="max-height:275px;" />

<note class="img-caption visible-sm" aria-label="image caption">Left: subgoal abstraction view. Right: skeleton view overlaied on underlying known map.
</note>
  </p>

<h2 id="result-our-approach-reaches-the-goal-quickly">Result: our approach reaches the goal quickly</h2>

<p>Our approach learns how a dead-end room looks like and uses this non-local information to improve its prediction avoiding it later on to quickly reach the goal.</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
LSP-GNN uses non-local information to make predictions about unseen space to quickly reach the goal, as shown here in samples from our MIT Floor Plan environment.

</note>

<img src="/assets/posts/lsp-gnn-results-floor-plan.png" class="img-responsive center-block " title="LSP-GNN Floor Plan Result" />

<note class="img-caption visible-sm" aria-label="image caption">LSP-GNN uses non-local information to make predictions about unseen space to quickly reach the goal, as shown here in samples from our MIT Floor Plan environment.
</note>
  </p>

<p>We include results on a simulated robot in both procedurally-generated hallway-like environments and also in environments generated from occupancy maps of floorplans around MIT’s campus. <strong>In all environments, our LSP-GNN approach outperforms both learned and non-learned baselines.</strong></p>

<p>See <a href="https://arxiv.org/pdf/2307.14501.pdf">our paper</a> for additional results.</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
LSP-GNN (ours) uses non-local information to make predictions about unseen space to quickly reach the goal.

</note>

<img src="/assets/posts/lsp-gnn-floor-plan-trajectory.gif" class="img-responsive center-block " title="LSP-GNN Floor Plan Trajectory Video" style="max-height:220px;" />

<note class="img-caption visible-sm" aria-label="image caption">LSP-GNN (ours) uses non-local information to make predictions about unseen space to quickly reach the goal.
</note>
  </p>

<h2 id="conclusion--references">Conclusion &amp; References</h2>

<!-- We have shown how the Learning over Subgoals planning abstraction can be used to generate high-quality explanations for long-horizon planning decision in partially-revealed environments and allows for state-of-the-art performance. Our training-by-explaining strategy links test-time performance the goodness of our explanations, providing an objective measure of explanation quality. Finally, our approach enables explainable interventions, whereby a single explanation is used to correct poor behavior, showing that the explanations are sufficiently rich with information that they can be used to improve performance. -->
<p>We present a reliable model-based planning approach that uses a graph neural network to estimate the goodness of goal- directed high-level actions from both local and non-local information, improving navigation under uncertainty. Our planning approach takes advantage of non-local information to improve predictions about unseen space and quickly reach the unseen goal.</p>

<p>In future work, we envision passing more complex sensory input to the robot, allowing it to estimate the goodness of its actions using information collected from image sensors or semantically-segmented images.</p>

<p>Read <a href="https://arxiv.org/pdf/2307.14501.pdf">our full paper</a> or feel free to explore our code <a href="https://github.com/RAIL-group/RAIL-group-software/tree/main/modules/lsp_gnn">on GitHub</a>.</p>

<p><img src="/assets/posts/lsp-gnn-art.jpg" class="img-responsive center-block " title="LSP GNN Artwork" /></p>

<h2 id="references">References</h2>

<ul>
  <li>Gregory J. Stein, Christopher Bradley, and Nicholas Roy. “Learning over Subgoals for Efficient Navigation of Structured, Unknown Environments”. In: <em>Conference on Robot Learning (CoRL)</em>. 2018. <a href="http://proceedings.mlr.press/v87/stein18a.html">paper</a>, <a href="https://youtu.be/4eHdGUoLlpg">talk (14 min)</a>.</li>
  <li>Raihan Islam Arnob and Gregory J. Stein. “Improving Reliable Navigation under Uncertainty via Predictions Informed by Non-Local Information.” In: <em>International Conference on Intelligent Robots and Systems (IROS)</em>. 2023. <a href="https://arxiv.org/pdf/2307.14501.pdf">paper</a>.</li>
</ul>]]></content><author><name>Raihan Islam Arnob</name></author><category term="[&quot;Research&quot;]" /><category term="Navigation" /><category term="Planning Under Uncertainty" /><category term="Deep Learning" /><summary type="html"><![CDATA[We focus on the task of goal-directed navigation in a partially-mapped environment, in which a robot is expected to reach an unseen goal in minimum expected time. To perform well, a robot must understand how parts of the environment the robot cannot currently see (i.e., non-locally available information) to inform where it should go next, a challenging problem for many existing planning strategies that rely on learning. For example, consider the following:]]></summary></entry><entry><title type="html">Data-Efficient Policy Selection for Navigation in Partial Maps</title><link href="https://cs.gmu.edu/2023/9/data-efficient-policy-selection/" rel="alternate" type="text/html" title="Data-Efficient Policy Selection for Navigation in Partial Maps" /><published>2023-09-30T04:09:00+00:00</published><updated>2023-09-30T04:09:00+00:00</updated><id>https://cs.gmu.edu/2023/9/data-efficient-policy-selection</id><content type="html" xml:base="https://cs.gmu.edu/2023/9/data-efficient-policy-selection/"><![CDATA[<p>Consider a robot that is tasked to navigate to an unseen goal in a maze in which a green path on the floor signals the route to the goal.
The robot’s behavior is guided by a policy that determines what action the robot should take at any point during navigation.
In the figure below, the robot comes across a fork while trying to find the goal:
​</p>
<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
At a fork while trying to find the goal that exists to the <em>left</em> side of the fork, a policy that guides the robot <em>right</em> will incur a greater distance.

</note>

<img src="/assets/posts/maze-green-navigation-fork-on-path.png" class="img-responsive center-block " title="maze-green-navigation-fork-on-path" style="max-height:200px;" />

<note class="img-caption visible-sm" aria-label="image caption">At a fork while trying to find the goal that exists to the <em>left</em> side of the fork, a policy that guides the robot <em>right</em> will incur a greater distance.
</note>
  </p>

<p>If the robot’s policy in this scenario is to navigate towards the <em>left</em> side of the fork where the floor has a green path, then we know that the robot followed the correct path to the goal.
However, if the robot’s policy is to navigate towards the <em>right</em> side of the fork where the floor does not seem to have a green path, we know that the robot will go towards a dead end from which it will have to ultimately backtrack resulting in a greater travel distance.
​</p>
<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
A policy that guides the robot towards the <em>right</em> side of the fork performs poorly compared to the policy guides the robot towards the <em>left</em> side of the fork.

</note>

<img src="/assets/posts/maze-green-two-policies-path-comparison.png" class="img-responsive center-block " title="maze-green-two-policies-path-comparison" style="max-height:250px;" />

<note class="img-caption visible-sm" aria-label="image caption">A policy that guides the robot towards the <em>right</em> side of the fork performs poorly compared to the policy guides the robot towards the <em>left</em> side of the fork.
</note>
  </p>

<p>In these two scenarios, we know that any policy that guides the robot towards the <em>right</em> side of the fork will likely result in poor performance compared to a policy that follows the green path at every fork. Indeed, as shown in the figure above, this is what we observe when we deploy the robot with these policies.
Given such knowledge, we would want the robot to avoid using a policy that we know will yield a poor performance and select a policy that we know will result in better performance—a problem we refer to as <em>policy selection</em>.
<span class="marginnote note no-word-break invisible-sm" style="margin-top:-7em;" aria-label="margin note">The policy that guides the robot towards <em>right</em> goes on to perform even more poorly later on, but the claim still holds even if it had performed better at a later stage during navigation.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">The policy that guides the robot towards <em>right</em> goes on to perform even more poorly later on, but the claim still holds even if it had performed better at a later stage during navigation.
</p>

<p>However, how can we know which of the policies will result in good performance and which will result in poor performance?
Well, we can let the robot deploy each policy one after another and evaluate which of these policies guides the robot to the goal in minimum distance.
But, this procedure is costly since we have to deploy the robot multiple times with each policy and wait for it to reach the goal—or fail to do so—before we can determine the best policy, which minimizes distance traveled to reach the goal.</p>

<p>In our work, we develop a procedure that allows a robot to quickly identify which of its policies will result in the best performance upon deployment without having to deploy the robot with all of its policies.
Quick identification of the best policy is enabled by our novel <em>offline alt-policy replay</em> approach which effectively allows the robot to <em>imagine</em> what it would have done had it instead used a different policy, thereby sparing the robot from having to deploy all of its policies.</p>

<hr style="margin: 0px" />

<p>In this article, we discuss <a href="https://arxiv.org/abs/2304.01094">our recent IROS 2023 paper</a> <em>Data-Efficient Policy Selection for Navigation in Partial Maps via Subgoal-Based Abstraction</em> which presents a data-efficient policy selection approach in which a robot tasked to navigate to an unseen goal in partially-mapped environments can quickly and reliably identify which of its policies will result in the best performance upon deployment.
The article is targeted towards an audience with a basic understanding of robot navigation. However, I will try to provide relevant context or point to resources that might be useful for a more general audience wherever necessary. I have also attached a five-minute video presentation below which covers much of what is discussed in this article. Feel free to check it out before diving into the article.</p>
<div class="embed-responsive embed-responsive-16by9"><iframe class="embed-responsive-item" src="https://www.youtube.com/embed/dVS65vXofTs" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>

<h2 id="policy-selection-as-an-instance-of-multi-armed-bandit-problem">Policy Selection as an Instance of Multi-armed Bandit Problem</h2>
<p>One way of formulating the problem of identifying the best-performing policy from a family of policies is in terms of the <em>multi-armed bandit</em> problem—also known as the <em>model selection</em> problem.
A multi-armed bandit problem is a sequential decision-making problem in which an agent must repeatedly choose between a set of actions, each of which has an unknown reward or cost associated with it.
The goal of the agent is to maximize the total reward or minimize the total cost it receives over multiple trials.
<span class="marginnote note no-word-break invisible-sm" style="margin-top:-6em;" aria-label="margin note">The name <em>multi-armed bandit</em> comes from an old term for slot machines, that each have one arm and steal your money. <em>Multi-armed bandit</em> can be thought of as a set of slot machines: many lever arms each with a different reward scheme.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">The name <em>multi-armed bandit</em> comes from an old term for slot machines, that each have one arm and steal your money. <em>Multi-armed bandit</em> can be thought of as a set of slot machines: many lever arms each with a different reward scheme.
</p>
<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:0em;" aria-label="margin note">Sutton and Barto’s <em>Reinforcement Learning</em> book is a great reference if you want to dive deeper into multi-armed bandit (and RL in general). Here is <a href="https://www.andrew.cmu.edu/course/10-703/textbook/BartoSutton.pdf">a link</a> to a PDF of the book the authors make available for free.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">Sutton and Barto’s <em>Reinforcement Learning</em> book is a great reference if you want to dive deeper into multi-armed bandit (and RL in general). Here is <a href="https://www.andrew.cmu.edu/course/10-703/textbook/BartoSutton.pdf">a link</a> to a PDF of the book the authors make available for free.
</p>

<p>One might see that the problem of policy selection is quite similar to the multi-armed bandit problem. In fact, it is an instance of the multi-armed bandit problem. In policy selection, the agent is the robot, the actions are the policies the robot has to select among, and the reward or cost is the performance of the policy measured in terms of the distance traveled by the robot to reach the goal under that policy. The goal of the robot is to minimize the total distance traveled to reach the goal over multiple trials.</p>

<p>Once we instantiate policy selection as a multi-armed bandit problem, we can use bandit algorithms to identify the best-performing policy. For example, consider the well-known Upper Confidence Bound (UCB) bandit algorithm [<a href="#lai1985asymptotically">Lai and Robbins, 1985</a>] to select a policy in trial $k+1$ as described by the equation below.</p>

\[\DeclareMathOperator*{\argmin}{argmin}
  \pi^{k+1} = \argmin_{\pi \in \mathcal{P}}
  \Bigg[\bar{C}_k(\pi) - c\sqrt{\cfrac{\ln{k}}{n_k(\pi)}}
  \,\Bigg]\]

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-6em;" aria-label="margin note">Attentive readers may notice that the given equation represents a lower confidence bound (LCB) instead of a UCB since our performance estimates are represented as <em>costs</em> instead of <em>rewards</em>, and is therefore minimized.
We use the more common term UCB to mean the approach in general rather than the upper bound itself.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">Attentive readers may notice that the given equation represents a lower confidence bound (LCB) instead of a UCB since our performance estimates are represented as <em>costs</em> instead of <em>rewards</em>, and is therefore minimized.
We use the more common term UCB to mean the approach in general rather than the upper bound itself.
</p>

<p>where, $\mathcal{P}$ is the set of policies to choose from, $\bar{C}_k(\pi)$ is the mean deployment cost of a policy $\pi$ so far, $k$ is the total number of trials completed, $n_k(\pi)$ is the number of times policy $\pi$ has been selected, and $c$ is the exploration parameter.</p>

<p>Intuitively, UCB trades off between selecting the policies with better performance so far, also known as <em>exploitation</em>, and selecting policies that have the potential for better performance​, also known as <em>exploration</em>.
However, such bandit algorithms are often <em>black-box</em> and generally require the robot to go through multiple deployment trials and incur poor behavior before such policies can be ruled out. This results in very slow convergence towards the best policy and accumulation of large regret.
Besides, such a procedure is lengthy and expensive, especially for robot navigation where the result of a navigation trial with a policy is known only after the robot reaches the goal or when it fails to do so.</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
In our experiments with one of the simulated maze environments, UCB bandit takes many trials before converging towards the best policy accumulating large regret.​

</note>

<img src="/assets/posts/policy-selection-ucb-maze-green-results.png" class="img-responsive center-block " title="policy-selection-ucb-maze-green-results" style="max-height:350px;" />

<note class="img-caption visible-sm" aria-label="image caption">In our experiments with one of the simulated maze environments, UCB bandit takes many trials before converging towards the best policy accumulating large regret.​
</note>
  </p>

<h2 id="accelerating-bandit-like-policy-selection">Accelerating Bandit-like Policy Selection</h2>
<p>If we are to accelerate policy selection, we must be able to quickly tighten the bounds on expected performance for each policy, prioritizing the selection of the most promising policies with fewer trials.
As such, we seek to constrain policy selection by determining how well an alternative policy <em>could have performed</em> if it had instead been in charge.
While we cannot re-deploy the robot to repeat the same trial with another policy, information collected during the trial can be used to scrutinize alternative behaviors and potentially avoid unnecessary exploration.
Such a <em>white-box</em> approach can be used to imbue the robot with an ability to <em>introspect</em> the behavior of alternative policies without the need for repeated and costly deployments.</p>

<p>In the section below, we discuss our novel <em>offline alt-policy replay</em> that enables such <em>introspection</em> of the behavior of alternative policies. This allows us to compute a lower bound on the performance of a policy without deploying it in an environment, and thereby more <em>tightly</em> constrain bandit-like selection.</p>

<h2 id="offline-alt-policy-replay">Offline Alt-Policy Replay</h2>
<p>In our novel <em>offline alt-policy replay</em> approach, we perform a simulated offline replay of a policy using the information collected by the robot during navigation under a different policy.
Specifically, we use the final partial map and the images collected by the robot during a navigation trial to perform simulated navigation of the robot within the boundaries of the partial map with an alternative policy.
<span class="marginnote note no-word-break invisible-sm" style="margin-top:-6em;" aria-label="margin note">We say <em>offline replay</em> because the robot doesn’t <em>actually</em> navigate in the environment, it only simulates the navigation based on the information collected during <em>actual</em> navigation.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">We say <em>offline replay</em> because the robot doesn’t <em>actually</em> navigate in the environment, it only simulates the navigation based on the information collected during <em>actual</em> navigation.
</p>

<p>Such offline replay gives us a lower bound on the deployment cost in case the alternative policy was instead in charge.
This means that even after deploying the robot with only one policy, we now have some information about all other policies that can be used to inform bandit-like selection.
To accommodate the new lower bound costs of policies computed with offline replay into a bandit-like selection procedure, we propose the Constrained UCB bandit equation as follows.</p>

\[\pi^{k+1} = \argmin_{\pi \in \mathcal{P}}
  \Bigg[\max \Bigg(
  C^{\text{lb}}_k(\pi),
  \bar{C}_k(\pi) - c\sqrt{\cfrac{\ln{k}}{n_k(\pi)}}
  \,\Bigg)\Bigg]\]

<p>where $C^{\text{lb}}_k(\pi)$ is the lower bound on the deployment cost of a policy $\pi$ computed using offline alt-policy replay.
Our Constrained UCB bandit policy selection with offline alt-policy replay is illustrated in the figure below.</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
Overview of Policy Selection with Offline Alt-Policy Replay​

</note>

<img src="/assets/posts/policy-selection-with-offline-replay.png" class="img-responsive center-block " title="policy-selection-with-offline-replay" />

<note class="img-caption visible-sm" aria-label="image caption">Overview of Policy Selection with Offline Alt-Policy Replay​
</note>
  </p>

<p>This procedure runs as follows. Before a navigation trial, the robot selects one of the policies and uses it to navigate to the goal.
​</p>
<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
<strong>Navigation Trial:</strong> The robot has selected the policy <code class="language-plaintext highlighter-rouge">LSPOffice</code> which was trained in similar office environments and navigates to the goal location with this policy.​

</note>

<img src="/assets/posts/office-deployment-trial-animation.gif" class="img-responsive center-block " title="office-deployment-trial-animation" />

<note class="img-caption visible-sm" aria-label="image caption"><strong>Navigation Trial:</strong> The robot has selected the policy <code class="language-plaintext highlighter-rouge">LSPOffice</code> which was trained in similar office environments and navigates to the goal location with this policy.​
</note>
  </p>

<p>After the trial is complete, our offline alt-policy replay approach uses the partial map and images collected during the trial to compute lower bounds on the performance of other alternative policies without deploying.​</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
<strong>Offline Alt-Policy Replay:</strong> After the trial is complete, the robot uses the partial map and the images collected during the trial to replay a different policy <code class="language-plaintext highlighter-rouge">LSPMaze</code>. This policy was trained in maze environments and unsurprisingly performs poorly during offline replay. The lower bound costs are also shown in the figure for reference.​

</note>

<img src="/assets/posts/office-offline-alt-policy-replay-animation.gif" class="img-responsive center-block " title="office-offline-alt-policy-replay-animation" />

<note class="img-caption visible-sm" aria-label="image caption"><strong>Offline Alt-Policy Replay:</strong> After the trial is complete, the robot uses the partial map and the images collected during the trial to replay a different policy <code class="language-plaintext highlighter-rouge">LSPMaze</code>. This policy was trained in maze environments and unsurprisingly performs poorly during offline replay. The lower bound costs are also shown in the figure for reference.​
</note>
  </p>

<p>Navigation costs from deployment and lower bound costs from offline alt-policy replay are used by our Constrained UCB bandit policy selection algorithm to pick a policy for the next trial.
This process is repeated for multiple trials and the robot keeps picking the most promising policy for every trial.​</p>

<h2 id="not-all-planning-approaches-are-suitable-for-offline-replay">Not all planning approaches are suitable for offline replay</h2>
<p>Scrutinizing alternative behavior to determine the lower bound cost needed for selection via our constrained UCB bandit algorithm requires that we can perform offline alt-policy replay of robot behavior under an alternative policy without actually deploying the robot.
In general, replaying a policy offline requires an ability to generate observations from poses the robot may not have visited, which for many learning-informed planning strategies in this domain will not accurately reflect how the policy would have behaved if it had been in control of the robot.</p>

<p>Many approaches to vision-informed navigation under uncertainty, particularly those relying on deep reinforcement learning [<a href="#kulhanek2019vision">Kulhánek et al., 2019</a>, <a href="#mirowski2016learning">Mirowski et al., 2016</a>], require observations (images) from poses and vantage points not visited during the original trial and can be brittle to even small changes [<a href="#henderson2018rlmatters">Henderson et al., 2018</a>], and so replay of such policies is unlikely to yield an accurate lower bound on cost.
As such, we instead require an approach to planning that is robust to changes in viewpoint and a kind of policy that is robust to minor changes in robot pose and corresponding observations and can reliably reach the goal even in environments where learning informs poor behavior.</p>

<p>It is our key insight that the <em>Learning over Subgoals Planning (LSP)</em> [<a href="#stein2018subgoal">Stein et al.</a>] is well-suited for offline alt-policy replay, as it is designed for long-horizon, learning informed planning in partially-mapped environments.
In LSP, planning is model-based, and high-level actions correspond to exploration beyond frontiers which represent boundaries between free and unknown space.
Learning is used only to make robot-pose-agnostic predictions about the goodness of each such exploratory action: e.g. likelihood that a frontier will lead to the unseen goal.</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
In LSP, actions correspond to navigating to frontiers which represent boundaries between free and unknown space.​

</note>

<img src="/assets/posts/lsp-subgoal-actions-maze.png" class="img-responsive center-block " title="lsp-subgoal-actions-maze" style="max-height:275px;" />

<note class="img-caption visible-sm" aria-label="image caption">In LSP, actions correspond to navigating to frontiers which represent boundaries between free and unknown space.​
</note>
  </p>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-24em;" aria-label="margin note">See <a href="../../../2018/12/toward-real-world-alphazero/">our blog post</a> or <a href="http://proceedings.mlr.press/v87/stein18a.html">the LSP paper</a> for more details on the Learning over Subgoals Planning approach.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">See <a href="../../../2018/12/toward-real-world-alphazero/">our blog post</a> or <a href="http://proceedings.mlr.press/v87/stein18a.html">the LSP paper</a> for more details on the Learning over Subgoals Planning approach.
</p>

<p>Since properties of exploratory actions are not dependent on where the robot is, offline replay of LSP-based policies yields accurate lower bounds on their performance making such policies well-suited for offline replay.</p>

<h2 id="our-approach-converges-faster">Our approach converges faster</h2>
<p>We evaluate our approach in hundreds of simulated maze and office-like environments and compare it with the UCB bandit algorithm. In the figure below, we show results in Maze-Green environments demonstrating that our approach converges much faster than UCB bandit and has 88% lower cumulative regret.​
<span class="marginnote note no-word-break invisible-sm" style="margin-top:-6em;" aria-label="margin note">See <a href="https://arxiv.org/abs/2304.01094">our paper</a> for more results including those in office-like environments.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">See <a href="https://arxiv.org/abs/2304.01094">our paper</a> for more results including those in office-like environments.
</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
Results from Maze-Green environments show that our approach converges much faster than UCB bandit and has 88% lower cumulative regret. ​

</note>

<img src="/assets/posts/policy-selection-constrained-ucb-maze-green-results.png" class="img-responsive center-block " title="policy-selection-constrained-ucb-maze-green-results" style="max-height:500px;" />

<note class="img-caption visible-sm" aria-label="image caption">Results from Maze-Green environments show that our approach converges much faster than UCB bandit and has 88% lower cumulative regret. ​
</note>
  </p>

<h2 id="conclusion-and-future-work">Conclusion and Future Work</h2>
<p>We presented a data-efficient policy selection approach that leverages Learning over Subgoals Planning-enabled offline alt-policy replay to compute a lower bound on the performance of policies based on the partial map and images collected from the environment during navigation, and use a bandit-like method to identify the best-performing policy quickly.
Our approach enables the learning-guided robot to reduce average navigation cost in a wide variety of partially-mapped environments by picking only those policies that are known to perform better or have the potential to do so thereby significantly reducing the cumulative regret compared to the baseline UCB bandit.
In future, we hope to extend our work to perform policy selection with online retraining or adaptation of policies in new environments.</p>

<p>Read our full paper <a href="https://arxiv.org/abs/2304.01094">here</a> or feel free to explore our code on <a href="https://github.com/RAIL-group/RAIL-group-software">GitHub</a>.</p>

<h2 id="acknowledgements">Acknowledgements</h2>
<p>This material is based upon work supported by the National Science Foundation (NSF) under Grant No. 2232733.</p>

<p><img src="/assets/posts/rail_art_policy_selection_reflection_city.jpg" class="img-responsive center-block " title="rail_art_policy_selection_reflection_city" style="max-height:275px;" /></p>

<h2 id="references">References</h2>
<ul>
<li id="paudel2023selection">Abhishek Paudel and Gregory J. Stein. Data-Efficient Policy Selection for Navigation in Partial Maps via Subgoal-Based Abstraction. <i>International Conference on Intelligent Robots and Systems (IROS)</i>. 2023. <a href="https://arxiv.org/pdf/2304.01094.pdf">paper link</a></li>
<li id="lai1985asymptotically">Lai, Tze Leung, Herbert, Robbins. Asymptotically efficient adaptive allocation rules. <i>Advances in Applied Mathematics</i>. 1985.</li>
<li id="kulhanek2019vision">Kulhánek, Jonáš, Erik, Derner, Tim, De Bruin, Robert, Babuška. Vision-based navigation using deep reinforcement learning. <i>European Conference on Mobile Robots (ECMR)</i>. 2019.</li>
<li id="mirowski2016learning">Mirowski, Piotr, Razvan, Pascanu, Fabio, Viola, Hubert, Soyer, Andrew J, Ballard, Andrea, Banino, Misha, Denil, Ross, Goroshin, Laurent, Sifre, others. "Learning to navigate in complex environments". <i>arXiv preprint arXiv:1611.03673</i>. 2016.</li>
<li id="henderson2018rlmatters">Peter Henderson, Riashat Islam, Philip Bachman, Joelle Pineau, Doina Precup, David Meger. Deep Reinforcement Learning that Matters. <i>AAAI Conference on Artificial Intelligence</i>. 2018.</li>
<li id="stein2018subgoal">Stein, Gregory J., Christopher, Bradley, Nicholas, Roy. Learning over Subgoals for Efficient Navigation of Structured, Unknown Environments. <i>Conference on Robot Learning (CoRL)</i>. 2018.</li>
<ul>
</ul></ul>]]></content><author><name>Abhishek Paudel</name></author><category term="[&quot;Research&quot;]" /><category term="Navigation" /><category term="Planning Under Uncertainty" /><summary type="html"><![CDATA[Consider a robot that is tasked to navigate to an unseen goal in a maze in which a green path on the floor signals the route to the goal. The robot’s behavior is guided by a policy that determines what action the robot should take at any point during navigation. In the figure below, the robot comes across a fork while trying to find the goal: ​ At a fork while trying to find the goal that exists to the left side of the fork, a policy that guides the robot right will incur a greater distance. At a fork while trying to find the goal that exists to the left side of the fork, a policy that guides the robot right will incur a greater distance.]]></summary></entry><entry><title type="html">A Communication Exercise: randomize slide presenters</title><link href="https://cs.gmu.edu/2023/9/randomize-presenters/" rel="alternate" type="text/html" title="A Communication Exercise: randomize slide presenters" /><published>2023-09-07T13:50:16+00:00</published><updated>2023-09-07T13:50:16+00:00</updated><id>https://cs.gmu.edu/2023/9/randomize-presenters</id><content type="html" xml:base="https://cs.gmu.edu/2023/9/randomize-presenters/"><![CDATA[<p>Last month, my lab had one of the best group meetings we’ve ever had.</p>

<p>I asked my students to prepare presentations in the style of <a href="https://www.pechakucha.com">Pecha Kucha</a>—a slide deck of 18 slides that automatically advance every 20 seconds. On the day of the presentation, I <em>randomized the presenters</em>: they would be giving each other’s slides with only about 5 minutes of preparation time. Each of my students watched as their colleagues presented the slide deck they had painstakingly prepared over the previous few days.</p>

<p>The result: chaos, laughter, and an incredibly productive discussion about how to make effective slides.</p>

<h2 id="why-randomize-the-presenters">Why randomize the presenters?</h2>

<p>There is immense value in watching recordings of your own talks. I routinely tell my students to record and watch their own presentations as they make them–and before they cross my desk—since it will help them see details that they don’t notice while they focus on presenting. However, this approach is still only a half-measure, and it is still difficult to put your self in the shoes of another who is entirely unfamiliar with the material and grasp how well they understand the material. Even when watching your own recording, you still bring with you implicit knowledge about what you are trying to communicate. Instead,</p>

<blockquote>
Watching someone else give your presentation, you get to see how <em>they</em> interpret your slides, information you can use to improve the presentation in a way you likely would not be able to on your own.
</blockquote>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-20em;" aria-label="margin note">In general, it is not necessary for slides to contain <em>all</em> the details you wish to communicate, but it is important to be conscious of when details are intentionally not on the slides versus accidentally omitted.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">In general, it is not necessary for slides to contain <em>all</em> the details you wish to communicate, but it is important to be conscious of when details are intentionally not on the slides versus accidentally omitted.
</p>

<h2 id="why-use-the-pecha-kucha-auto-advancing-slide-format">Why use the Pecha Kucha auto-advancing slide format?</h2>

<p>I needed a way to encourage my students to commit to the presentation more than they would for an “ordinary” group meeting, so that the slides would be more self-contained than they usually would be, giving the presenters a chance at giving a reasonably effective presentation with minimal prep. The Pecha Kucha format was a novelty, and so was ideal for this purpose.</p>

<p>Moreover, in the absence of auto-advancing, I feared that students presenting a slide deck that was not very clear would tend to ramble, grasping at what they <em>thought</em> a slide was about rather than presenting what was actually on the screen. The Pecha Kucha format, in which slides auto-advance every 20 seconds, disallows rambling.</p>

<p>Finally, the very limited amount of time encourages <em>one idea per slide</em> in a way that non-auto-advancing slides do not. In advance of the meeting, I reminded my students to design sparse and effective slides, in which (i) slide titles quickly and clearly communicate the main message of the slide, (ii) there is only a limited amount of text on screen at once, and (iii) figures are fairly minimal and communicate only what is needed to convey the point, advice I regularly give.</p>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-8em;" aria-label="margin note">See also my <a href="../../../2020/1/talk-figures-are-different-paper-figures/">blog post</a> on the differences between figures designed for papers and for presentations.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">See also my <a href="../../../2020/1/talk-figures-are-different-paper-figures/">blog post</a> on the differences between figures designed for papers and for presentations.
</p>

<h2 id="keeping-the-randomness-alive">Keeping the randomness alive</h2>

<p>The meeting was incredibly successful. Even those presentations that were not as effective served as a learning opportunity to the designers, who used the experience to improve the slides going forwards. In addition, the meeting built up lab camaraderie and spawned a productive discussion over the group lunch that followed the meeting about particularly funny and interesting moments as well as strategies for generating better slides overall.</p>

<p>This sort of event is one that can only be done once, since the surprise and uniqueness is a core part of the fun. However, I still plan to add some elements of randomness to research update group meetings to encourage updates to be of a higher quality and more self-contained. I now bring a 20-sided die to my meetings: if it lands on 1 or 2, the students must present each other’s updates, if it lands on 19 or 20, <em>I</em> will present all their updates, just to keep everyone on their toes.</p>

<p>Questions or comments? Feel free to follow up <a href="https://twitter.com/GregoryJStein">on Twitter</a>.</p>

<meta name="twitter:widgets:link-color" content="#993333" />

<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">Best group meeting we've had: I asked my students to prep Pecha Kucha-style slides—18 slides, auto-advance every 20 seconds—and to really focus on readability/clarity. On the day, I had them present *each other's slides* (chosen randomly🎲) with 5min prep. Chaotic &amp; fun 🧵[1/5]</p>&mdash; Gregory Stein (@GregoryJStein) <a href="https://twitter.com/GregoryJStein/status/1701611464916926848">September 12, 2023</a></blockquote>
<script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script>]]></content><author><name>Gregory J. Stein</name></author><category term="[&quot;Communication &amp; Learning&quot;]" /><category term="Getting a PhD" /><category term="Communication" /><summary type="html"><![CDATA[Last month, my lab had one of the best group meetings we’ve ever had.]]></summary></entry><entry><title type="html">Seek out Opportunities to Mentor</title><link href="https://cs.gmu.edu/2023/8/seek-opportunities-to-mentor/" rel="alternate" type="text/html" title="Seek out Opportunities to Mentor" /><published>2023-08-29T04:24:40+00:00</published><updated>2023-08-29T04:24:40+00:00</updated><id>https://cs.gmu.edu/2023/8/seek-opportunities-to-mentor</id><content type="html" xml:base="https://cs.gmu.edu/2023/8/seek-opportunities-to-mentor/"><![CDATA[<p><em>Summary</em>: Mentoring others can be incredibly valuable experience and so opportunities to mentor should be sought out.</p>

<p>Each summer, my lab hosts a handful of high school summer interns through George Mason’s fantastic <a href="https://science.gmu.edu/assip">Aspiring Scientists Summer Internship Program (<sc>assip</sc>)</a> program. Not only is it a fun and educational experience for all involved, but an important benefit of participating in the program is the mentorship experience my PhD students get along the way.</p>

<h2 id="why-mentor">Why Mentor?</h2>

<p>PhD students often underestimate the need for experience beyond merely conducting experiments. Getting a PhD involves deeply understanding a topic and advancing the state of the field. As research does not happen in a vacuum, much of how that advancement happens is through engagement with others: formation of research ideas with your advisor and with colleagues or publicizing your work more broadly through blog posts or within the research community at conferences through talks, poster presentations, or informal conversations over meals. Being a successful researcher requires the ability to clearly communicate, distill complex ideas into core components, address (and ask) deep technical questions about those ideas, and identify through conversation where your listener might not be following along. To develop these skills, there is no substitute for experience.</p>

<p>Mentorship is an excellent source of practice for the intangible skills PhD students need. Teaching or training someone else requires good communication skills. Moreover, teaching complex ideas requires a deep level of understanding; trying to effectively explain concepts about which you have only a surface-level understanding will quickly reveal the boundary of your knowledge—to you, at least, if not the one you are trying to teach.</p>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-10em;" aria-label="margin note">I often tell my students to be cautious of the sentiment that they ‘<em>understand something but cannot put it into words</em>.’ That ability to decode thoughts into prose is often a reflection of one’s level of understanding.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">I often tell my students to be cautious of the sentiment that they ‘<em>understand something but cannot put it into words</em>.’ That ability to decode thoughts into prose is often a reflection of one’s level of understanding.
</p>

<p>Beyond merely practicing communication, mentors will often learn through their mentees. Someone less experienced will come up with questions that even the most experienced mentors hadn’t considered. Through these questions, effective mentors seek opportunities to deepen their own understanding or hone in-progress ideas.</p>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-9em;" aria-label="margin note">Onboarding my colleague Chris Bradley—now a long-time friend and collaborator—to our lab during graduate school helped refine our in-progress <em>Learning over Subgoals Planning</em> approach to learning-augmented planning under uncertainty, ideas now at the heart of my lab’s research.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">Onboarding my colleague Chris Bradley—now a long-time friend and collaborator—to our lab during graduate school helped refine our in-progress <em>Learning over Subgoals Planning</em> approach to learning-augmented planning under uncertainty, ideas now at the heart of my lab’s research.
</p>

<h2 id="finding-mentorship-opportunities">Finding Mentorship Opportunities</h2>

<p>Mentorship takes many forms.</p>

<p>Structured mentorship opportunities during a PhD may involve guiding high school or undergraduate students through research, training new lab members, or even serving as a Teaching Assistant. However, many opportunities to mentor are <em>informal</em>, and include helping other students out with their experiments or chatting with them about their in-progress ideas over lunch or at a whiteboard.
While many of these opportunities will organically arise—and a good PhD advisor will try to make sure these mentor/mentee relationships emerge—<strong>PhD students should seek out opportunities to mentor.</strong></p>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-5em;" aria-label="margin note">Research cannot be a solo exercise. I regularly tell my students to solicit feedback from other students, both inside and outside of my lab.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">Research cannot be a solo exercise. I regularly tell my students to solicit feedback from other students, both inside and outside of my lab.
</p>

<p>Some of the most valuable experiences during graduate school was in the informal mentorship relationships I undertook in my research lab and as communication coach through a peer-driven mentorship organization. Moreover, as a PhD student, mentoring under the supervision of your advisor provides you with a safety net: someone to reach out to when you’re not sure what guidance to provide.</p>

<p>Tell your PhD advisor or manager that you’re interested in mentoring others. Go out of your way to hear about your colleagues’ in-progress ideas at a white board or over lunch or coffee. You’ll be surprised at how it develops your skills as a researcher and deepens your professional relationships to those around you.</p>

<p>Questions or comments? Feel free to follow up <a href="https://twitter.com/GregoryJStein">on Twitter</a>.</p>

<p>
<note class="marginnote img-caption invisible-sm" aria-label="image caption">
The 2023 high-school summer ASSIP students in my lab alongside me and their PhD student mentors.

</note>

<img src="/assets/posts/RAIL-group-ASSIP-team-2023.jpg" class="img-responsive center-block " title="" style="max-height:300px;" alt="A photo of seven people in front of a building. Three are high school summer students. One is me, Greg Stein, the faculty advisor, and three are my PhD students." />

<note class="img-caption visible-sm" aria-label="image caption">The 2023 high-school summer ASSIP students in my lab alongside me and their PhD student mentors.
</note>
  </p>]]></content><author><name>Gregory J. Stein</name></author><category term="[&quot;Workflow &amp; Process&quot;]" /><category term="Pedagogy" /><category term="Getting a PhD" /><summary type="html"><![CDATA[Summary: Mentoring others can be incredibly valuable experience and so opportunities to mentor should be sought out.]]></summary></entry><entry><title type="html">My strategies for idea generation through writing</title><link href="https://cs.gmu.edu/2023/1/idea-generation-through-writing/" rel="alternate" type="text/html" title="My strategies for idea generation through writing" /><published>2023-01-17T20:02:28+00:00</published><updated>2023-01-17T20:02:28+00:00</updated><id>https://cs.gmu.edu/2023/1/idea-generation-through-writing</id><content type="html" xml:base="https://cs.gmu.edu/2023/1/idea-generation-through-writing/"><![CDATA[<p><em>What is this guide?</em>
This guide aims to outline my strategies to encourage idea generation, essential for long-term research progress, through a habit of regular writing.</p>

<p><em>Who is this guide for?</em>
While I have written this guide for my PhD students, it aims to help academics and working professions for whom creative problem solving is a central part of their responsibilities.</p>

<hr />

<p>In my experience, research progress—at least in the sciences—can be grouped into two <em>phases</em>:</p>

<ul>
  <li><em>Progress Towards a Milestone</em>: For when one broadly knows what the next target is and needs to spend time making it happen.</li>
  <li><em>Idea Generation</em>: The process of identifying and better understanding the challenges, problems and opportunities that can spawn new research or improve upon the existing state-of-the-art.</li>
</ul>

<p>When in the <em>milestone completion</em> phase, it’s often fairly straightforward to understand how to make progress. By contrast, there is no formula for coming up with new ideas. Despite its importance, the amorphous nature of idea generation can make it feel frustrating; a lack of immediate progress may discourage, leading one to put idea generation on the backburner. Yet <em>idea generation</em>, broadly defined, is incredibly important for long-term progress.</p>

<p>Through my PhD and in my time since as an academic, I have found a number of strategies that have helped me to make progress towards new research ideas, advancing stuck projects, and writing grant proposals. This post is about the approach that I have found helps me make progress towards my open-ended research aims and to set a direction for my and my lab’s work; it outlines practices that I generally recommend my students follow.</p>

<h2 id="writing-is-a-central-component-of-idea-generation-and-research-progress">Writing is a central component of idea generation and research progress</h2>

<p>Writing forces me to clarify my thoughts.</p>

<p>In research, the best ideas often begin with a problem to be solved. Too many times, I have thought I understood a problem until I tried to write it out in full detail, to explain it to someone else, or to withstand deep questions about it. When writing something down, I must face head-on the ambiguities, contradictions, or unresolved issues that my mind may have glossed over. When honing an idea, I try to be as precise and complete as possible, so as to leave little ambiguity about the problem I am trying to solve. When I write, I do so with the intention of better understanding a problem or, if I think I already understand the problem, coming up with possible remedies to the core issue or experiments to run that can help me better understand it. For problems of appreciable size or complexity, it becomes impossible to identify the root cause of a problem or what to do about it without writing it out in full.</p>

<p>For me, an idea generation “session” is an unbroken period of time devoted to writing, typically an hour in length. For each writing session, I to set a well-defined goal for what I want to accomplish. I usually target some sort of intermediate progress milestone—more about that in the next section—or, failing to come up with one, set a target word limit for my writing; even 300 words of clear prose can represent solid progress towards better understanding a difficult problem. These intermediate milestones help me to feel as if I am making progress even when I do not complete a high-level objective.</p>

<h2 id="write-with-the-aim-of-better-understanding-a-problem-and-the-limitations-of-existing-approaches">Write with the aim of better understanding a problem and the limitations of existing approaches</h2>

<p>Many of my best ideas come to me when I least expect them: when going for a walk, taking a shower, or talking with friends and colleagues. This raises the question, <em>why have dedicated writing sessions for idea generation if many of the best ideas come from elsewhere?</em> These sorts of epiphanies only occur for problems that I’ve already thought deeply about and tried (and failed) to make solid progress towards. <strong>The goal of my writing sessions is therefore less to produce breakthroughs as it is about readying the mind to have such breakthroughs.</strong></p>

<p>As such, most of my writing sessions are devoted to better understanding a problem. Rather than tell myself <em>during today’s writing session, I am going to come up with a solution to a problem</em>, my intention for a writing will often include goals to precisely (mathematically) define the problem I am trying to solve or to describe in detail a scenario where I expect the current state-of-the-art will fail: i.e., an example that motivates the need for a new approach that overcomes this issue. If I do not have a clear picture of what problem I’m solving, the writing session is devoted to more precisely defining it.</p>

<p>Over time, I have amassed quite a list of problems I think are interesting. I have devoted significant effort towards understanding why those problems exist and, often, to identifying commonalities between them in an effort to discover an underlying root cause. It is from this list—and the process of creating it—that many of my research ideas have come about. Once I feel that I may have a potential idea of how to address one or more of the problems I have written about, I will spend a writing session expanding upon it. The resulting ideas then form the backbone of new experiments to validate my hypothesis.</p>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-8em;" aria-label="margin note">In my field, these proof-of-concept experiments are an essential component of this process. The successes and failures that result from experiments are needed to make progress.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">In my field, these proof-of-concept experiments are an essential component of this process. The successes and failures that result from experiments are needed to make progress.
</p>

<p>This attitude also makes it easier to set intermediate progress milestones. It can be discouraging to sit down with an intention to come up with a new idea and then fail to do so. Instead, when focusing on clearly describing a problem scenario or a potential solution, adding particular details becomes a target and it becomes far easier to conclude a writing session feeling as if progress has been made.</p>

<h2 id="prefer-short-regular-writing-sessions-to-long-infrequent-sessions">Prefer short, regular writing sessions to long, infrequent sessions</h2>

<p>It is difficult, if not impossible, to <em>force</em> a breakthrough. On the whole, I would say that fewer than half of my leaps in progress towards my research happen during dedicated sessions to make progress towards them. The rest happen when I least expect it: when going for a walk, taking a shower, or cooking dinner. A deep understanding of a problem only happens if you think about it often; writing is the most effective way to ensure that thought is deep and purposeful.</p>

<p>Pushing myself during long writing sessions often becomes counterproductive. Concentrating all the writing for a project to a single writing binge can be somewhat useful when focusing on a deadline or trying to enumerate all the details for an experiment or already well-formed idea. Yet when trying to reach a not-yet-well-defined goal or overcome a tricky problem, I can easily become frustrated after a few hours of feeling as if I have made little progress.</p>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-8em;" aria-label="margin note">However, if I’m in the midst of a very productive writing session, I won’t force myself to stop. Preferring shorter writing sessions is a guideline to avoid burnout and frustration, but should not be rigidly enforced at the expense of progress.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">However, if I’m in the midst of a very productive writing session, I won’t force myself to stop. Preferring shorter writing sessions is a guideline to avoid burnout and frustration, but should not be rigidly enforced at the expense of progress.
</p>

<p>I make an effort to write every (work) day for roughly an hour. This amount of time is usually long enough that I can feel as if I’ve made progress without tiring me out. Writing every day ensures that I am regularly thinking about the challenges that are holding back me or my lab.</p>

<p>Relatedly, as a regular habit is essential, procrastination is the enemy. I try to sit down to write even on days where I feel I have little to say; I am frequently rewarded for the effort.</p>

<h2 id="find-a-setting-that-works-for-you">Find a setting that works for you</h2>

<p>Where do you write? At what time of day do you write most productively? Do you listen to music, prefer the hum of a busy cafe, or require silence? Do you prefer bright lights, sunlight, or absolute darkness? Do you prefer to type when you write or hand-write on paper or a tablet?</p>

<p>As a PhD student, I did not give much thought to these questions, yet I now appreciate how important <em>setting</em> is to my writing productivity.</p>

<p>My writing is most productive under two conditions: (i) in the morning at my local cafe, a cup of coffee in my hand, sitting near the window to get lots of light and so that I can stare aimlessly into the distance without unnerving nearby patrons and (ii) late at night in my bedroom with the lights dimmed to near total darkness. I always listen to music using my noise-canceling headphones.</p>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-8em;" aria-label="margin note">I am a <em>huge fan</em> of the <a href="https://anjunadeep.com/us">Anjunadeep</a> record label, whose continuously-mixed deep house compilation albums have fueled many of my writing sessions and best ideas since graduate school.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">I am a <em>huge fan</em> of the <a href="https://anjunadeep.com/us">Anjunadeep</a> record label, whose continuously-mixed deep house compilation albums have fueled many of my writing sessions and best ideas since graduate school.
</p>

<p>While I don’t fully understand why these are the conditions under which I write the most effectively, it was a process of protracted trial-and-error to discover them. Critically, I rarely write in the middle of the day, when my efforts are best spent on different activities. In developing a regular writing habit, it is important to consider such details.</p>

<h2 id="writing-sessions-are-only-as-useful-as-what-happens-between-them">Writing sessions are only as useful as what happens between them</h2>

<p>The time between writing sessions is just as important as the writing itself. As I mentioned above, writing is to stimulate the mind to think more deeply about a problem. In addition to writing regularly, my other habits and practices help me to make progress.</p>

<p><strong>Conduct experiments.</strong> I work in an experimentally-driven field, and so the purpose of writing is to generate hypotheses of how to make progress; thus, experiments are of central importance. In addition to running large-scale experiments to explore every facet of a problem, targeted experiments meant to better understand small pieces of it can be just as productive and with a faster iteration time. Frequently, my writing will expose some lack of knowledge of the nature of the problem and I must run some small proof-of-concept experiments before I am ready to make more progress.</p>

<p><strong>Talk to others.</strong> Find a handful of people who are somewhat knowledgeable about the problems you are trying to solve. Explaining the problem to them and your thoughts on how to solve it can be an incredibly useful exercise. Moreover, those people should be willing to challenge you on those ideas and push you to clarify what you mean or hone in on where a proposed solution might not work. These dialogues—if approached from a place of curiosity or shared purpose, rather than with adversarial intent—can be incredibly productive for all involved.</p>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-8em;" aria-label="margin note">Relatedly, we should all strive to be <em>idea confidants</em> for others.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">Relatedly, we should all strive to be <em>idea confidants</em> for others.
</p>

<p><strong>Talk to yourself.</strong> I regularly think out loud. Whether I’m writing or driving to work, trying to speak my thoughts serves a similar function to writing by forcing me to clarify my often-underdeveloped internal musings. This doesn’t work for all, but is incredibly useful for me.</p>

<p><strong>Keep an open mind.</strong> Writing need not be so rigid and, in fact, I often ensure that every week or so, I devote a writing session to open-ended brainstorming about a challenging problem or idea. Research requires a certain amount of creativity and such sessions can help to produce new ideas or help me to see an old problem from a new angle.</p>

<p><strong>Keep a list of thoughts to revisit later.</strong> Focus during a writing session is important. I am easily distracted, not just by noise and external distractions, but also by potentially promising ideas that deviate from my writing goal. Sometimes I’ll pursue these in the moment, but more often, it is best to add it to a list of ideas I want to revisit. Even outside of a writing session, I may have an idea to come back to later and so I have a note on my phone (always on hand) where I can keep such scribbles. I typically have one list for each project I am working towards.</p>

<p><strong>Go outside. Take breaks. Eat well. Exercise. Sleep.</strong> Balance is important. The mind cannot operate most effectively without a healthy body. Sleep is particularly important. While I occasionally trade sleep in pursuit of short-term productivity, virtually none of my best ideas have come about when I have been sleep deprived.</p>

<hr />

<p>Any writing habits of yours you would like to share? I welcome thoughts and feedback <a href="https://twitter.com/gregoryjstein">on Twitter</a>.</p>]]></content><author><name>Gregory J. Stein</name></author><category term="[&quot;Workflow &amp; Process&quot;]" /><category term="Project Management" /><category term="Getting a PhD" /><summary type="html"><![CDATA[What is this guide? This guide aims to outline my strategies to encourage idea generation, essential for long-term research progress, through a habit of regular writing.]]></summary></entry><entry><title type="html">Write code and tests in tandem</title><link href="https://cs.gmu.edu/2023/1/write-tests-and-code-in-tandem/" rel="alternate" type="text/html" title="Write code and tests in tandem" /><published>2023-01-07T02:04:22+00:00</published><updated>2023-01-07T02:04:22+00:00</updated><id>https://cs.gmu.edu/2023/1/write-tests-and-code-in-tandem</id><content type="html" xml:base="https://cs.gmu.edu/2023/1/write-tests-and-code-in-tandem/"><![CDATA[<p>I often tell students in my lab that they need to put more of an emphasis on testing their research code.
We have automated tests on quite a lot of our code to verify that it works as expected, which frequently helps prevent issues before they arise and makes refactoring code faster, easier, and more reliable.
Even research code benefits greatly from automated testing.
In discussions on testing with newer students, I’ve found that a big hurdle to writing tests is that they often don’t quite when to start writing a test. Here’s my approach to getting started: <strong>If you need to write additional code to verify that some functionality is working, that additional code should be written as a test.</strong>
It’s a simple heuristic, but a powerfully useful one.</p>

<p>Rather than putting code in a one-off script or by modifying another—often to be deleted shortly after being written—code is written in an automated test, which persists even after the code is considered stable.
In my experience, it is pretty rare that code, particularly research code, will be written without <em>any</em> debugging along the way.
Many less-experienced researchers will write code and have a large block of either plotting code or print statements that exist to convince themselves that their new code is working as expected.
Once the code is believed to work, however, that code will either be commented out or deleted, so that it is not run in production, a process that has always felt to me like wasted effort.
Whenever I want to add a new feature or functionality in my code, I <em>start</em> by setting up a test and populating it with an example scenario as I write the code, evolving both in tandem until I achieve some broader aim.</p>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-8em;" aria-label="margin note">These ideas are consistent with the philosophy of Test Driven Development (TDD), which broadly refers to the practice of writing tests for an API in advance of its implementation.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">These ideas are consistent with the philosophy of Test Driven Development (TDD), which broadly refers to the practice of writing tests for an API in advance of its implementation.
</p>
<p>This guidance applies both during initial development, when going back over older code, and when tracking down bugs or other unwanted behavior.
Though it takes a bit of extra effort to set up the boilerplate code to set up and tear down the scenario being tested, the code I would once have written and then discarded lives on in my testing suite and is tested occasionally to ensure the new functionality is still performing as expected after I’ve moved on.</p>

<p><em>What about visualization code?</em> Keep that too! Sometimes there’s no substitute to just <em>looking at something</em> when you’re trying to write code. Many of my automated tests have an optional <code class="language-plaintext highlighter-rouge">do_debug_plot</code> flag that also generates plots for me to look at or inspect in case I ever need to look more closely at that functionality again. Much of my work interacts with computer vision and so having the ability to lay my eyes on the result is sometimes just what I need when I’m trying to debug or understand something.</p>

<p>I have also discovered over time that I have evolved so as to write new code such that it is as easy as possible to test.
This observation matches a similar thought from developer <a href="https://www.factorio.com/blog/author/kovarex">kovarex</a> from the wonderfully addicting game <a href="https://www.factorio.com">Factorio</a>. Here is an except from a <a href="https://www.factorio.com/blog/post/fff-366">developer blog post of his</a> concerning Test Driven Development (TDD):</p>

<blockquote>
TDD actually is the constant fast switching between extending the tests and making them pass continuously. So as you write tests, you write code to satisfy them basically at the same time. This allows you to instantly test what you write, and mainly use tests as specification of what the code should actually do, which guides the thought process to make you think about where you are headed to, and to write code that is more structured and testable from the very beginning.
</blockquote>

<p>Starting my development process in tests has led to overall code readability improvements and has made it easier to refactor and extend the code when it became necessary later on.</p>

<p>My guidance above is really only a stepping stone to <a href="https://www.atlassian.com/continuous-delivery/software-testing/types-of-software-testing">more comprehensive testing practices</a>.</p>

<p><span class="marginnote note no-word-break invisible-sm" style="margin-top:-8em;" aria-label="margin note">See also, my colleagues Paul Ammann and Jeff Offutt’s popular (and excellent) <a href="https://cs.gmu.edu/~offutt/softwaretest/contents.html">book on Software Testing</a>.</span></p>
<p class="note no-word-break visible-sm" aria-label="footnote">See also, my colleagues Paul Ammann and Jeff Offutt’s popular (and excellent) <a href="https://cs.gmu.edu/~offutt/softwaretest/contents.html">book on Software Testing</a>.
</p>
<p>In addition to these sorts of <em>integration tests</em>, which involve running multiple parts of the code at once and testing them in unison, it is still critical to take the time to write both <em>unit tests</em>, to more rigorously test functions in relative isolation, and <em>regression tests</em>, which involve writing a test to reproduce and squash bugs found later on.
There’s both an art and a science to testing and my heuristics for when to write additional tests and how in-depth they should be vary according to both time and application.</p>

<p>I welcome thoughts and feedback <a href="https://twitter.com/gregoryjstein">on Twitter</a>.</p>]]></content><author><name>Gregory J. Stein</name></author><category term="[&quot;Workflow &amp; Process&quot;]" /><category term="Development" /><category term="Project Management" /><summary type="html"><![CDATA[I often tell students in my lab that they need to put more of an emphasis on testing their research code. We have automated tests on quite a lot of our code to verify that it works as expected, which frequently helps prevent issues before they arise and makes refactoring code faster, easier, and more reliable. Even research code benefits greatly from automated testing. In discussions on testing with newer students, I’ve found that a big hurdle to writing tests is that they often don’t quite when to start writing a test. Here’s my approach to getting started: If you need to write additional code to verify that some functionality is working, that additional code should be written as a test. It’s a simple heuristic, but a powerfully useful one.]]></summary></entry></feed>