Buckets:

download
raw
36.2 kB
<meta charset="utf-8" /><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;Wildfire Environment&quot;,&quot;local&quot;:&quot;wildfire-environment&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Quick Start&quot;,&quot;local&quot;:&quot;quick-start&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Grid&quot;,&quot;local&quot;:&quot;grid&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Actions&quot;,&quot;local&quot;:&quot;actions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Observation&quot;,&quot;local&quot;:&quot;observation&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Reward&quot;,&quot;local&quot;:&quot;reward&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Fire Spread&quot;,&quot;local&quot;:&quot;fire-spread&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Configuration&quot;,&quot;local&quot;:&quot;configuration&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Web Interface&quot;,&quot;local&quot;:&quot;web-interface&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;References&quot;,&quot;local&quot;:&quot;references&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Citation&quot;,&quot;local&quot;:&quot;citation&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"/>
<link href="/docs/openenv/main/en/_app/immutable/entry/start.uSpCQ2t3.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/chunks/D5af75Uc.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/chunks/D2-C6oRw.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/entry/app.bOWJ-27z.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/chunks/DZFNMJnC.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/chunks/Cs50_Xpk.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/chunks/DsnmJJEf.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/chunks/BH1xZHjK.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/nodes/0.HZMVN560.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/nodes/14.CzkJmGDc.js" rel="modulepreload">
<link href="/docs/openenv/main/en/_app/immutable/chunks/n2OXLdaY.js" rel="modulepreload">
<!--1547ws4--><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;Wildfire Environment&quot;,&quot;local&quot;:&quot;wildfire-environment&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Quick Start&quot;,&quot;local&quot;:&quot;quick-start&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Grid&quot;,&quot;local&quot;:&quot;grid&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Actions&quot;,&quot;local&quot;:&quot;actions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Observation&quot;,&quot;local&quot;:&quot;observation&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Reward&quot;,&quot;local&quot;:&quot;reward&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Fire Spread&quot;,&quot;local&quot;:&quot;fire-spread&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Configuration&quot;,&quot;local&quot;:&quot;configuration&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Web Interface&quot;,&quot;local&quot;:&quot;web-interface&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;References&quot;,&quot;local&quot;:&quot;references&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Citation&quot;,&quot;local&quot;:&quot;citation&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"/><!---->
<link href="/docs/openenv/main/en/_app/immutable/assets/0.tn0RQdqM.css" rel="modulepreload"> <!--[--><!--[0--><!--[--><!--[0--><!--[--><p></p> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"><div class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----></span> <span>Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg><!----></button></div> <!--[-1--><!--]--></div><!----> <!--[0--><h1 class="relative group"><a id="wildfire-environment" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#wildfire-environment"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Wildfire Environment</span></h1><!--]--><!----> <p>A wildfire-control simulation for reinforcement learning. The agent contains spreading fires with <strong>water</strong> and <strong>firebreaks</strong> under <strong>wind</strong> and <strong>humidity</strong>, with limited resources. The spread model is inspired by the Rothermel surface fire spread model and MITRE Fireline’s SimFire.</p> <p><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/openenv/wildfire.png" alt="Wildfire web playground"/></p> <p><em>The <code>/web</code> playground after a few steps: the spreading fire, a line of firebreaks and the episode stats.</em></p> <!--[1--><h2 class="relative group"><a id="quick-start" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#quick-start"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Quick Start</span></h2><!--]--><!----> <p>Build and run the server from <code>envs/wildfire_env/</code>:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-bash "><!---->docker build -t wildfire-env:latest -f server/Dockerfile .
docker run -p 8000:8000 wildfire-env:latest<!----></pre></div><!----> <p>The image enables the web interface at <code>http://localhost:8000/web</code>.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> wildfire_env <span class="hljs-keyword">import</span> WildfireAction, WildfireEnv
<span class="hljs-keyword">with</span> WildfireEnv(base_url=<span class="hljs-string">&quot;http://localhost:8000&quot;</span>).sync() <span class="hljs-keyword">as</span> env:
result = env.reset()
obs = result.observation
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Grid: <span class="hljs-subst">{obs.width}</span>x<span class="hljs-subst">{obs.height}</span>, Fires: <span class="hljs-subst">{obs.burning_count}</span>, Water: <span class="hljs-subst">{obs.remaining_water}</span>&quot;</span>)
result = env.step(WildfireAction(action=<span class="hljs-string">&quot;water&quot;</span>, x=<span class="hljs-number">10</span>, y=<span class="hljs-number">15</span>)) <span class="hljs-comment"># water a cell</span>
result = env.step(WildfireAction(action=<span class="hljs-string">&quot;break&quot;</span>, x=<span class="hljs-number">12</span>, y=<span class="hljs-number">15</span>)) <span class="hljs-comment"># build a firebreak</span>
result = env.step(WildfireAction(action=<span class="hljs-string">&quot;wait&quot;</span>)) <span class="hljs-comment"># let the fire evolve</span>
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Reward: <span class="hljs-subst">{result.reward:<span class="hljs-number">.2</span>f}</span>, Burning: <span class="hljs-subst">{result.observation.burning_count}</span>&quot;</span>)<!----></pre></div><!----> <p>To run without Docker, <code>pip install -e envs/wildfire_env</code> and start <code>server</code> (or <code>python -m wildfire_env.server.app</code>).</p> <!--[1--><h2 class="relative group"><a id="grid" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#grid"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Grid</span></h2><!--]--><!----> <p>The observation’s <code>grid</code> is a flat list of <code>width * height</code> cells. Cell <code>(x, y)</code> is <code>grid[y * width + x]</code>:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
grid_2d = np.array(obs.grid).reshape(obs.height, obs.width) <span class="hljs-comment"># grid_2d[y][x]</span><!----></pre></div><!----> <table><thead><tr><th>Code</th><th>Cell</th><th>Behavior</th></tr></thead><tbody><tr><td><code>0</code></td><td>Ash</td><td>Burned out, can’t reignite</td></tr><tr><td><code>1</code></td><td>Fuel</td><td>Can ignite</td></tr><tr><td><code>2</code></td><td>Burning</td><td>Spreads to neighbors, turns to ash after 3 ticks</td></tr><tr><td><code>3</code></td><td>Firebreak</td><td>Fire can’t cross it</td></tr><tr><td><code>4</code></td><td>Water/damp</td><td>Can’t ignite, reverts to fuel after 6 ticks</td></tr></tbody></table> <!--[1--><h2 class="relative group"><a id="actions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#actions"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Actions</span></h2><!--]--><!----> <p><strong>WildfireAction</strong>: <code>action</code> (<code>"water"</code>, <code>"break"</code> or <code>"wait"</code>), plus <code>x</code> and <code>y</code> for water and break.</p> <ul><li><code>water</code> uses 1 water unit. It extinguishes a burning cell or dampens fuel (both become <code>4</code>).</li> <li><code>break</code> uses 1 firebreak unit and turns the cell into a firebreak (<code>3</code>).</li> <li><code>wait</code> does nothing, and the fire keeps spreading.</li></ul> <!--[1--><h2 class="relative group"><a id="observation" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#observation"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Observation</span></h2><!--]--><!----> <p><strong>WildfireObservation</strong>:</p> <ul><li><code>grid</code>, <code>width</code>, <code>height</code>: the grid (see above)</li> <li><code>step</code>: step number (0 after reset)</li> <li><code>wind_dir</code>: <code>N</code>, <code>NE</code>, <code>E</code>, <code>SE</code>, <code>S</code>, <code>SW</code>, <code>W</code>, <code>NW</code> or <code>CALM</code></li> <li><code>humidity</code>: 0.0 to 1.0, higher means less spread</li> <li><code>burning_count</code>, <code>burned_count</code>: cells on fire and ash cells</li> <li><code>remaining_water</code>, <code>remaining_breaks</code>: resources left</li> <li><code>reward_hint</code>: same value as the step reward</li> <li><code>reward</code>, <code>done</code></li></ul> <p><code>env.state()</code> returns a <code>WildfireState</code> with <code>episode_id</code>, <code>step_count</code>, <code>total_burned</code>, <code>total_extinguished</code>, <code>last_action</code> and the full grid and timers.</p> <p>The episode ends when no cell is burning or after <code>max_steps</code> steps (default 128).</p> <!--[1--><h2 class="relative group"><a id="reward" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#reward"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Reward</span></h2><!--]--><!----> <p>Each step sums the action reward, the fire dynamics and a time penalty:</p> <table><thead><tr><th>Event</th><th>Reward</th></tr></thead><tbody><tr><td>Water a burning cell</td><td>+0.25</td></tr><tr><td>Water a fuel cell</td><td>-0.10</td></tr><tr><td>Water a damp, ash or firebreak cell</td><td>-0.05</td></tr><tr><td>Firebreak on fuel or a damp cell</td><td>+0.15</td></tr><tr><td>Firebreak on a burning cell</td><td>-0.02</td></tr><tr><td>Firebreak on ash</td><td>-0.02</td></tr><tr><td>Firebreak on a firebreak</td><td>-0.01</td></tr><tr><td>Invalid action (unknown, out of bounds, missing coordinates, no resources left)</td><td>-0.05</td></tr><tr><td>Fire spread: each extra burning cell after the fire update</td><td>-0.15</td></tr><tr><td>Fire shrink: each burning cell fewer after the fire update</td><td>+0.10</td></tr><tr><td>Each new ash cell</td><td>-0.05</td></tr><tr><td>Every step</td><td>-0.01</td></tr></tbody></table> <p>When the episode ends, it adds <code>0.2 * (1 - burned_ratio)</code>, plus <code>0.5 + 0.5 * saved_ratio</code> if the fire is out.</p> <!--[1--><h2 class="relative group"><a id="fire-spread" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#fire-spread"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Fire Spread</span></h2><!--]--><!----> <p>Each burning cell can ignite its 8 neighbors. The ignition probability is <code>0.30 * (1 - humidity)</code>, times 2.0 downwind, 0.5 upwind and 1.0 across the wind, and times 0.6 for diagonal neighbors. Humidity varies by ±0.05 around the configured value at each reset.</p> <!--[1--><h2 class="relative group"><a id="configuration" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#configuration"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Configuration</span></h2><!--]--><!----> <p>Set these environment variables before starting the server:</p> <table><thead><tr><th>Variable</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><code>WILDFIRE_WIDTH</code></td><td><code>16</code></td><td>Grid width</td></tr><tr><td><code>WILDFIRE_HEIGHT</code></td><td><code>16</code></td><td>Grid height</td></tr><tr><td><code>WILDFIRE_HUMIDITY</code></td><td><code>0.25</code></td><td>Base humidity</td></tr><tr><td><code>WILDFIRE_WIND</code></td><td>random</td><td>Fixed wind direction (<code>N</code> … <code>NW</code>, <code>CALM</code>)</td></tr><tr><td><code>MAX_CONCURRENT_ENVS</code></td><td><code>8</code></td><td>Maximum concurrent WebSocket sessions</td></tr><tr><td><code>ENABLE_WEB_INTERFACE</code></td><td><code>true</code> in the Docker image</td><td>Serve the web interface at <code>/web</code></td></tr></tbody></table> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-bash "><!---->docker run -p 8000:8000 -e WILDFIRE_WIDTH=32 -e WILDFIRE_HEIGHT=32 -e WILDFIRE_WIND=N wildfire-env:latest<!----></pre></div><!----> <p>Other settings (<code>init_sources=2</code> initial fires, <code>max_steps=128</code>, <code>water_capacity=8</code>, <code>break_capacity=50</code>, <code>seed=3407</code>) are constructor arguments of <code>WildfireEnvironment</code> in <code>server/wildfire_environment.py</code>.</p> <!--[1--><h2 class="relative group"><a id="web-interface" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#web-interface"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Web Interface</span></h2><!--]--><!----> <p>The web interface shows the grid as colored cells. Click a cell to fill in the coordinates, pick an action and run it. It also shows the remaining resources, wind, humidity and an action log.</p> <!--[1--><h2 class="relative group"><a id="references" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#references"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>References</span></h2><!--]--><!----> <ul><li><a href="https://www.fs.usda.gov/rm/pubs_series/rmrs/gtr/rmrs_gtr371.pdf" rel="nofollow">Rothermel surface fire spread model (USDA Forest Service)</a></li> <li><a href="https://github.com/mitrefireline/simfire" rel="nofollow">SimFire (MITRE Fireline)</a></li> <li><a href="https://huggingface.co/papers/2311.15925" rel="nofollow">Reinforcement Learning for Wildfire Mitigation in Simulated Disaster Environments</a></li></ul> <!--[1--><h2 class="relative group"><a id="citation" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#citation"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>Citation</span></h2><!--]--><!----> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-bibtex "><!----><span class="language-xml">@techreport</span><span class="hljs-template-variable">{rothermel2022surface,
title = {The Rothermel Surface Fire Spread Model and Associated Developments}</span><span class="language-xml">,
author = </span><span class="hljs-template-variable">{Andrews, Patricia L. and Rothermel, Richard C.}</span><span class="language-xml">,
year = </span><span class="hljs-template-variable">{2022}</span><span class="language-xml">,
institution = </span><span class="hljs-template-variable">{USDA Forest Service}</span><span class="language-xml">,
number = </span><span class="hljs-template-variable">{RMRS-GTR-371}</span><span class="language-xml">,
url = </span><span class="hljs-template-variable">{https://www.fs.usda.gov/rm/pubs_series/rmrs/gtr/rmrs_gtr371.pdf}</span><span class="language-xml">
}
@article</span><span class="hljs-template-variable">{tapley2023reinforcement,
title = {Reinforcement Learning for Wildfire Mitigation in Simulated Disaster Environments}</span><span class="language-xml">,
author = </span><span class="hljs-template-variable">{Tapley, A. and Dotter, M. and Doyle, M. and others}</span><span class="language-xml">,
journal = </span><span class="hljs-template-variable">{arXiv preprint arXiv:2311.15925}</span><span class="language-xml">,
year = </span><span class="hljs-template-variable">{2023}</span><span class="language-xml">,
url = </span><span class="hljs-template-variable">{https://arxiv.org/abs/2311.15925}</span><span class="language-xml">
}
@misc</span><span class="hljs-template-variable">{mitrefireline2023simfire,
author = {{MITRE Fireline Project}</span><span class="language-xml">},
title = </span><span class="hljs-template-variable">{SimFire: Wildfire Simulator for Decision-Support and AI Research}</span><span class="language-xml">,
year = </span><span class="hljs-template-variable">{2023}</span><span class="language-xml">,
howpublished = </span><span class="hljs-template-variable">{\url{https://github.com/mitrefireline/simfire}</span><span class="language-xml">}
}
@misc</span><span class="hljs-template-variable">{wildfire-openenv-2025,
title = {Wildfire Environment for OpenEnv: Containment-Focused RL Simulation}</span><span class="language-xml">,
author = </span><span class="hljs-template-variable">{OpenEnv Contributors}</span><span class="language-xml">,
year = </span><span class="hljs-template-variable">{2025}</span><span class="language-xml">,
url = </span><span class="hljs-template-variable">{https://github.com/huggingface/OpenEnv}</span><span class="language-xml">
}</span><!----></pre></div><!----> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/openenv/blob/main/docs/source/environments/wildfire.md" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg><!----> <span><span class="underline">Update</span> on GitHub</span></a><!----> <p></p><!--]--><!----><!--]--><!--]--><!--]--> <!--[-1--><!--]--><!--]-->
<script>
{
__sveltekit_1hywj02 = {
base: "/docs/openenv/main/en",
assets: "/docs/openenv/main/en"
};
const element = document.currentScript.parentElement;
Promise.all([
import("/docs/openenv/main/en/_app/immutable/entry/start.uSpCQ2t3.js"),
import("/docs/openenv/main/en/_app/immutable/entry/app.bOWJ-27z.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 14],
data: [null,null],
form: null,
error: null
});
});
}
</script>

Xet Storage Details

Size:
36.2 kB
·
Xet hash:
f1a6cb745835d2cbbffb7fe1890f95cdd2e65c952c2a771d551bae3955634a06

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.