<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Omri Kaduri on Medium]]></title>
        <description><![CDATA[Stories by Omri Kaduri on Medium]]></description>
        <link>https://medium.com/@omrikaduri?source=rss-bdd98c8f5e5d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*W7htIB6EI3vSTFxH6AhJUA.jpeg</url>
            <title>Stories by Omri Kaduri on Medium</title>
            <link>https://medium.com/@omrikaduri?source=rss-bdd98c8f5e5d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 01:07:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@omrikaduri/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Neural-Implicit Representations for 3D Shapes and Scenes]]></title>
            <link>https://medium.com/data-science/neural-implicit-representations-for-3d-shapes-and-scenes-c6750dff49db?source=rss-bdd98c8f5e5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6750dff49db</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[computer-graphics]]></category>
            <category><![CDATA[deep-dives]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Omri Kaduri]]></dc:creator>
            <pubDate>Sun, 26 Jun 2022 16:43:50 GMT</pubDate>
            <atom:updated>2022-07-15T12:52:40.177Z</atom:updated>
            <content:encoded><![CDATA[<h4>In recent years there is an explosion of neural implicit representations that helps solve computer graphic tasks. In this post, I focus on their applicability to three different tasks — shape representation, novel view synthesis, and image-based 3D reconstruction.</h4><p>The field of computer graphics has flourished in recent years alongside deep learning, with several contributions that have had a major impact on the field. Computer graphics tackles the problem of <strong>creating images with a computer</strong>. While it might sound simple, it is certainly a complex task to create physically correct and realistic images. To do so, one needs to understand how to represent 3D scenes, which typically contain light, different materials, several geometries, and the model of a camera that is taking the picture. Fortunately, researchers have found fascinating ways to solve computer graphics problems using deep learning models.</p><p>To put it <strong>simply-but-not-accurately</strong>, this post aims to distill the progress of the following deep learning-based solutions to computer graphics tasks:</p><ol><li>2017–2019 — How to represent <strong>shapes</strong> with neural networks (NN). I will focus on the line of works that used <a href="https://jasmcole.com/2019/10/03/signed-distance-fields/">Signed Distance Functions</a> to do so.</li><li>2019–2020 — How to represent <strong>scenes</strong> with NNs. Specifically, how can a neural network represent a full scene, with all its fine-grained details from lightning, texture &amp; shapes?</li><li>2021 —2022 — How can we <strong>understand </strong>scenes with NNs? Specifically, Given the neural scene representation, how can we reconstruct the 3D surfaces in the scene?</li><li>2022 — How can we make it faster?</li></ol><p>This is simply my way to distill the progress into different stages, while obviously, the field did not progress in such a clear way. People tried to understand scenes with NNs before 2021, and shape representation is still something people are working on (generalizing between shapes is still an issue). However, this order makes the ideas and works I’ll cover in this post, in my opinion, easier to grasp.</p><h3><strong>A Brief Background on Computer Graphics</strong></h3><p>While I assume the reader to be familiar with deep learning (gradient descent, neural networks, etc.), I will give here a brief background for some of the terms that will be used in this post for completeness.</p><h4><strong>Ray-tracing vs rasterization for rendering</strong></h4><p>Note that there are two categories for rendering images — <a href="https://en.wikipedia.org/wiki/Rasterisation"><strong>rasterization</strong></a> and <a href="https://en.wikipedia.org/wiki/Ray_tracing_(graphics)"><strong>ray-tracing</strong></a>. Check <a href="https://blogs.nvidia.com/blog/2018/03/19/whats-difference-between-ray-tracing-rasterization/#cancel">this post from Nvidia</a> for an intro to them, and I <strong>highly recommend </strong>watching the videos from Disney on <a href="https://disneyanimation.com/technology/hyperion/">Hyperion</a>, their (ray-tracing) rendering engine, that explains intuitively the process of computationally modeling the paths of light from the light source, through several collisions with objects, to the camera. However, if you’re not that familiar with rendering, just note that <strong>rasterization is much faster </strong>on modern GPUs, yet it does not model the physical world as well as ray-tracing-based rendering. In this post, I will focus on works that leverage differential ray-tracing rendering as they tend to produce superior results, and I will describe ways to make them usable for real-time applications.</p><h4><strong>3D Geometry Representations</strong></h4><p>While it is clear that a 3D scene contains several 3D objects, it is not clear how to represent their geometries. There is no canonical representation that is both computationally and memory efficient yet allows for representing high-resolution geometry of arbitrary topology. Several <a href="https://www.antoinetlc.com/blog-summary/3d-data-representations">representations</a> evolved, and the most commonly used are <a href="https://en.wikipedia.org/wiki/Polygon_mesh">meshes</a>, <a href="https://en.wikipedia.org/wiki/Voxel">voxel-based</a> or <a href="https://en.wikipedia.org/wiki/Point_cloud">point-based</a>. If you are not familiar with those terms, I suggest you to read them before following on. However, the important thing to note is that those approaches have inherent tradeoffs regarding <strong>efficiency</strong> (voxel-based representations memory usage grows cubically with respect to the resolution), <strong>expressivity</strong> (fine geometry such as hair is notoriously hard to model using meshes), or <strong>topological constraints</strong> (producing a <a href="https://davidstutz.de/a-formal-definition-of-watertight-meshes/">watertight surface</a> — a closed surface with no holes in it — directly from a point cloud may not be a trivial task).</p><p>All the representations above share a common property — they rely on an explicit formulation of the geometry. However, it does so by approximating the 3D surface with discrete objects, such as triangles, grids, or simply points. Another common way to represent 3D objects is using <strong>continuous</strong> <a href="https://en.wikipedia.org/wiki/Implicit_surface"><strong>implicit representations</strong>.</a> Generally, an implicit function represents a geometry as a function that operates on a 3D point that satisfies:</p><ol><li>F(x,y,z)&lt;0 — interior point</li><li>F(x,y,z)&gt;0 — exterior point</li><li>F(x,y,z)=0 — surface point</li></ol><p>Specifically, the <a href="https://en.wikipedia.org/wiki/Signed_distance_function">Signed Distance Function</a> (SDF) satisfies those properties. The SDF is simply the distance of a given point to the object <a href="https://en.wikipedia.org/wiki/Boundary_(topology)">boundary</a> and sets the sign of the distance accordingly to the rules above. If implicit representations are new to you, I recommend reading the <a href="http://web.missouri.edu/~duanye/course/cs8620-spring-2017/lecture-notes/3a-implicit-geometry.pdf">lecture notes from the Missouri CS8620 course</a>. Keep in mind that the SDF has many nice properties (can be used to calculate intersections easily and make ray-casting fast). However, it is not trivial how to obtain the SDF of some shape?</p><p>Visually, an SDF of a sphere can be seen as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*AAG3rW4LR3lkmseOVrgbkA.png" /><figcaption>A visual of a signed distance surrounding a sphere. <a href="https://www.researchgate.net/publication/319307450_Particle_Tracking_Acceleration_via_Signed_Distance_Fields_in_DAGMC">Figure source</a>.</figcaption></figure><h4><strong>Computer Graphics Tasks</strong></h4><p>Recall that the general goal of computer graphics is to create images using computers. This goal can be decomposed into several problems. Today, I will focus on how deep learning helps solve the following computer tasks:</p><ol><li><strong>Shape Representation</strong> — As I detailed above, representing 3D shapes is not trivial. While several classical representations exist, I will detail in this post how using neural networks allows us to represent continuous 3D shapes (the SDF specifically) efficiently.</li><li><strong>Novel View Synthesis (NVS)</strong> — Given several images from a scene, how can we generate images from new views? How many images are needed, and what properties other than the view can we control (i.e., can we generate views with different lighting)?</li><li><strong>Surface Reconstruction — </strong>Given several images of a surface, how can we reconstruct its 3D model?</li></ol><p>One might now wonder if solving NVS implicitly solves the surface reconstruction task. It is reasonable to think that if a computer can generate novel views of a scene, it had to (implicitly) reconstruct the 3D model of the scene. Therefore, it might seem like solving NVS (i.e., fitting a NeRF to a scene) solves the surface reconstruction problem. While it sounds correct, it is not entirely true and I will describe a mechanism that reconstructs a surface by solving the NVS task.</p><h3><strong>1. NNs for shape representation</strong></h3><p>How can one obtain an efficient and compact representation while capturing high-frequency, local detail is a challenging task. While implicit representations are an efficient way to represent shapes, it is hard to obtain them using classical methods. Among the first successful applications of deep learning for this task, was DeepSDF.</p><h4><strong>1.1 </strong><a href="https://arxiv.org/pdf/1901.05103.pdf"><strong>DeepSDF</strong></a><strong> — Neural networks to represent the SDF</strong></h4><p>Given a mesh, how can we find its SDF? Classical approaches approximated an SDF by discretizing space by a 3D grid, where each voxel represents a distance. These voxels are expensive in memory, especially when a fine-grained approximation is needed.</p><p><a href="https://arxiv.org/pdf/1901.05103.pdf">DeepSDF</a> suggested approximating it using a neural network, that simply learns to predict for a given point its SDF value. To train the network, they sampled a large number of points with their corresponding SDF. They sampled more points around the object’s surface to capture a detailed representation.</p><p>Once we can represent the SDF using a neural network, several questions about this representation arise. Can one network generalize to represent several shapes, instead of training a specific network for each shape? If so, does the continuous representation of multiple shapes enable us to interpolate between them? Without diving into the details, I note that DeepSDF indeed showed some level of generalization between shapes, by conditioning the DeepSDF network on a trainable shape code. Please refer to DeepSDF Section 4 for more details.</p><h4>1.2. <a href="https://arxiv.org/pdf/2003.10983.pdf"><strong>DeepLS</strong></a><strong> — Trading computation for memory</strong></h4><p>While DeepSDF achieved remarkably good results in approximating the SDF, it was costly to train and infer from. The MLP network typically was built from ~2M parameters, making the training &amp; inference for a high-resolution 3D shape to be costly. Recall that DeepSDF is a <strong>coordinate-based</strong> (i.e., a network that operates on a single coordinate at a time) network. Therefore, during training, a<strong> gradient for each one of the ~2M parameters has to be computed for every single point.</strong> Training DeepSDF for a specific mesh was done with 300–500K points, and that caused the training to be computationally expensive. Accordingly, using the network for inference was costly as well.</p><p>A naive suggestion is to make the training &amp; inference of DeepSDF faster by simply using a smaller network. However, as shown by DeepSDF, their network architecture was chosen after considering the speed vs accuracy tradeoff, as they found that a smaller model performs worse. A more sophisticated approach is needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*dJWB3ZcduapS0vfva1hOeA.png" /><figcaption>DeepSDF regression accuracy as a function of network depth. Figure from <a href="https://arxiv.org/pdf/1901.05103.pdf">DeepSDF</a>.</figcaption></figure><p><a href="https://arxiv.org/pdf/2003.10983.pdf">DeepLS</a> suggested solving it by incorporating a crucial and well-known observation in the classical computer graphics literature —<strong>A large surface can be decomposed into</strong> <strong>local shapes.</strong> Therefore, they divide space into a grid of voxels, where each voxel stores information about the surface in a small local neighborhood. This information is stored as a <strong>learned latent code </strong>(i.e., A latent code z_i is stored for each voxel V_i). That way, the grid essentially <strong>encodes local information</strong> about the shape, and the network maps this local information to the SDF value. In essence, their method is:</p><ol><li>Divide space into a regular grid of voxels.</li><li>For a given point, <strong>x</strong>, find the corresponding voxel on the grid <em>V_i</em>.</li><li>Transform x to the <em>V_i </em>local coordinate system. <em>T_i</em>(<em>x</em>)=<em>x</em>−<em>x_i</em></li><li>Feed the latent code (z_i) and the transformed coordinate (T_i) to the network and regress the SDF.</li><li>Repeat 2–5 for some large number of steps, while optimizing for the latent codes (z_i) and the neural network parameters.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6HIS3t4dFjl9KbiVe04E0w.png" /><figcaption>A 2D comparison of DeepSDF and DeepLS approaches. DeepSDF represents a specific shape SDF using a point and some shape-code (z), while DeepLS utilize a grid to represent local shape codes. Note that DeepLS optimizes both the neural network parameters and the latent vectors (z_i). The figure is taken from <a href="https://arxiv.org/pdf/2003.10983.pdf">DeepLS</a>.</figcaption></figure><p>Here I suggest another way to think about their suggestion. A common theme in analyzing learning problems is to split the task into two different sub-tasks. First, a feature extraction task, which given the raw data (a 3D point, in our case) produces an extracted feature vector that describes the data. Then, a second sub-task is to regress the SDF value given that feature vector. Traditionally, the feature extraction part does the “heavy lifting” of transforming raw data into good representation features that enables the regression (down-stream task, in general) to be simple. While this description might sound vague, today’s deep learning practitioners are used to the idea of <a href="https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html">using a large frozen (already trained on a massive dataset) neural network</a> as a feature extractor and training a small model that takes these features as input for a given task.</p><p>With this in mind, I see the DeepLS’s grid as a <strong>local feature extractor</strong> and the neural network as a simple regression model. Therefore, the regression model can be much smaller. Specifically, their neural network has only<strong> 50K </strong>parameters, in contrast to the <strong>~2M</strong> parameters of DeepSDF. Moreover, while the grid itself might be large (even larger than the DeepSDF network itself), at each pass through the network only a <strong>small amount of parameters affect the computation</strong>! That causes the training and inference to be much faster, while trading compute for memory.</p><p>Overall, using the grid, DeepLS is significantly more efficient than DeepSDF. In the following example, DeepLS is<strong> 10,000x faster to train </strong>than DeepSDF.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*PtbR2ftMO7vPt-L6vgRExA.png" /><figcaption>DeepLS and DeepSDF training time comparison on the <a href="https://en.wikipedia.org/wiki/Stanford_bunny">Stanford Bunny</a>. DeepSDF took <strong>8 days </strong>to reach DeepLS results after <strong>1 minute</strong>. That’s about<strong> 10,000x faster. </strong>Figure from<a href="https://arxiv.org/pdf/2003.10983.pdf"> DeepLS</a>.</figcaption></figure><p>Note that DeepLS measured their contribution in several aspects, while I focus only on <strong>efficiency</strong>. Please refer to their paper for more details.</p><h3>2. NNs for scene representation</h3><p>In this part, I will focus on the scene representation task. Specifically, on solving the novel view synthesis task using neural networks, as suggested by <a href="https://arxiv.org/pdf/1906.01618.pdf">SRN</a> and <a href="https://arxiv.org/pdf/2003.08934.pdf">NeRF</a>. This might not seem very related to the previous part at first, but in the next part, it will hopefully make sense.</p><h4><strong>2.1. </strong><a href="https://arxiv.org/pdf/1906.01618.pdf"><strong>SRN</strong></a><strong> —Representing Scenes With Neural Networks</strong></h4><p>Until now, we discussed shape representation. However, to solve the novel view synthesis task, a <strong>scene representation </strong>is needed. Ideally, this representation will be continuous and enable one to <strong>query the scene from different views</strong> and control the scene properties (for example, its light sources)<strong>. </strong><a href="https://arxiv.org/pdf/1906.01618.pdf">SRN</a> proposed to represent the scene using a neural network.</p><p>Wait, how can we train a neural network to represent the scene? For us to do so, we need to somehow supervise the network on how well it represents the scene. It means that we need it to generate images from specific views we have on the scene and train it to minimize the difference between the generated image and the true one. While generating images using neural networks (so-called generative models, such as the famous <a href="https://arxiv.org/abs/1812.04948">StyleGAN</a>) made great success in recent years, it failed to do so in a multi-view consistent manner, and precisely conditioning it on a 3D viewpoint is non-trivial.</p><p>Therefore, SRN suggested using a <strong>differentiable renderer </strong>to train a network to represent the scene. While the SRN training mechanism is somewhat complex, the general idea can be intuitively simplified. Given a 3D coordinate, the neural network represents it as a<strong> feature of the scene</strong> at that coordinate. Then, they generate the corresponding pixel color for that coordinate’s features, using a differentiable renderer. For a given a specific pixel, its <strong>color is affected by multiple 3D coordinates </strong>along the ray reaching the camera and intersecting that pixel. The ray from the camera through the pixel can be seen in the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uRBJx6I46g-oudEv.png" /><figcaption>The four basic steps of volume ray casting. For each pixel in the image plane (the bar at the bottom of the image) a ray is marched through the volume (1). Several coordinates are sampled along that ray (2), and their colors are computed (3). Then, an aggregation of their colors defines the pixel color. Figure from <a href="https://en.wikipedia.org/wiki/Volume_ray_casting">Wikipedia</a>.</figcaption></figure><p>However, since there are infinite 3D coordinates along that ray, and the scene geometry implicitly emerges during training, SRN had to deal with a critical problem — <strong>how to decide what points to sample along the ray</strong>? Naively sampling an immense number of 3D coordinates for each ray without knowing where to focus is impractical.</p><p>Therefore, SRN suggested a somewhat complex temporal ray marching layer (called ray-marching LSTM) to solve the sampling problem. Specifically, they used an LSTM that given a ray starting for the camera, iteratively looks for its intersection 3D coordinate with the scene geometry and returns that 3D coordinate extracted features. Then, a pixel generator network is used to map the 3D coordinate feature vector to a single RGB value — the corresponding pixel color. By doing so, they compare the color of the generated pixel and the original pixel color from the given image, thus <strong>supervising the scene representation network using images only</strong>.</p><p>While their mechanism is somewhat complex, I suggest you keep in mind the general flow of neural representation learning, as it is much simpler to grasp. Basically, given a set of images of a scene, we use a neural network to represent the scene and render that scene from different views, by simply supervising the network to produce views of the scene that are the same as the original views.</p><p>A crucial limitation that was acknowledged as possible future work in SRN&#39;s original paper is <strong>modeling view and lightning effects</strong>. How one should encode this information to SRN was unclear.</p><h4><strong>2.2. And then there was </strong><a href="https://arxiv.org/pdf/2003.08934.pdf"><strong>NeRF</strong></a><strong> — Neural Radiance Fields</strong></h4><p>As often occurs in research, simpler solutions tend to arise after complex solutions are suggested, yielding superior results with a more intuitive mechanism. The <a href="https://arxiv.org/pdf/2003.08934.pdf">NeRF</a> authors suggested modeling the scene using a (coordinate-based) MLP, that given a 5D input (a location and viewing direction) produces the color and density (RGB-alpha). Instead of mapping a coordinate to latent features, and using the complex mechanism of SRN to generate the corresponding pixel colors, NeRF directly regresses the RGB-alpha value for that coordinate and feeds it into a differentiable ray-marching renderer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NPIyMDTTAfn64mcYK5Vqiw.png" /><figcaption>NeRF synthesizes images by sampling 5D coordinates (location and viewing direction) along camera rays (a), feeding those locations into an MLP to produce a color and volume density (b), and using volume rendering techniques to composite these values into an image (c). Figure from <a href="https://arxiv.org/pdf/2003.08934.pdf">NeRF paper</a>.</figcaption></figure><p>Volume rendering might sound scary. But the important thing to note is that volume rendering is basically all about<strong> approximating the summed light radiance</strong> <strong>along the ray</strong> reaching the camera. Since we are summing light, it is crucial that we can weigh “how much the light coming from some position along the ray coordinate affects the total light?” concerning the scene properties (occlusions, material, etc.). Intuitively, we would want to give<strong> large weight to opaque objects</strong>, and <strong>small weight to transparent objects</strong>, for us to be able to see through glass but not through tables. And that’s the crucial rule that predicting the density (sigma) value has in the NeRF algorithm.</p><p>Using the 5D coordinate-based MLP, NeRF estimates each pixel color by computing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MKrZ3Ufs9QX0MZBnUVkoWw.png" /><figcaption>The formula to compute predicted color, C^(r), for a ray traced from the camera through a pixel. T_i computes the accumulated transmittance (i.e., the probability that a ray travels up to some distance without hitting an opaque particle). <strong><em>σi</em></strong> denotes the predicted density (alpha) value at a given 5D coordinate, and <strong><em>δi</em></strong> is the distance between adjacent samples along the ray.</figcaption></figure><p>I am skipping the specific parts, such as details about NeRF training mechanism, sampling coordinates along the ray, and positional encoding since a <a href="https://www.youtube.com/watch?v=CRlN-cYFxTk"><strong>lot</strong></a><strong> </strong><a href="https://datagen.tech/guides/synthetic-data/neural-radiance-field-nerf/"><strong>has</strong></a><strong> </strong><a href="https://blog.devgenius.io/paper-explained-nerf-representing-scenes-as-neural-radiance-fields-for-view-synthesis-e16567180531"><strong>been</strong></a><strong> </strong><a href="https://medium.com/swlh/nerf-neural-radiance-fields-79531da37734"><strong>written</strong></a><strong> </strong><a href="https://www.analyticsvidhya.com/blog/2021/04/introduction-to-neural-radiance-field-or-nerf/"><strong>on</strong></a><strong> </strong><a href="https://towardsdatascience.com/its-nerf-from-nothing-build-a-vanilla-nerf-with-pytorch-7846e4c45666"><strong>it</strong></a><strong> </strong><a href="https://www.casualganpapers.com/eccv-3d-novel-view-synthesis-differentiable-rendering-implicit-representation/NeRF-explained.html"><strong>before</strong></a>.</p><h3>3. NNs for understanding scenes</h3><p>NeRF suggested an amazingly powerful scene representation. Yet, it couples all scene properties together, from structure to lightning. Here, I’ll describe ways to extract a geometry (surface) out of it.</p><p><a href="https://arxiv.org/pdf/2106.12052.pdf"><strong>VolSDF</strong></a><strong> &amp; </strong><a href="https://arxiv.org/pdf/2106.10689.pdf"><strong>NeuS</strong></a><strong> — From Density to Signed Distance</strong></p><p>NeRF showed great success in capturing a scene. Yet, while NeRF can generate novel views of the scene, it is not clear how to extract the geometry. At first, it might sound trivial — we already predicting a density value for each coordinate, and that should vaguely describe a surface! Indeed, the density value is high around surfaces, and low far from them. However, defining the threshold for “high” density is far from a trivial task. Also, it is view-dependent, which is not a desired property for a geometry. Therefore, researchers looked for creative ways to modify the NeRF architecture by explicitly learning geometry.</p><p>Recall that an intuitive continuous geometry representation for deep learning is the SDF. Hopefully, we can train a NeRF to predict an SDF value and still use volumetric rendering to train it all end-to-end (and get supervision from the scene images directly, thus reconstructing the geometry without any 3D supervision!). Luckily, at NeurIPS 2021, two interesting papers tackled that specific problem. Their works are dubbed <a href="https://arxiv.org/pdf/2106.12052.pdf">VolSDF</a> and <a href="https://arxiv.org/pdf/2106.10689.pdf">NeuS</a> (read as “news”).</p><p>Both of them suggest training 2 networks —an SDF network, and a color/appearance network. They differ in the way they suggest <strong>transforming</strong> <strong>the SDF values to density values and using them in volume rendering.</strong> The main idea is as simple as that — we want to transform the SDF values such that points near the surface will receive high alpha values, and points far from it will receive low alpha values. That way, the colors of near-surface points will have the largest effect on the ray’s integral. The SDF to density transformation must satisfy the following properties, as described by NeuS:</p><ol><li><strong>Unbiased </strong>— for a given ray, at points where the SDF function produces 0 (i.e., points on the surface) the density value should attain a <strong>locally maximal value. </strong>Note that we only desire locally maximal and not globally since there might be several surface intersections along the ray.</li><li><strong>Occlusion-aware — </strong>When two points have the same SDF value, the point nearer to the camera should have a larger contribution to the final output color.</li></ol><p>Intuitively, the transformation is simply using the <strong>logistic distribution </strong>centered at zero to map SDF values to density values. This is convenient as it is a bell-shaped distribution that is centered at 0, thus assigning the largest density to the SDF value of 0, and decreasing density to SDF values elsewhere in a decreasing manner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*E5zcKwE96Lt8QwUrL320bA.png" /><figcaption>The PDF of the logistic density distribution with mean 0 and std 1. Naively, one can use this distribution to map SDF values to density values. However, as shown by NeuS and VolSDF, more sophisticated approaches are needed to make the transformation unbiased and occlusion-aware.</figcaption></figure><p>I refer the reader to the papers to read about the more sophisticated approaches to constructing the transformation from SDF to density values.</p><p>While they both suggested a neat way to learn the SDF directly from scene observations, they<strong> </strong>are still left with a crucial limitation — training &amp; inferring from these relatively large coordinate-based MLPs is still very <strong>slow. </strong>Specifically, training each one of them for a specific scene takes <strong>~12–14 hours</strong>.</p><h3>4. Connect the dots and make it faster!</h3><h4><strong>4.1. </strong><a href="https://arxiv.org/pdf/2201.05989.pdf"><strong>InstantNGP</strong></a><strong> — Better memory vs compute tradeoff</strong></h4><p>There are two possible directions to make the training &amp; inference of NeRF-based methods faster: sampling <strong>fewer</strong> points along each ray, or sampling <strong>faster</strong>. There are interesting ideas for sampling fewer points, but here I focus on sampling faster.</p><p>Recall that DeepLS made the sampling at DeepSDF faster by incorporating a learnable voxel grid. However, it traded the sampling efficiency with expensive memory costs, as the memory grows cubically with respect to the grid. How expensive? For a simple grid of size 128 with 16-dimensional latent vectors, one would need to store <strong>~33.6M grid parameters</strong>, regardless of the MLP size (which is typically small, about 100–300K params). Unfortunately, simply making that grid smaller will have a severe impact on the performance and the ability to capture fine-detailed geometry. A better solution is needed.</p><p>Luckily, earlier this year (2022) InstantNGP suggested significantly decreasing the memory usage by replacing the grid with a <strong>multi-resolution hash grid.</strong> The key idea behind InstantNGP is to capture the coarse and fine details by several grids of different sizes. A low-resolution grid takes only a small amount of memory and captures coarse details only. A high-resolution grid may capture fine details, at the cost of tremendous memory usage. Therefore, they suggest <strong>indexing the high-resolution grids with a hash table. </strong>Traditionally, in computer science, hash tables are used to tradeoff computation time and memory usage. Their method goes as follows:</p><ol><li>Divide space into several grids of different resolution levels (coarse to fine grids).</li><li>For a given point, <strong>x</strong>, find the indices of the corners of the containing voxels at each resolution level.</li><li>Using the hash table for each resolution level, look up the feature vector of the corners.</li><li><a href="https://en.wikipedia.org/wiki/Trilinear_interpolation">Trilinearly interpolate</a> the feature vectors at each resolution level.</li><li>Concatenate the vectors from each resolution level and feed them into the neural network.</li><li>Repeat 2–5 for a large number of steps, while optimizing for the feature vectors at the multi-resolution grid and the neural network parameters.</li></ol><p>This process is summarized in the following figure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dFCWK_SNyi5aDBd-5i6CPQ.png" /><figcaption>InstantNGP multi-resolution hash-grid demonstration in 2D. Given a coordinate x, find the enclosing voxels at each resolution (denoted as red and blue) and interpolate their edges. Concat the multi-res interpolated vectors and feed them into a neural network, and perform your desired coordinate-based task. Figure from <a href="https://arxiv.org/pdf/2201.05989.pdf">InstantNGP</a>.</figcaption></figure><p>However, it is crucial to point out an unintuitive issue regarding InstantNGP. When one uses a hash table, he needs to address the <strong>possibility of collisions</strong> (i.e., two different 3D coordinates that are mapped to the same feature vector) and <strong>how to resolve</strong> such collisions. Traditional computer science literature on this subject is filled with many sophisticated mechanisms and tricks to reduce the possibility of collision and find ways to quickly resolve collisions when they occur. However, InstantNGP simply <strong>relies on the neural network to learn to disambiguate hash collisions</strong> <strong>itself</strong>.</p><p>Note that InstantNGP provides a general recipe to train coordinate-based neural networks efficiently. Specifically, they show how effective their method is for NeRF, as well as for several other tasks not discussed here. To understand how effective their method is, note that the training time of a NeRF network for a single scene was reduced from ~<strong>12 hours</strong> to about <strong>5 seconds. </strong>That’s about <strong>~8500x faster</strong> in about 2 years.</p><h4>4.2. <a href="https://arxiv.org/pdf/2206.00665.pdf">MonoSDF</a> — surface reconstruction, with volumetric rendering, faster!</h4><p>We learned how to modify NeRF training mechanism to enable explicit SDF representation learning. Also, we learned how to make the NeRF training &amp; inference much faster by incorporating multi-resolution hash tables. MonoSDF combines both approaches along with <strong>geometric cues</strong> to make the surface reconstruction from posed images faster and more accurate.</p><p>Note that MonoSDF not only makes it faster but it aims to perform better, as it provides the network with geometric cues. Specifically, using advances in the field of monocular geometry prediction (i.e., predicting normal or depth images directly from a single RGB image), it supervises the network to render depth and normal images alongside the reconstructed monocular image for the NeRF training. These geometric cues improve both the reconstruction quality and the optimization time. Their (high-level) architecture is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*Ul1ZLu0_qQJJphOx932tMQ.png" /><figcaption>MonoSDF uses a multi-resolution feature grid (as in InstantNGP) to predict both the SDF value, normal (n), and depth (z) value for a given coordinate. They use volume rendering to reconstruct the scene and supervise with pre-trained networks that predict the depth and normal images. Figure from <a href="https://arxiv.org/pdf/2206.00665.pdf">MonoSDF</a>.</figcaption></figure><h3><strong>Conclusion</strong></h3><p>In recent years there is an explosion of neural implicit representations that helps solve computer graphic tasks. In this post, I focused on their applicability to three different tasks — shape representation, novel view synthesis, and image-based 3D reconstruction.</p><p>Having a neural representation is an enabler to solving many interesting tasks, but there is still a large space for improvement. We need representations that are editable (with explicit control), scalable (not only to small scenes in controlled environments), fast-to-query, and generalizable. Each of those requirements encompasses many challenges. I hope that in the following years I will look back on this post and be amazed by how the research community, once again, took us so far from what today seems almost unbelievable progress.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6750dff49db" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/neural-implicit-representations-for-3d-shapes-and-scenes-c6750dff49db">Neural-Implicit Representations for 3D Shapes and Scenes</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep Learning Optimization Theory — Introduction]]></title>
            <link>https://medium.com/data-science/deep-learning-optimization-theory-introduction-148b3504b20f?source=rss-bdd98c8f5e5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/148b3504b20f</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[deep-learning-theory]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Omri Kaduri]]></dc:creator>
            <pubDate>Tue, 26 Oct 2021 16:19:17 GMT</pubDate>
            <atom:updated>2021-11-01T14:30:44.224Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deep Learning Optimization Theory — Introduction</h3><h4>Understanding the theory of optimization in deep learning is crucial to enable progress. This post introduces the experimental and theoretical approaches to studying it.</h4><p>Over the last decade, deep learning flourished in both academia and industry. Both real-world and academic problems that were notoriously hard for decades, such as computer vision, natural language processing, and game-playing, are now being solved with high success using deep learning methods.</p><p>However, despite those significant improvements in deep learning, the theoretical understanding of its success lags behind. Our understanding ranges from conventional wisdom and intuitions that are based on experiments to deeper analysis of toy problems that do not resemble the true complexity of real-world deep learning architectures. This blog post aims to highlight interesting lessons learned from deep learning theory research that challenged conventional wisdom.</p><p>In general, deep learning consists of the following three pillars:</p><ol><li><strong>Expressivity</strong> — What functions can we express with a neural network? How efficient is one neural network concerning the other in terms of the set of functions they can represent? What inductive biases exist in modern neural networks?</li><li><strong>Optimization</strong> — How can we find the best weights for our neural network for a given task? Can we guarantee to find the best one? How fast can we do it?</li><li><strong>Generalization</strong> — Why does a solution on a training set generalize well to an unseen test set? Can we bound the generalization error?</li></ol><p>This post will focus on optimization. The reader is assumed to be familiar with SGD, deep learning, and some background in optimization.</p><p><strong>Deep Learning Theory— Optimization</strong></p><p>Optimization of convex functions is considered a mature field in mathematics. Accordingly, one can use well-established tools and theories to answer the questions described in the last paragraph for optimization. However, optimization of complicated non-convex functions is hard to analyze. Since the optimization of deep neural networks (yes, linear ones also) is non-convex, how can we attempt to answer those questions? One might seek wide empirical evidence that SGD converges to global minima on real-world problems. The other might look for a rigorous theoretical explanation of its convergence and the conditions for it to occur. As both of those approaches, the experimental, and theoretical help push our knowledge further, in this blog post I will present representative works from both approaches. The first approach I will represent is the experimental approach.</p><p><strong>Optimization in DL — An Experimental Approach</strong></p><p>The work “<a href="https://arxiv.org/pdf/1412.6544.pdf">Qualitatively characterizing neural network optimization problems</a>” by Goodfellow et. al., suggested a simple tool to tackle the above-mentioned optimization questions for specific practical networks and problems. Let’s assume you trained your network to convergence for a global optimum (training loss near zero). Now, take the weights at initialization and the weights at convergence, and simply evaluate your loss function at a series of points on a <strong>line in parameter space </strong>between your initial weights and convergence weights. More formally:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*Lcxq_st-FDU_OKEtHJVW-w.png" /><figcaption>Sampled thetas along the line between θi (weights at initialization) to θc (weights at convergence).</figcaption></figure><p>As we suspect the loss function to be highly non-convex, it would be hard to imagine the behavior of the loss function along this line. Surprisingly, performing this experiment on a feed-forward neural network trained on MNIST reveals the following behavior:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*eKPrI_rrH1cdxslL3Fa5_A.png" /><figcaption>A linear interpolation experiment on a fully connected network with ReLU activations, trained on MNIST dataset. This shows that the objective function is smooth within the line between the initial and target parameters of the model. Image <a href="https://arxiv.org/pdf/1412.6544.pdf">source</a>.</figcaption></figure><p>Un-intuitively, we observe that the loss function across this line is a continuous monotonic decreasing function. This suggests that while the loss function itself is highly non-convex, there is an “almost convex” path to the convergence point. Moreover, other experiments with other architectures (CNN/RNN) revealed a similar phenomenon. Please read <a href="https://arxiv.org/pdf/1412.6544.pdf">the paper</a> for more details. If you are interested in experimenting with it yourself, you can use<strong> </strong><a href="https://github.com/OmriKaduri/nn-linear-path-experiments/blob/main/MNIST-Linear-Experiments.ipynb"><strong>my implementation for it</strong></a>.</p><p>Now that we know that a smooth monotonically decreasing path from initial weights to convergence exists, one might ask — does SGD follows this linear path? To answer this question, we are looking for a way to assess “how SGD progressed along the line if projected on it”. Also, in case that those weights are not on that 1D subspace, we would like to assess “how far are they from the line”. We denote the distance along the line by <strong>α</strong> and the distance from that line by <strong>β</strong>. Before diving into the specifics of how α and β are mathematically defined, observe the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*eb0m--oYUHNh70itE7VFEA.png" /><figcaption>Horizontal axis — α (progress along the linear path — 0 is at init, 900 is at final model). Vertical axis — β (distance of SGD weights at time <strong>T </strong>from the linear path). Image <a href="https://arxiv.org/pdf/1412.6544.pdf">source</a>.</figcaption></figure><p>Interestingly, it seems like as SGD progresses, it has a symmetric pattern of diverging and converging to the line. At first, it diverges from it and, at almost complete symmetry, converges back to it.</p><p>Let’s quickly describe the mathematics of those parameters. If you only care for intuition, skip the following paragraph, or just refer to <a href="https://github.com/OmriKaduri/nn-linear-path-experiments/blob/main/MNIST-Linear-Experiments.ipynb"><strong>my implementation</strong></a> if you would like to run this experiment yourself.</p><p>Let us define <strong>u </strong>as the unit vector pointing from θi to θc. We can describe the linear path between θi to θc as: θi + α(t)*u, where α(t) is a scalar representing “how much progress has been made on-the-line”, defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*GlOUTGjjTsmR2dGtGOMrmA.png" /><figcaption>For a timestep t, compute the progress done by SGD projected on the line from initialization to convergence.</figcaption></figure><p>Now we have α that specifies the magnitude we progressed along the line. The missing component is the distance from it. Let us define another unit vector <strong>v</strong> that is pointing in the direction from theta_t to projected progress on the line.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*nHRAaDpd-B17ORcDc5QXIA.png" /><figcaption>For a timestamp t, β is the norm (<strong>distance</strong>) of the weights of SGD from the projected progress of them on the line from initialization to convergence.</figcaption></figure><p>And that’s all needed to reproduce the experiment shown above!</p><p><strong>Do the phenomena hold for modern neural networks?</strong></p><p>Looking back on those results from 2014 today, after immense progress in the field of deep learning, one might ask to revisit the phenomena observed in the original paper. Indeed, <a href="https://arxiv.org/abs/2012.06898">Jonathan Frankle</a> at 2020 experimented with modern NN architectures and datasets and found that the situation might not be as nice as it was with simple architectures on simple datasets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JCiqLJHxbIWz23QsDl6KwA.png" /><figcaption>The linear interpolation experiment was revisited with ResNet-50 on the ImageNet dataset. Loss is no longer monotonically decreasing from init to convergence. Image <a href="https://arxiv.org/abs/2012.06898">source</a>.</figcaption></figure><p>Surprisingly, in modern NN architectures, he did not find this phenomenon to occur. More strangely, he found that this experiment with ResNet-50 on ImageNet resulted in the peculiar observation shown above. Along the line between initial weights to convergence, the loss stays with almost the same value, then increases by a small amount and drops to convergence.</p><p><strong>A Possible Explanation (Opinionated)</strong></p><p>The work <a href="https://arxiv.org/abs/1712.09913">“Visualizing the Loss Landscape of Neural Nets</a>” by Hao Li et. al. provides a method to visualize loss functions curvature. Using their visualization method (which I will do in future posts!) they explore how different network architectures affects the loss landscape. Surprisingly, adding skip-connections to a deep neural network reduces remarkably the landscape from a chaotic to be “almost convex”, as shown in the picture below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ljDG567CGfMrt5hA_R2Mw.png" /><figcaption>A possible (opinionated) explanation for the phenomena observed with ResNet-50. If we assume the skip connections of ResNet to “convexify” the loss function, it may explain the “non-changing loss until a sudden drop to global minimum” observation. <a href="https://arxiv.org/pdf/1712.09913.pdf">Image source</a>.</figcaption></figure><p>This change might bridge the phenomena Goodfellow et. al. found in 2014 and Frankle in 2020. At the right side of the image, it is clear that there is a large flat region of interpolation between initialization weights (assumed to be somewhere on the flat region) to the convergence weights. Moreover, throughout this interpolation, the loss value does not change much.</p><p>To conclude the <strong>experimental approach</strong>, one could say that they gave us a sense of optimism regarding the difficulty of the optimization problem. It suggests that the problems are not as hard as we might have thought. How can we rigorously prove (or disprove) this hypothesis?</p><p><strong>Optimization in DL — A Theoretical Approach</strong></p><p>While the experimental approach gives rise to the conventional wisdom that helps us push deep learning to interesting application usages, it does not provide sound explanations for the observations we have, as seen with the revisited experiments on modern architectures in the previous section. Specifically, I will present one approach that aims towards a better understanding of the loss landscape and therefore its optimization characteristics. Another approach is understanding the trajectory of gradient descent itself, which I will cover in future posts.</p><p><strong>How Nice is The Loss Landscape?</strong></p><p>The work “<a href="https://arxiv.org/pdf/1511.04210.pdf">On the Quality of the Initial Basin in Overspecified Neural Networks</a>” by Itay Safran and Ohad Shamir, approaches the problem by an attempt to model the geometric structure of the (non-convex) loss function. The motivation for this approach is that hopefully, we would find that the <strong>loss landscape </strong>is convenient for optimization (and even more specifically, local search algorithms such as SGD). The observations we have seen before about the empirically existing monotonic decreasing paths encouraged researchers to explain this phenomenon.</p><p>Specifically, this work provides the following theorem: Given a fully connected network, its weights at initialization and convergence, and a convex loss function, there exist a <strong>monotonically decreasing path </strong>that starts from that initialization point and ends up with<strong> the same loss value </strong>(as the convergence point). The mainly non-trivial assumption being made to prove that theorem is that <strong>the loss of an all-zero predictor is smaller than the loss at initialization</strong>.</p><p>Even though this assumption is not being held by modern neural networks (due to recent advancements in weight initialization techniques), their result is highly interesting as it lies in line with the empirical results we saw earlier. They prove that under their assumptions, there is an “easy way for optimization”.</p><p>While providing the full proof and subtle details of their theorem is certainly out-ot-scope for a blog post, let us try to understand the general idea. The main approach in their proof is to create <strong>for each point in the continuous path from init to convergence, create a corresponding point in the monotonically decreasing path. </strong>How do they construct the corresponding point? They provide intuition for the special case of the squared loss:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*QvyX_kmJtCFXBWKCwfVA8Q.png" /><figcaption>The squared loss, evaluated on a neural network <strong>N, </strong>parameterized by weights <strong>W</strong>, for a dataset with <strong>m</strong> samples.</figcaption></figure><p>Since the last layer of the neural network under this objective is linear, note that multiplying the last layer by some scalar <strong>c</strong>, corresponds to multiplying the networks’ outputs. So, given some weights <strong>W(λ) </strong>(where<strong> </strong>0≤<strong>λ</strong>≤1 defines the path between init to convergence), we can multiply the last layer by a scalar c≥0 and receive the corresponding weights (denote by W`), with the objective:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*An2fvFiALWYXPK_OhlsGpw.png" /><figcaption>The corresponding objective for <strong>W(λ)</strong> by multiplying its last layer by a scalar <strong>c.</strong></figcaption></figure><p>Note that for c=0, this objective is the mean of Y². For c=∞, it is ∞ also. It basically says (using the <a href="https://en.wikipedia.org/wiki/Intermediate_value_theorem">intermediate value theorem</a>) that we can tune c to get any objective value from the mean of Y² to ∞. Now all that remains is finding for each W(λ) its corresponding c such that we get the desired monotonically decreasing path!</p><p><strong>Visual Recap</strong></p><p>Grasping this idea might be challenging. To make it easier for you, I made (using the great <a href="https://github.com/ManimCommunity/manim">manim</a> tool, originated from <a href="https://github.com/3b1b/manim">3B1B</a>) a short GIF that illustrates the idea of the proof:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2Fnecessaryminoreyelashpitviper&amp;display_name=Gfycat&amp;url=https%3A%2F%2Fgfycat.com%2Fnecessaryminoreyelashpitviper&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FNecessaryMinorEyelashpitviper-size_restricted.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=gfycat" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8271880ae4b316665443ca026d21423/href">https://medium.com/media/a8271880ae4b316665443ca026d21423/href</a></iframe><p>The visualization starts with the blue curve representing the continuous yet non-convex from init to convergence. Then, it highlights the “all-zeros predictor assumption” and projects rays from it to build the monotonically decreasing path.</p><p><strong>Conclusion</strong></p><p>Our first step towards understanding the optimization of deep learning models was overall optimistic. Previous knowledge in optimization teaches us that optimizing high-dimensional non-linear and non-convex problems is a notoriously hard problem. However, experiments on real-world models (FC/CNN/RNN) provided optimistic results. Moreover, theoretical analyses of the loss landscape were optimistic as well. In some sense, both of those approaches (experimental and theoretical) suggested that the problems we solve with SGD in deep learning might be far easier to solve than what one might think.</p><p>However, jumping to 2020, we observed that revisiting those experiments with modern architectures and datasets revealed different phenomena. While those early findings are encouraging from the practitioner&#39;s point of view, the need for a theory behind the convergence of SGD is still needed. Fortunately, researchers in recent years achieved remarkable results, some of which took different approaches to the landscape approach, which I will review in future posts.</p><p><strong>Acknowledgment</strong></p><p>I want to thank <a href="https://www.cohennadav.com/">Nadav Cohen</a> for teaching a great course on the theory of deep learning at Tel-Aviv University.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=148b3504b20f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/deep-learning-optimization-theory-introduction-148b3504b20f">Deep Learning Optimization Theory — Introduction</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From A* to MARL (Part 5— Multi-Agent Reinforcement Learning)]]></title>
            <link>https://omrikaduri.medium.com/from-a-to-marl-part-5-multi-agent-reinforcement-learning-3519921205ea?source=rss-bdd98c8f5e5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3519921205ea</guid>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[multi-agent-systems]]></category>
            <dc:creator><![CDATA[Omri Kaduri]]></dc:creator>
            <pubDate>Fri, 20 Aug 2021 13:36:30 GMT</pubDate>
            <atom:updated>2021-08-21T17:07:42.269Z</atom:updated>
            <content:encoded><![CDATA[<h4>An intuitive high-level overview of the connection between AI planning theory to current Reinforcement Learning research for multi-agent systems</h4><p>Research of Reinforcement Learning (RL) and Multi-Agent RL (MARL) algorithms has advanced rapidly during the last decade. One might suggest it is due to the rise of deep learning and the use of its architectures for RL tasks. While it is true at some level, the foundations of RL, which can be thought of as a <strong>planning problem formulated as a learning system</strong>, lie in AI planning theory (which has been in development for over 50 years). However, the connection between RL and planning theory might seem vague, as the former is mostly related to deep learning for most practitioners nowadays.</p><p>This blog series aims to start from the classical path-finding problem, with strict <strong>assumptions </strong>about the world we are tackling (deterministic, centralized, single-agent, etc.) and <strong>gradually drop </strong>assumptions until we end up with the MARL problem. In the process, we will see several algorithms suited for different assumptions. Yet, an assumption we will always make is that the <strong>agents are cooperative</strong>. In other words, they act together to achieve a common goal.</p><p>It is important to note that this series will focus on the “multi-agent systems path” from A* to MARL. This will be done by formulating the problems we want to solve and the assumptions we make about the world we operate in. It certainly won’t be an in-depth review of all algorithms and their improvement on each topic.</p><p>Specifically, I will review optimal multi-agent pathfinding (<a href="https://omrikaduri.github.io/2021/08/07/Part-1-MAPF.html">Part 1</a>), classical planning (<a href="https://omrikaduri.github.io/2021/08/07/Part-2-AI-Planning.html">Part 2</a>), planning under uncertainty (<a href="https://omrikaduri.github.io/2021/08/07/Part-3-Planning-Under-Uncertainty.html">Part 3</a>), and planning with partial observability (<a href="https://omrikaduri.github.io/2021/08/07/Part-4-Planning-Under-Uncertatinty-and-Partial-Observability.html">Part 4</a>). Then, I will conclude our journey at RL and its generalization to multi-agent systems (Part 5). I will pick representative algorithms and ideas and will refer the reader to an in-depth review when needed.</p><p><strong>High-level intuition to RL</strong></p><p>The previous chapters have focused on the question of how to find a plan that achieves a goal under various conditions. All planning frameworks we observed, from MAPF to DEC-POMDP, shared a common assumption — they assume they are familiar with the dynamics of the world in which they operate. We formalized the knowledge they assume about the world through several functions, such as the transition and observation functions. It is time to ask what one should do when facing a planning problem without knowing those functions that model the world?</p><p>Intuitively, think about yourself, as you wander through life. You certainly do not possess a model of the world in which you operate, and one would further suggest that your reward function is not well-defined. However, let&#39;s assume you have a gut feeling for what makes you happy, and what doesn’t. Moreover, with it, you (kind of) know what will make your future self happy. For simplicity, let’s treat your guts feeling as a <strong>reward function</strong> that helps you assess different routes in life. To decide what profession suits you, who you should marry with, or even what kind of food you should eat in your mornings, you must experience things, listen to your gut and take actions accordingly. However, even after experiencing and deciding what makes you happy, things might change. You might change due to your new lifestyle, and your gut feeling might change. Things that make you feel good now will not always make you feel good. In a sense, it is not only that you do not own the model of the world, but this model and your gut feeling are also changing, and you need to continuously adapt to it. Making things even more complicated (and real), you might ask how should you decide that you experienced enough and that no other things exist out there that can make you feel even happier?</p><p>This model is obviously too simple to describe how a human operates, but it gives intuition to the fashion in which RL problems are modeled, and what challenges they face. The RL agent, much as you do, learns by trial-and-error interaction with its dynamic environment. How much experience does he needs to collect and how well he adapts to new information, is among the critical challenges research in the field is tracking today.</p><p><strong>Reinforcement learning</strong></p><p>Reinforcement learning is a large topic with rapid advancements. For example, a famous book called “<a href="https://www.andrew.cmu.edu/course/10-703/textbook/BartoSutton.pdf">Reinforcement Learning: An Introduction</a>” takes more than 500 pages for its introduction. Therefore, this will be far less than even a slight overview of the field. However, I will try to give a high-level intuition for the methods used to solve single-agent RL problems, relying on the intuitions and knowledge you collected from the previous chapters on AI planning.</p><p>An RL agent, in our model-free problem, basically only receives rewards from the environment by applying actions. The objective is much the same as was previously. We look for a policy that maps states (or observation of states) to actions such that it would maximize the expected reward. There are mainly two types of methods that search for that policy — value-based and policy-based methods.</p><p><strong>Model-based vs model-free RL — A short note</strong></p><p>Loosely speaking, model-based RL aims to learn a world model from our experience and then derive a policy from it (using the algorithms for MDPs we learned). Model-free RL aims to directly learn a policy from the experience. The question of “what kind of RL is better”, if any, is being addressed for more than <a href="https://www.cs.cmu.edu/~tom/10701_sp11/slides/Kaelbling.pdf#page=15">25 years now</a>. As I personally know more about model-free RL, this is what this post will cover towards MARL.</p><p><strong>Value-based methods for model-free RL</strong></p><p>One might ask how to use the value iteration algorithm we used to find policies for MDPs. Recall that this algorithm aims to find the value function that corresponds to the optimal policy. With that value function in hand, the optimal policy is to simply pick the action that maximizes the value function for each state. However, as we no longer assume we have access to the <strong>transition function</strong>, we can not evaluate the value function since it requires computing the mean value function of all possible next states, weighted by their probability. Therefore, we look for a function that we can evaluate only based on experience, that would serve us to find the optimal policy.</p><p>Luckily, in <a href="http://www.cs.rhul.ac.uk/~chrisw/new_thesis.pdf">1989, Watkins</a> introduced the <strong>Q-learning</strong> <strong>algorithm. </strong>He suggests assigning a value for (state, action) pairs and not states alone. The function that maps a (state, action) pair to a value is called the Q function. It is clear that with the Q function we can still easily find a policy that simply picks the action that maximizes the Q value at each state. So, instead of searching for the optimal policy’s value function, we search for the optimal policy’s Q function. This can be done from the experience we get from applying actions in the world and collecting rewards. So, given some estimation of the Q-value of each state, the update rule of Q-learning is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IsGRMXoFFwuGe0oA2zWWSw.png" /><figcaption>Q-learning update rule</figcaption></figure><p>It basically means that at each step, we take the greedy action according to our currently available Q-function, and update our estimation of the Q-function accordingly. The main part is the temporal difference error. It measures the difference between the current Q-value we had for the current (state, action) pair to the highest Q-value of the next state with the current reward added to it. At convergence, the “<em>temporal difference target</em>” and “<em>old value</em>” parts of the equation should be equal for all (state, action) pairs, and the Q-learning function would converge.</p><p>Yet, one might point out that previously we used the value function since it provided optimality guarantees. Does Q-learning provide those guarantees also? Fortunately, <a href="http://users.isr.ist.utl.pt/~mtjspaan/readingGroup/ProofQlearning.pdf">it will converge to the optimal policy</a>, when all state-action pairs are visited infinitely often.</p><p>However, what “visited infinitely often” means in practice, and how fast can we approach that convergence? How efficient the Q-learning algorithm is in terms of the number of state-action pairs it needs to collect before converging lies in managing the <strong>exploration-exploitation tradeoff</strong>. This trade-off arises when we need to choose between <strong>exploiting</strong> our current knowledge (maximizing rewards according to our best currently known policy) and <strong>exploring</strong> new knowledge and better policies. Simply think of the last time you went to go eat outside. You could choose to eat in one of your favorite restaurants or trying a new one. On the one hand, Choosing the same favorite restaurant every time would certainly provide you with good meals, but you will not find new and even better ones that are out there. On the other hand, if you will constantly try new ones, you will probably experience a large number of bad meals, which you would like to avoid. Read <a href="https://papers.nips.cc/paper/2018/file/d3b1fb02964aa64e257f9f26a31f72cf-Paper.pdf">Jin et al., 2019</a> work for more information on the sample efficiency of Q-learning.</p><p>Note that in practice, more often than not, the state and action spaces are too large for the Q-learning algorithm to converge. Therefore, modern approaches for RL utilize <strong>function approximators</strong>, such as neural networks, to approximate the Q function. A famous example from recent years that combines deep learning with q-learning is the <a href="https://storage.googleapis.com/deepmind-media/dqn/DQNNaturePaper.pdf">Deep Q-Network</a>.</p><p><strong>Policy-based methods for model-free RL</strong></p><p>The main idea in Q-learning, and value-based methods in general, is learning the optimal value function and then obtain a greedy policy by picking the action that maximizes it at every state. Another direction to solve RL is to <strong>directly learn a policy</strong> that determines the probability of choosing an action for a given state. The basic idea is to start with some policy, sample an episode from it, and update the policy according to how well the episode was. The tricky thing is how to determine how to update the policy according to the sampled episode. <strong>Policy gradient</strong> methods tackle this problem by representing the policy as a neural network and using gradient-based optimization to improve it. The network would aim to minimize a loss function that is the expected reward of a given policy.</p><p>Yet, simply saying “gradient-based” does not indicates how we actually derive this gradient? How can we compute the gradient of the expected reward of a given policy? Naively, it would require us to know the state distribution function, which we do not know in RL (as we do not possess the world model). Luckily, a simple formula, named <a href="https://proceedings.neurips.cc/paper/1999/file/464d828b85b0bed98e80ade0a5c43b0f-Paper.pdf">policy gradient theorem</a>, describes the policy&#39;s gradient without knowing the state distribution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/372/1*ihHDJ_0H5UyUsq7jhJT_Ow.png" /><figcaption>The policy gradient theorem defines the gradient of a policy parameterized by theta.</figcaption></figure><p>This formula describes the gradient of a policy, parameterized by theta. The gradient of doing some action <strong>a </strong>in state <strong>s </strong>is the expectation of the Q-value of (s,a) times the log-probability of choosing <strong>a</strong> at state <strong>s</strong>. Follow the links I note in the next paragraph for details on how to derive this formula.</p><p>An issue that policy gradient methods must address is how to estimate the Q-function value. Simple policy gradient methods, such as REINFORCE, use the accumulated future return. Essentially, REINFORCE plays a trajectory from the current policy and uses the information about future rewards at each state to compute the gradient. More sophisticated methods provide better estimates of the gradient, which are both unbiased and with low variance. An example is <strong>Actor-Critic </strong>methods, which essentially train 2 neural networks. One is the <em>policy network </em>that selects an action for a given state, and the other is a <em>critic network </em>that assesses the value of the state. For a more detailed explanation of policy gradient methods, I refer you to read those great blog posts: <a href="https://danieltakeshi.github.io/2017/03/28/going-deeper-into-reinforcement-learning-fundamentals-of-policy-gradients/">1</a>, <a href="https://lilianweng.github.io/lil-log/2018/04/08/policy-gradient-algorithms.html">2</a>. Also, <a href="https://spinningup.openai.com/en/latest/spinningup/rl_intro3.html">OpenAI’s tutorial and code of Policy Gradients</a> are highly recommended.</p><p><strong>Between policy-based and value-based</strong></p><p>While the two approaches described above might not seem compatible, there exist algorithms that try to involve both of them. A famous example is the <a href="http://proceedings.mlr.press/v32/silver14.pdf">DDPG</a> method that learns both a value function and a policy using gradient descent. One might note that Actor-Critic methods, which are mentioned before, are also a mix of both approaches. While it is true, a critical advantage of value-based methods is that they are <strong>off-policy</strong>. It means that it can learn from past experience, which is not even collected by a policy the agent possesses. However, Actor-Critic is an <strong>on-policy </strong>method, and it means that it can only learn from episodes generated by the policy it possesses (otherwise, we will perform steps based on gradients of another function). On the other hand, the DDPG algorithm (usually used variant, at least) is an off-policy method. Moreover, it tackles continuous action spaces, which is a problem for value-based methods. A critical idea behind DDPG is to learn a <strong>deterministic policy.</strong> While it is not intuitive at first glance how can we compute the gradient for a deterministic policy, in <a href="http://proceedings.mlr.press/v32/silver14.pdf">2014 David Silver</a> revealed it to be as straightforward as in the original policy gradient method. Check <a href="https://spinningup.openai.com/en/latest/algorithms/ddpg.html">OpenAI’s tutorial on DDPG</a> for more details on it.</p><p><strong>Quick Recap</strong></p><p>Before examining the multi-agent case of RL, let’s do a quick recap. We introduced RL as the framework to solve planning problems by directly interacting with an environment in which we do not possess a world model. Specifically, we focused on the model-free path, where we wish to directly <strong>learn how to act</strong>, without deriving the world model. We learned about the two main approaches for tackling RL problems — value-based and policy gradients methods. The first approach aims to derive a policy based on its approximation of the value function for each (state, action) pair. The second approach aims to directly optimize a policy based on the interaction with the environment. Common to those approaches is the utilization of neural networks as function approximations to efficiently solve RL problems.</p><p><strong>Generalizing to MARL</strong></p><p>As we have seen along our path, naive approaches convert the multi-agent problem to a single meta-agent problem and decide for all the agents using a centralized controller. However, in those approaches, the number of actions typically exponentially increases, which makes the problem intractable, just as we saw for MDPs and POMDPs. Furthermore, if we assume that the agents are distributed but all agents know about all other agents, they still need to solve the <strong>coordination problem, </strong>which we observed both for MMDP and MPOMDP. Specifically, since multiple optimal policies may exist, they need to learn to coordinate which joint optimal policy to follow. Both of those scenarios, of a single meta-agent and fully observable agents, are out of scope for today. However, the ideas of MARL for those scenarios resemble the ideas we have seen in previous chapters.</p><p><strong>Value-based methods for MARL</strong></p><p>Before diving into specific value-based MARL algorithms, we need to revisit one critical component of Q-learning — <strong>experience replay</strong>. It is a fixed-size buffer that holds the most recent transitions collected by the policy. As greatly described in the <a href="http://www.incompleteideas.net/lin-92.pdf">seminal work of Lin</a>: “By experience replay, the learning agent simply remembers its past experiences and repeatedly presents the experiences to its learning algorithm as if the agent experienced again and again what it had experienced before. The result of doing this is that the process of credit/blame propagation is sped up and therefore the networks usually converge more quickly. However, it is important to note that a condition for experience replay to be useful is that the laws that govern the environment of the learning agent<strong> should not change over time</strong> (or at least not change rapidly), simply because if the laws have changed, <strong>past experiences may become irrelevant</strong> or even harmful.”</p><p>This quote from 1992 is still highly relevant today. Experience replay is a critical component of modern variants of deep Q-learning. Moreover, in 2020 a research by<a href="https://arxiv.org/pdf/2007.06700.pdf"> Fedus et. al</a>. that analyzed the effect of different aspects of experience replay, such as the number of past experiences we store and how many times we “play” those past experiences revealed how critical a good setup of the experience replay mechanism is for modern Q-learning based RL methods to converge.</p><p>However, when generalizing RL to the multi-agent scenario, a problem occurs. At MARL, each agent is faced with a<strong> moving-target learning problem</strong>: the best policy changes as the other agents’ policies change. This is also called <strong>nonstationarity</strong>, and its cause is that the actions performed by other agents might affect the state of the environment. But, if the environmental laws change in time, it is not clear how can we use past experience. And without experience replay, the Q-learning-based approaches can be hard to train due to the sample inefficiency and correlation among the samples. Does it remind you of the problem we faced with DEC-POMDPs in the last chapter? Indeed, we faced a similar problem where we could not plan for each agent in the DEC-POMDP scenario since the Markov property was not satisfied by using only each agent&#39;s observations.</p><p>Therefore, the naive idea of simply decentralizing the RL agents, with each one learns only by its observations of the environment should not be a good solution. This algorithm is called <strong>Independent Q-Learning</strong> (IQL), and while it works for small problems, for large problems that require deep learning, convergence is highly challenging. And here comes another idea we already saw before — instead of searching for the optimal joint policy, let’s try to search for a nash equilibrium joint policy. Recall that nash equilibrium means that the policy assigned for each agent is the best response strategy for the policies of all other agents. This idea was used by <a href="https://www.semanticscholar.org/paper/Deep-Multi-Agent-Reinforcement-Learning-using-to-Fuji-Ito/c4d1fb24eb4e6d7c20de9e6c506fcd17abe290e9">Fuji et. al, 2018</a>, and highly resembles the idea of <a href="https://www.researchgate.net/publication/2570317_Taming_Decentralized_POMDPs_Towards_Efficient_Policy_Computation_for_Multiagent_Settings">JESP</a> for DEC-POMDPs back in 2003 that we introduced in the last chapter. They suggest training only one of the agents at each time while keeping all other agent’s policies fixed.</p><p>While IQL is appealing as it avoids the scalability problems of the multi-agent system, it does not scale to large problems that are solved with deep learning-based methods, as they heavily rely on the experience replay mechanism. Therefore <a href="https://arxiv.org/pdf/1702.08887.pdf">Forester et. al, 2018</a> proposed two algorithms to enable the use of experience replay in IQL-based algorithms for MARL. The first algorithm basically tries to decay obsolete data from the experience replay by assigning a lower probability to sample it. The second algorithm proposes to augment the past experience with some metadata (called a fingerprint) that disambiguates the age of the data sampled from the experience replay. Both algorithms successfully combine experience replay with Deep IQL, and their experiments suggest the fingerprint-based solution achieves superior results.</p><p><strong>Policy-gradient methods for MARL</strong></p><p>In multi-agent RL, the noise and variance of the rewards increase which results in the instability of the training. The reason is that the reward of one agent depends on the actions of other agents, and the conditioned reward on the action of a single agent can exhibit much more noise and variability than a single agent’s reward. Therefore, training a policy gradient algorithm would not be effective in general.</p><p>One successful implementation of policy gradients and value-based methods is <a href="https://arxiv.org/pdf/1706.02275.pdf">MADDPG</a>, which extends the DDPG algorithm to the multi-agent case. It relies on an idea we have seen in DEC-MDP and DEC-POMDP, where training (planning, for MDPs) is centralized, but the execution is decentralized. Thus, the policies may use extra information to ease training, but this information is not used at execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*0PCA2Lr-JvDXZ3oa1I6-VQ.png" /><figcaption><a href="https://arxiv.org/pdf/1706.02275.pdf">MADDPG</a> high-level architecture. Each agent trains a DDPG algorithm, where the critics can access all actions and observations during training, but only the single agents&#39; actions and observations at execution. Image <a href="https://arxiv.org/pdf/1706.02275.pdf">source</a>.</figcaption></figure><p>Each agent in MADDPG trains a DDPG algorithm, which means training two networks — a <strong>policy</strong> and a <strong>critic</strong>. At training, all critics <strong>have access</strong> to information from other agents (their policies, actions, and observations). The motivation for it is that during training, the <strong>environment becomes stationary</strong> for the critics, as they know all other agents&#39; policies and actions. Since the critic is not used at execution, we can discard it and simply use the agent&#39;s policy network in a decentralized way.</p><p>While MADDPG made significant improvements, it has one crucial limitation. The input size of the critics grows linearly with the number of agents. Therefore, it does not suit environments with a large number of agents.</p><p><strong>MARL in the broader sense</strong></p><p>As you might have guessed, we only focused on a specific problem of MARL, which deals with planning for cooperative agents with shared rewards. Yet, in the broader sense of multi-agent learning, one might ask many other interesting questions, such as how non-cooperative agents learn, how people learn in the context of other learners and how can agents learn without an explicitly defined reward function. I refer you to the great paper <a href="https://www.sciencedirect.com/science/article/pii/S0004370207000495">“If multi-agent learning is the answer, what is the question?”</a> for more information.</p><p>For a modern survey of cooperative MARL, <strong>I</strong> <strong>highly recommend </strong><a href="https://arxiv.org/pdf/1908.03963.pdf">this survey</a>, which covers what we have seen in this post and many other methods that solve cooperative MARL.</p><p><strong>Implicit assumptions</strong></p><p>As this series concentrated on dropping assumptions, I feel it is desired to remind you that we are constantly making implicit assumptions, and noting them is a crucial skill that all of us should practice. Let’s try to identify some more assumptions we made throughout this series. We assumed all actions to have the same duration.<strong> </strong>Also, we assumed that all agents are synchronized on this duration. Furthermore, we assumed some definition of a goal, or a reward function, while we clearly do not possess one in our life. And even if we possess a goal/reward definition, we assumed that we plan for rational agents that wish to maximize its expectancy. What other interesting assumptions do you find? Also, have you noticed the assumption of “identifying implicit assumptions is something we can practice”?</p><p><strong>Conclusion</strong></p><p>Well, this was a long journey. We started it way back in the origins of the pathfinding problem. When we extended it to MAPF (<strong>M</strong>ulti-<strong>A</strong>gent <strong>P</strong>ath <strong>F</strong>inding), we immediately saw that generalizing a single-agent problem to multi-agent is not trivial. Then, we went through a richer framework for planning problems, namely STRIPS/PDDL languages. We kept trying to generalize to the multi-agent case and saw some recurring patterns, as the aim to find decoupled agents and exploit this independence between them to more efficiently find a plan.</p><p>Following, we acknowledged that most systems entail some level of uncertainty, and we first added <strong>control uncertainty</strong> and then added <strong>sensor uncertainty</strong>. Those uncertainties made us look for <strong>policies</strong> that map actions to states, rather than a fixed <strong>plan</strong>. We formalized those uncertainties in MDPs and POMDPs, which are the most common framework for AI planning today. Then, we generalized those frameworks for the multi-agent case and again observed recurring issues. For example, the coordination problem, the formulation of the “centralized planning, decentralized execution” line of solutions, and the violation of the Markov property induced by the multi-agent case.</p><p>Finally, we asked how can we plan when we do not possess a model of the world. This is where we entered the land of (model-free) RL. We saw that the methods we used to solve MDPs can be generalized for RL (Q-learning). Also, we saw that basically the same issues we tackled at generalizing MDPs and POMDPs are still relevant at MARL and the ideas behind the solutions from planning might serve us to solve MARL.</p><p>I learned a lot by writing this series. Hope you learned some too. Feel free to contact me with any <strong>questions/suggestions/corrections</strong>.</p><p><strong>Acknowledgment</strong></p><p>I want to thank <a href="https://ronistern.wixsite.com/home">Roni Stern</a>, my MSc thesis supervisor. My interest in this area and large parts of this blog series stems from the wonderful course he teaches on multi-agent systems at Ben-Gurion University, which I had the privilege to take.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3519921205ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From A* to MARL (Part 4 —Planning Under Uncertainty & Partial Observability)]]></title>
            <link>https://omrikaduri.medium.com/from-a-to-marl-part-4-planning-under-uncertainty-partial-observability-4e18d3843277?source=rss-bdd98c8f5e5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e18d3843277</guid>
            <category><![CDATA[multi-agent-systems]]></category>
            <category><![CDATA[markov-decision-process]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <dc:creator><![CDATA[Omri Kaduri]]></dc:creator>
            <pubDate>Fri, 20 Aug 2021 13:35:58 GMT</pubDate>
            <atom:updated>2021-08-21T16:46:27.473Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UiSRWpPsTstJzcgIxZ8wnQ.jpeg" /><figcaption>How can we plan when we only see a part of the world? Image from <a href="https://pixabay.com/photos/mars-mars-rover-space-travel-rover-67522/">pixabay</a>.</figcaption></figure><h4>An intuitive high-level overview of the connection between AI planning theory to current Reinforcement Learning research for multi-agent systems</h4><p>Research of Reinforcement Learning (RL) and Multi-Agent RL (MARL) algorithms has advanced rapidly during the last decade. One might suggest it is due to the rise of deep learning and the use of its architectures for RL tasks. While it is true at some level, the foundations of RL, which can be thought of as a <strong>planning problem formulated as a learning system</strong>, lie in AI planning theory (which has been in development for over 50 years). However, the connection between RL and planning theory might seem vague, as the former is mostly related to deep learning for most practitioners nowadays.</p><p>This blog series aims to start from the classical path-finding problem, with strict <strong>assumptions </strong>about the world we are tackling (deterministic, centralized, single-agent, etc.) and <strong>gradually drop </strong>assumptions until we end up with the MARL problem. In the process, we will see several algorithms suited for different assumptions. Yet, an assumption we will always make is that the <strong>agents are cooperative</strong>. In other words, they act together to achieve a common goal.</p><p>It is important to note that this series will focus on the “multi-agent systems path” from A* to MARL. This will be done by formulating the problems we want to solve and the assumptions we make about the world we operate in. It certainly won’t be an in-depth review of all algorithms and their improvement on each topic.</p><p>Specifically, I will review optimal multi-agent pathfinding (<a href="https://omrikaduri.github.io/2021/08/07/Part-1-MAPF.html">Part 1</a>), classical planning (<a href="https://omrikaduri.github.io/2021/08/07/Part-2-AI-Planning.html">Part 2</a>), planning under uncertainty (<a href="https://omrikaduri.github.io/2021/08/07/Part-3-Planning-Under-Uncertainty.html">Part 3</a>), and planning with partial observability (Part 4). Then, I will conclude our journey at RL and its generalization to multi-agent systems (<a href="https://omrikaduri.github.io/2021/08/07/Part-5-MARL.html">Part 5</a>). I will pick representative algorithms and ideas and will refer the reader to an in-depth review when needed.</p><p><strong>Part 4 - Partial Observability</strong></p><p>In the previous post, we learned how to represent a planning problem with uncertainty with the MDP framework. Specifically, the uncertainty we dealt with stemmed from <strong>control errors, </strong>i.e. we had uncertainty about the outcome of our actions. Now, we will extend our view of uncertainty to include <strong>sensor errors or limitations. </strong>This kind of uncertainty arises when we are not able to determine what the state of the world exactly is. Furthermore, we might not even know for certain what is the initial state. In such cases, we say that the world is<strong> partially observable</strong>.</p><p>A simple motivating example of sensor errors and limitations is planning for the recycling robot. The recycling robot can pick objects and drop them in different trash cans while obeying some predefined logic of what objects should be placed in which trash cans. Yet, while picking an object, the robot does not know if the trash can is full or not, since his camera is not pointing towards the trash can. This illustrates a <strong>sensor limitation</strong>. Moreover, when the robot camera does point towards the trash can, it has some inherent error and might not identify that it is full. This illustrates a <strong>sensor error</strong>.<strong> </strong>Both of those examples produce a partially observable system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AT8009R4qne1tIbY.jpg" /><figcaption>AlphaBet <a href="https://x.company/projects/everyday-robots/">EveryDay robot</a>, staring (with uncertainty) at trash cans. Image from <a href="https://x.company/projects/everyday-robots/">EveryDay</a>.</figcaption></figure><p>To represent this added uncertainty, the Partial Observability MDP (POMDP) has been suggested to extend the MDP by incorporating <strong>observations </strong>and their<strong> probability of occurrence </strong>conditional on the state of the environment. Remember that we defined MDP by <strong>actions,</strong> <strong>states</strong>, <strong>transition </strong>function, and <strong>reward </strong>function. Now we add a set of <strong>observations</strong> and a corresponding <strong>observation</strong> function that assigns a probability for each triplet of (s,a,o). It defines the probability of observing<strong> o </strong>after applying action <strong>a </strong>at state <strong>s</strong>. Formally, the observation function is defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/218/1*taKLTE-xSGaB3g5u0NFXBQ.png" /><figcaption>The observation function. It models the probability of observing o when action a is applied in state s’.</figcaption></figure><p>A critical assumption we made when introducing MDPs was assuming the <a href="https://en.wikipedia.org/wiki/Markov_property"><strong>Markov property</strong></a><strong> </strong>holds.<strong> </strong>Remember it simply means that we assume that <strong>the future is independent of the past given the present</strong>. Does this property hold for POMDP? Unfortunately, no.</p><p>Returning to our recycling robot, we use it to illustrate the violation of the Markov property. Assume the robot already threw several items into some trash can and observed it to be full (with some probability). Now he is picking an item that needs to be thrown into that trash can also. It clearly can not deduce from his current observation (i.e., where the item it aims to recycle is) if the trash can is full. It does know that the trash can is full from its history of actions and observations. However, since the future is now dependent on the past, the Markov property is violated.</p><p>A naive solution is extending the definition of current observation to include all actions and observation history. In this case, the Markov property holds, yet we need a policy that maps each possible history to an action, which is highly ineffective. A better solution maintains only the <strong>sufficient information</strong> it needs to satisfy the Markov property. Going back to our recycling robot, we can intuitively see how ineffective would be to store all information. Let say we threw 100 items into the green trash can and observed it to be full (with some probability). We now observe another item that should be thrown into the green trash can. Instead of remembering all 100 observations we made, we could maintain information that indicates if the trash can is full. However, how do we decide if the trash can is full or not? Since we only have observations (and not a certain state), we assign a <strong>probability</strong> to it being full. Each time we observe the trash can, we update that probability accordingly. This probability is sometimes called a <strong>sufficient statistic. </strong>It basically says that maintaining this probability is equivalent to storing the whole history. Therefore, we say that the <strong>Markov property holds </strong>if the state consists of this maintained probability. We call this state a <strong>belief state. </strong>The resulting MDP framework that encompasses the partial observability through belief states is called a <strong>belief state MDP. </strong>Next, we will see how to maintain and update those belief states according to observations, and how to derive a reward for each belief state from the regular reward that is defined on states.</p><p>So, how do we actually maintain the belief state? Specifically, given a currently assigned probability to each state, an action we perform, and an observation we observe, how do we update those probabilities? Formally, we ask how to compute:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/323/1*MdfYFc8T9BsZOT9wTwPXDA.png" /><figcaption>Updating the belief state <strong>b’ </strong>probability of state <strong>s`</strong> after being in belief state <strong>b</strong>, applying action<strong> a,</strong> and observing <strong>o.</strong></figcaption></figure><p>Using basic probability theory (Bayes’ rule and marginalization), as described <a href="https://people.csail.mit.edu/lpk/papers/aij98-pomdp.pdf">in section 3.3 of this paper</a>, we find that this probability is being updated according to the <strong>transition</strong> function, <strong>observation</strong> function, and current <strong>belief state</strong>. Formally, the formula to update the probability of state <strong>s’</strong> is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*zekybPYKFMxRwl7hZzO5-Q.png" /><figcaption>The updated probability of state <strong>s’</strong>, after applying action <strong>a </strong>and observing <strong>o </strong>at belief state <strong>b(s)</strong>. T and O are transition and observation functions.</figcaption></figure><p>Given this definition of belief state and the method of updating the belief state according to observations, we change the definition of the <strong>transition function accordingly.</strong> Remember that it assigns a probability of arriving state <strong>s’</strong> after applying action <strong>a</strong> at state <strong>s</strong>. We simply replace the regular (certain) state with the new belief state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/383/1*JHI4gJTYQnB3u4YGV17iVg.png" /><figcaption>The belief state MDP transition function. It assigns a probability of arriving belief state <strong>b’</strong> after applying action <strong>a</strong> at belief state <strong>b</strong>.</figcaption></figure><p>Finally, we define the reward function as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*va7pdkMwGxA-Gl2RB2e6vg.png" /><figcaption>The belief state MDP reward function. It computes a weighted average of the original reward by multiplying it by the probability of each state.</figcaption></figure><p>Given this definition of a <strong>belief state MDP</strong>, which is a representation of the POMDP problem that satisfies the Markov property more efficiently, we now seek algorithms that find the optimal policy for it.</p><p><strong>Finding the Optimal Policy</strong></p><p>Extending the <strong>policy</strong> definition from MDP is trivial. For MDP, we search for a policy that maps states to actions. For POMDP (represented as belief state MDP), we search for a policy that maps from<strong> beliefs</strong> to actions. The <strong>optimal policy </strong>remains the policy that maximizes the <strong>expected </strong>rewards.</p><p>The main algorithms we looked at previously for finding an optimal policy were Value Iteration and Policy Iteration. Intuitively, those algorithms aim to <strong>iteratively improve the policy</strong> by comparing its selected actions with a greedy better action. Specifically, we formalized this problem as finding a policy that optimizes the <strong>value function. </strong>We defined how to evaluate the value function for a given policy at a given state and we defined a method to check if a given policy is optimal. In case of finding a choice of action that improves the value function, we update the policy accordingly and continue until convergence.</p><p>However, applying those algorithms to the belief state MDP is not trivial, as they assume a<strong> discrete </strong>state space, while the belief state is <strong>continuous</strong>. We need to define an optimization problem that tackles this continuous state. Intuitively, we want to exploit the fact that (generally) the actions chosen by a given policy do not change with “slight changes” to the belief state. Returning to our recycling robot, assume that the optimal policy is to throw an item into the corresponding trash can if the trash can is empty with 90% confidence. Evaluating the value function of this policy naively would require evaluating it over every possible belief state (which is infinitely many times). However, observe that the choice of the action only changes at the tipping point of “90% estimation that the trash can is empty”. Essentially, we look for algorithms that exploit this observation and do not need to evaluate the value function for all belief states. Next, we will define the value function for a belief-state MDP and the basic idea behind those algorithms.</p><p>Recall the definition of the value function for MDP as a weighted average of the values of possible next states, weighted by their probability of occurring:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*YI53XWDSp_GL_lRHyOYc5w.png" /><figcaption>The value function (for MDP) of policy <strong><em>π</em></strong>, evaluated at state <strong>s</strong>.</figcaption></figure><p>Generalizing that value function to include partial observability is done by computing the expected value of the next state. This is the weighted average of the value of the next state weighted by the probability of observing each possible observation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*mU22iW2MaKgvOimny7F4Sg.png" /><figcaption>The POMDP value function of policy <strong><em>π</em></strong>, evaluated at state <strong>s. </strong>Note that the difference is that we take a weighted average of all possible observations.</figcaption></figure><p>However, we already know that the agent will never know the exact state of the world, so we need to define the <strong>value function for a belief state.</strong> We get this by (once again) computing a weighted average of every possible state weighted by its probability of occurring (i.e., the belief state).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/261/1*djn2aouLD5p61EAdubZ48w.png" /><figcaption>The belief-state MDP value function of policy <strong><em>π</em>,</strong> evaluated at <strong>belief state b</strong>.</figcaption></figure><p>Note that we can represent this value function in vector notation as the dot product of two vectors:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*lP5ATbQ7uTdEvgxOf1upnw.png" /><figcaption>The belief-state MDP value function is represented in vector notation.</figcaption></figure><p>Now, we can define the problem of finding the optimal policy for a belief-state MDP as the following optimization problem:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/1*S4bLN56mnbpwjKzpkB7btQ.png" /><figcaption>The optimal policy is the policy that maximizes the value function of the belief state MDP.</figcaption></figure><p>Observe that this function is <strong>piece-wise linear </strong>(in b) <strong>and convex. </strong>If you wonder why this is the case, let look at the following value function for a belief state of a system with 2 possible states. Since it has 2 possible states, the belief state can be represented as one number (as those probabilities sum to 1). Therefore, in the figure below, the x-axis represents the probability we assign for the system to be in state <strong>s1 </strong>and the y-axis is the value function. Each one of the lines represents a different policy (P1, P2, and P3 accordingly), and it is clear that those policies are linear with respect to the belief state. Furthermore, the bold line, which describes the optimal policy for <strong>each belief state, selects the action suggested by the policy that gives the highest value function</strong>.<strong> </strong>This optimal policy is piece-wise linear and convex.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*OnNNpTKKf9TN1aSi5y5GXg.png" /><figcaption>The value function of several policies is evaluated for the belief state of a system with one state only. Image <a href="https://people.csail.mit.edu/lpk/papers/aij98-pomdp.pdf">source</a>.</figcaption></figure><p>Therefore, the problem of finding the optimal policy reduces to finding those bold lines induced by the policies with the highest value for each belief state. This is the basic idea underlying algorithms that find the optimal policy for POMDPs. I will not dive further into how those algorithms actually do it, but I encourage you to read this <a href="https://people.csail.mit.edu/lpk/papers/aij98-pomdp.pdf">great paper</a> about POMDPs optimal algorithms.</p><p><strong>Quick Recap</strong></p><p>The last part was pretty heavy, so let do a quick recap before generalizing to multi-agent POMDPs. We were looking for algorithms that find the optimal policy of the POMDP. However, simply using the previously introduced algorithms is not a great idea, as they assume discrete state space. Yet, we observed (intuitively) that the selected action changes in only several points for a given policy. Therefore, we looked to exploit this observation and search for those points where the optimal policy needs to change its action selection policy. Specifically, we found that the optimal policy value function is piece-wise linear and the problem reduced to finding the set of policies (which were lines in our simple example) that we need to “piece together” to build the optimal policy.</p><p>Note that the set of points that the optimal policy need to change its action might be very large (or even continuous) in extreme cases, but we ignore it for simplicity.</p><p><strong>Generalizing to Multi-Agent POMDP</strong></p><p>Same as we saw with MDPs when generalizing to a multi-agent system it is critical to distinguish between centralized and decentralized systems. If the system is truly centralized at execution, we have a central entity that derives an optimal joint plan. It simply observes all observations and derives the joint action at each joint belief state for all agents. While this centralized system is, in general, simpler to solve, the centralized execution assumption is hard to make. Moreover, this centralized system is essentially a POMDP, so we move on to systems where the execution is decentralized.</p><p>Analogous to what we saw previously when generalizing MDP to decentralized multi-agent systems, we first consider the <strong>Multi-agent POMDP </strong>(MPOMDP) framework. Basically, it is the generalization of MMDP to a system with partial observability. At MPOMDP, each agent has access to the <strong>joint POMDP</strong> problem and it solves it optimally. Then, at execution, we need to solve the <strong>coordination problem</strong>. Remember that the coordination problem arises when there is more than one optimal policy for some agents, and they need to coordinate which policy they chose to act optimally together at execution. We noted several approaches to address this coordination problem. One common for MPOMDPs is by adding each agent the ability to communicate (modeled by an action) its observations to all other agents instantaneously and without a cost. That way, the MPOMDP problem is reduced to simply solve a big POMDP problem. However we choose to solve the coordination problem, the MPOMDP model still makes non-trivial assumptions. First, in most cases, the agents simply can not observe all observations made by all agents. Second, even if they do observe all observations, as we saw in MMDP, solving the full POMDP problem by each agent is intractable for systems with more than a few agents.</p><p>Therefore, the <strong>Decentralized POMDP</strong> (DEC-POMDP) framework is suggested. It assumes that individual agents only know about their observations and actions. The first difficulty at this framework concerns the definition of the belief state. For POMDP, we summarized the history in terms of a belief state. It was a crucial step toward utilizing dynamic programming methods, as the belief state satisfies the Markov property without maintaining a full history of actions and observations. In essence, given the belief state, we could optimally plan for the future. However, at DEC-POMDPs, summarizing the individual agent’s observations<strong> does not provide sufficient information</strong> to optimally plan for the future. Each agent needs to somehow model his estimation of the policies of all other agents, based on the information he observed from the past. This belief state over future states and other agents&#39; policies is called a <strong>multi-agent belief state</strong>. Maintaining it is possible since we assume that the agents know the joint policy and therefore they can maintain a probability about the policies of other agents. <a href="https://www.aaai.org/Papers/AAAI/2006/AAAI06-193.pdf">Look here </a>for more details on how to do it.</p><p>However, much the same as with DEC-MDPs, the computational complexity of DEC-POMDPs is notorious. Therefore, solutions to specific cases of DEC-POMDPs are suggested, analogous to TI-MDPs. In practice, however, one would probably need to use approximate solutions for even small DEC-POMDP problems.</p><p><strong>Approximate Solutions for DEC-POMDP</strong></p><p>In order to solve large problems, we need to trade optimality in favor of better scalability. In general, there are two approaches for this tradeoff — by approximation or by heuristics. The first approach finds an approximate solution with a guarantee on the solution quality, while the second approach does not provide a guarantee but scales to larger problems.</p><p>Approximation algorithms for DEC-POMDP generally simplify the optimal algorithms. Instead of searching only for optimal (sometimes referred to as <em>dominating</em>) policies, one might consider policies that are suboptimal by some threshold. Intuitively, as we allow the algorithm a larger threshold, it is easier to find a policy, but it would be less optimal as the threshold grows. However, even finding an approximate solution is highly computationally complex.</p><p>For heuristic algorithms, I will highlight two interesting algorithms. The first algorithm, called <a href="https://www.researchgate.net/profile/Stacy-Marsella-2/publication/2570317_Taming_Decentralized_POMDPs_Towards_Efficient_Policy_Computation_for_Multiagent_Settings/links/573085d508aee022975c43b3/Taming-Decentralized-POMDPs-Towards-Efficient-Policy-Computation-for-Multiagent-Settings.pdf"><strong>JESP</strong></a><strong>,</strong> relies on a process called <strong>alternating maximization, </strong>which results in a Nash equilibrium. Nesh equilibrium means that the policy assigned for each agent is the best response strategy for the policies of all other agents. It is also termed a <strong>locally optimal solution. </strong>The idea behind JESP is simple —pick one agent and find his optimal policy when considering all other agents’ policies fixed. This step is actually solving a POMDP. Repeat this step iteratively for all agents until their policies converge. The second algorithm, called <a href="https://www.aaai.org/Papers/IJCAI/2007/IJCAI07-324.pdf"><strong>MBDP</strong></a>, combines two different approaches for planning algorithms — forward heuristic search and backward search (which I assume you remember from Part 2). It tries to mitigate the drawbacks of those two approaches. First, the forward heuristic search does not scale to problems with a large horizon (large number of actions to take), as its search-space is exponential with respect to it. Second, at backward search, it is not trivial how to prune joint policies, and therefore its search-space comes exponential with respect to the number of possible joint policies. <strong>MBDP</strong> combines those results by using heuristic search to identify relevant belief-states from whom the backward search would select the best one.</p><p><strong>Conclusion</strong></p><p>We dropped another major assumption towards MARL, by acknowledging our imperfect sensors through which we observe the world in which we operate. We formalized it using the Partially Observable MDP (POMDP) framework., and observed that a naive extension of MDP to the POMDP framework does not satisfy the Markov assumption. Therefore, we introduced the <strong>belief state MDP</strong>. Then, we defined an optimal policy under this framework and learned how to adapt the Value Iteration algorithm to continuous state-space MDPs. Them, as we did previously with MDPs, we generalized the POMDP into multi-agent settings and specifically focused on the decentralized execution variant. We observed that solving DEC-POMDPs optimally is an extremely hard task and looked for approximate solutions.</p><p><a href="https://omrikaduri.github.io/2021/08/07/Part-5-MARL.html">Next</a>, we will ask ourselves how can we drop one crucial assumption we made along with the last 4 chapters — how can we plan in a world in which his model is not known to us? Then, we will conclude our journey at Multi-Agent Reinforcement Learning.</p><p><strong>Acknowledgment</strong></p><p>I want to thank <a href="https://ronistern.wixsite.com/home">Roni Stern</a>, my MSc thesis supervisor. My interest in this area and large parts of this blog series stems from the wonderful course he teaches on multi-agent systems at Ben-Gurion University, which I had the privilege to take.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e18d3843277" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From A* to MARL (Part 3 — Planning Under Uncertainty)]]></title>
            <link>https://medium.com/data-science/from-a-to-marl-part-3-planning-under-uncertainty-ae2e2578591d?source=rss-bdd98c8f5e5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae2e2578591d</guid>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[multi-agent-systems]]></category>
            <category><![CDATA[editors-pick]]></category>
            <category><![CDATA[markov-decision-process]]></category>
            <dc:creator><![CDATA[Omri Kaduri]]></dc:creator>
            <pubDate>Fri, 20 Aug 2021 13:35:22 GMT</pubDate>
            <atom:updated>2021-08-23T16:14:07.667Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GFjGbaYgVD7KOn73AWCI4g.jpeg" /><figcaption>While planning, we should not rely only on good luck. How can we plan for the uncertain? Image from <a href="https://pixabay.com/photos/dice-dice-cup-happiness-gambling-5214804/">Pixabay</a>.</figcaption></figure><h3>From A* to MARL (Part 3 — Planning Under Uncertainty)</h3><h4>An intuitive high-level overview of the connection between AI planning theory to current Reinforcement Learning research for multi-agent systems</h4><p>Research of Reinforcement Learning (RL) and Multi-Agent RL (MARL) algorithms has advanced rapidly during the last decade. One might suggest it is due to the rise of deep learning and the use of its architectures for RL tasks. While it is true at some level, the foundations of RL, which can be thought of as a <strong>planning problem formulated as a learning system</strong>, lie in AI planning theory (which has been in development for over 50 years). However, the connection between RL and planning theory might seem vague, as the former is mostly related to deep learning for most practitioners nowadays.</p><p>This blog series aims to start from the classical path-finding problem, with strict <strong>assumptions </strong>about the world we are tackling (deterministic, centralized, single-agent, etc.) and <strong>gradually drop </strong>assumptions until we end up with the MARL problem. In the process, we will see several algorithms suited for different assumptions. Yet, an assumption we will always make is that the <strong>agents are cooperative</strong>. In other words, they act together to achieve a common goal.</p><p>It is important to note that this series will focus on the “multi-agent systems path” from A* to MARL. This will be done by formulating the problems we want to solve and the assumptions we make about the world we operate in. It certainly won’t be an in-depth review of all algorithms and their improvement on each topic.</p><p>Specifically, I will review optimal multi-agent pathfinding (<a href="https://omrikaduri.github.io/2021/08/07/Part-1-MAPF.html">Part 1</a>), classical planning (<a href="https://omrikaduri.github.io/2021/08/07/Part-2-AI-Planning.html">Part 2</a>), planning under uncertainty (Part 3), and planning with partial observability (<a href="https://omrikaduri.github.io/2021/08/07/Part-4-Planning-Under-Uncertatinty-and-Partial-Observability.html">Part 4</a>). Then, I will conclude our journey at RL and its generalization to multi-agent systems (<a href="https://omrikaduri.github.io/2021/08/07/Part-5-MARL.html">Part 5</a>). I will pick representative algorithms and ideas and will refer the reader to an in-depth review when needed.</p><p><strong>Part 3 — Planning Under Uncertainty</strong></p><p>The previous chapter dealt with planning in a deterministic world, where a planner can generate a <strong>sequence of actions</strong>, knowing that if they are executed in the proper order, the goal will <strong>necessarily </strong>result. Now, we turn to the case of <strong>nondeterministic </strong>worlds, where we must address the question of what to do when things do not go as expected.</p><p>One might suggest naive solutions to that problem. For example, we can monitor (by some sensor) for “failures” and initiate replanning in that case. Yet, replanning at each failure would be undesirable for many real-world applications, as it would be too slow. On the other hand, we can plan a reaction for every possible situation that might occur during plan execution. It would generate a fast and robust plan, yet would be highly expensive to find that plan for non-trivial domains with many states. Therefore, we seek algorithms that deal with the <strong>uncertainty </strong>at planning and yield robust plans.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*hCfx4oGgatzWqMmE.jpg" /><figcaption>Some level of uncertainty exists in almost anything. How can we take it into account when planning? Image from <a href="https://makeameme.org/meme/uncertainty-uncertainty-everywhere-631709047c">makeameme</a>.</figcaption></figure><p>In the previous post, we learned how to represent a planning problem with STRIPS/PDDL. We defined the domain with a set of actions and conditions. The specific problem is defined with an initial state and a goal state. Yet, it is not trivial how to extend this language to entail uncertainty.</p><p>The planning community adopted the <strong>Markov Decision Process (MDP)</strong> to model the problem. An MDP is defined by the following: <strong>state</strong>, <strong>actions, transition function,</strong> and <strong>reward function</strong>. The state and actions are straightforward and are essentially the same as in the classical planning problem. The <strong>transition function </strong>assigns a probability for each triplet of (s1,a,s2). It defines the probability for ending in state <strong>s2</strong>, after applying action <strong>a </strong>at state <strong>s1</strong>.<strong> </strong>The <strong>reward function </strong>simply assigns a reward with being in a state and performing an action.</p><p>A crucial assumption underlying the modeling of a planning problem as an MDP is the <a href="https://en.wikipedia.org/wiki/Markov_property"><strong>Markov property</strong></a><strong>.</strong> Basically, it says that <strong>the future is independent of the past given the present</strong>. That is the reason we could define it only by the triple of (s1,a,s2), considering (s1,a) as the present, and s2 as a possible future. If we were not making this assumption, we would be in trouble trying to define the transition function, as we would need to associate each possible path with a probability. However, it is not trivial to determine if the Markov property indeed holds for a given problem. A toy example would from this <a href="https://math.stackexchange.com/a/89414">MSE answer</a> considers an urn with two red balls and one green ball. Two draws are made from the urn, without replacement. Knowing only the last drawn ball’s color does not contain the same information as knowing both draws. However, in this post, we will assume that the Markov property holds. I refer the curious reader to read <a href="https://www.files.ethz.ch/isn/124233/kap1086.pdf">Markov or Not Markov</a>.</p><p>Formally, according to the Markov property, the<strong> transition function</strong> is defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/305/1*OdQlhu8Tmj4HsEusE9VCsg.png" /><figcaption>The transition function. It models the probability of reaching state Sj when action Ak is applied in state Si.</figcaption></figure><p>Given the problem formulation as MDP by the state, actions, reward function, and a transition function, we need to define what is the <strong>optimal solution</strong> to that MDP? The classical planning problem was a sequence of actions from the initial state to the goal state. However, a single sequence of actions is not suitable for indeterministic problems. Therefore, we seek a <strong>policy </strong>that maps from states to actions. The <strong>optimal policy </strong>is the policy that maximizes the <strong>expected </strong>rewards. In other words, following the optimal policy from every state would yield,<strong> on average</strong>, the highest reward among all possible policies. Do you see the implicit assumption we are making when defining the optimal policy that way? In a way, we assumed a <strong>rational </strong>agent.</p><p>Some of you might wonder how an MDP is a generalization of the planning problem? Well, typical classical planning problems can be viewed as MDPs in which the world is deterministic and there is only a single goal (e.g., the reward is 0 for all states except the goal state which is 1).</p><p>Before proceeding to the algorithms that aim to find an optimal policy for the MDP, note that the uncertainty we deal with right now stems only from <strong>control errors </strong>and not from <strong>sensor errors</strong>. We assume that we <strong>fully observe the state</strong> and have certainty in that observation.</p><p><strong>Finding the Optimal Policy</strong></p><p>Algorithms that solve an MDP aim to find the optimal policy. We defined it as the policy that yields, on average, the highest reward from every state. Mathematically, we wish to find the policy that maximizes a <strong>value function</strong> overall states. The value function at state s for a policy (denoted by <em>π</em>) is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*ywj43370BK7Nq8L6WD6dNQ.png" /><figcaption>The value function of policy <strong><em>π</em></strong>, evaluated at state s.</figcaption></figure><p>Finding the optimal policy boils down to solving the following optimization problem:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*tFWXSAkK4L568QCC2MKdcQ.png" /><figcaption>The optimal policy is the policy that chooses the action that maximizes the value function for every state.</figcaption></figure><p>If reading those formulas feels intimidating or unintuitive, just think a moment about what they basically mean. They suggest that to figure out what action to take in each state to achieve the optimal policy, we just need to average over all possible states, follow the policy from that state, collect the rewards, and weigh each of them by its probability of occurring. Run it over your head, and it will suddenly seem like a pretty naive brute-force solution.</p><p><strong>Important notes—</strong></p><ol><li>Usually, a variant of this formula that extends it to consider <strong>discounted rewards</strong> is being used. Discounted rewards basically mean that a reward earned sooner is worth more than one earned later, which is the case at many real-world problems.</li><li>MDPs can be split into two families — finite and infinite horizon MDPs. Put simply, finite-horizon MDPs deal with problems with finite execution time span, where infinite horizon MDPs deal with problems that “run forever”. I focus on finite MDPs in this post.</li></ol><p>The most commonly-known algorithms for this optimization problem, named value iteration and policy iteration, use <a href="https://en.wikipedia.org/wiki/Dynamic_programming">Dynamic Programming</a>. The main idea is to solve the problem by breaking it down into simpler sub-problems recursively.</p><p><strong>Value Iteration &amp; Policy Iteration</strong></p><p>The <strong>policy iteration</strong> algorithm alternates between two stages — policy <strong>evaluation </strong>and policy <strong>improvement</strong>. At the evaluation stage, we treat the current policy as fixed and compute the value function for each state. At the improvement stage, we modify the policy to choose the best action for each state according to the value function we evaluated at the last stage. We perform a couple of evaluation and improvement steps <strong>until no change is made</strong> to the policy. In other words, the improvement step does not change the action to take in every state. The sequence of stages performed will be as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*O6Fnb4ZC747JmzeqGMH9lw.png" /><figcaption>A sequence of evaluation &amp; improvement stages performed by policy iteration algorithm.</figcaption></figure><p>The <strong>value iteration </strong>algorithm suggests combining those two stages into one stage. Starting with an initial value function set to zero (i.e., all states have the value 0), it updates the value function by iterating over all possible actions for each state and choosing the action that maximizes the current rewards plus the next-state value function. It does so until no change to the value function is made for all states. Then, using the optimal value function, it constructs the optimal policy by choosing the action that maximizes the value function for each state.</p><p>As both of those algorithms are widely known, I am not diving into the algorithm implementation details. I refer you to look at some nice and simple implementations of <a href="https://github.com/dennybritz/reinforcement-learning/blob/master/DP/Policy%20Iteration%20Solution.ipynb">policy iteration</a> and <a href="https://github.com/dennybritz/reinforcement-learning/blob/master/DP/Value%20Iteration%20Solution.ipynb">value iteration</a> algorithms. Moreover, despite these algorithms tend to converge in relatively few iterations, each iteration requires computation time at least<strong> linear in the size of the state space</strong>. This is generally impractical since <strong>state spaces grow exponentially </strong>with the number of problem features of interest. This problem is sometimes denoted as the “curse of dimensionality”.</p><p><strong>Generalizing to Multi-Agent MDPs</strong></p><p>Generalizing the MDP we described to the multi-agent case requires us to remember a crucial assumption we made along the way about the nature of the agents. We assumed that they are <strong>cooperative</strong> in the sense that they act together to achieve a common goal. The research about <strong>noncooperative </strong>agents is an exciting research area that lies in between game theory and AI. It focuses on the case where two (or more) agents with different interests, formalized through their reward function, co-exist in the same world and their actions can affect each other’s rewards. This is off-topic for now, but I hope to write about it another time.</p><p>Coming back to our multi-agent MDP (MMDP) with cooperative agents that operate to maximize a joint reward function, one might wonder why can’t we just model it as a “big MDP”, where the action space is the joint action space of all agents, and the state space is the joint state space of all agents. It is of course doable but makes a crucial assumption that is inappropriate for many multi-agent systems. It assumes the existence of a <strong>central entity</strong> that derives the plan for all agents and sends them their individual optimal policies. Therefore, researchers have focused on the <strong>decentralized</strong> case, where each agent should derive his own optimal policy. In this case, the main challenge is how to combine multiple individual optimal policies to an optimal joint policy.</p><p>Indeed, MMDP specifies a decentralized MDP for a multi-agent system, where each agent knows the <strong>complete problem MDP</strong> (All states, for all actions, and the corresponding transition function between states given actions for all agents). Therefore, each agent can find the optimal policy by solving the complete MDP on his own. From those optimal policies, one can compose the <strong>joint policy. </strong>The joint policy is a mapping between each state to every agents’ action. Yet, is building a joint policy from several optimal policies derived individually ensures optimality? Unfortunately, no. Since the optimal policy is not unique, how can we be sure that all agents follow the same optimal policy?<strong> </strong>A simple yet famous example that illustrates the need for coordination due to multiple optimal policies derived in a decentralized manner is shown below. Both agents (named A and B) solve the joint MDP. The reward is 1 when both agents move to the same location (G1 or G2) and 0 when they move to different locations. There are two optimal policies for that MDP, the first when both agents choose to go to G1 and the second when both choose to go to G2. Yet, what happens if agent A chooses the first optimal policy, and agent B chooses the second?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*Ab2BR9I9G1H7C8epBrhcVg.png" /><figcaption>A two-agent coordination problem. <a href="https://www.cs.toronto.edu/~cebly/Papers/tark96.pdf">Image source</a>.</figcaption></figure><p>This problem is generally referred to as the <strong>coordination problem. </strong>There are mainly three approaches to solve it. First, one may assume the agents’ ability to <a href="https://www.jair.org/index.php/jair/article/view/10304/24597"><strong>communicate</strong></a> (“Let’s turn left!”). Second, <a href="https://www.cs.toronto.edu/~cebly/Papers/tark96.pdf"><strong>shared conventions</strong></a> might be defined that would result in a consistent pick of an optimal policy for all agents (“Choose actions lexicographically. If both left and right are optional, choose left!”). Third, if not shared convention or communication is given, the agents can <a href="https://www.cs.toronto.edu/~cebly/Papers/tark96.pdf"><strong>learn to coordinate</strong></a> if several games can be played (“Ah-ah. I see you choose to go left in this situation. See you next time!”). We will not dive into the different algorithms that solve the coordination problem. I encourage you to follow the links above for further information.</p><p>However, even if we assume the coordination problem to be solved, letting every agent solve the complete MDP comes with a high computational cost. As we already saw in MAPF and multi-agent planning, a <strong>linear increase</strong> in the number of agents induces an<strong> exponential increase</strong> in the computational complexity, if the multi-agent problem is treated naively. In general, solving the complete MDP for each agent would be intractable for systems with more than a few agents. Moreover, the assumption that all agents know about all other agents, states, and actions does not hold in many real-world systems.</p><p>Therefore, the model of <a href="https://arxiv.org/pdf/1301.3836.pdf">DEC-MDP</a> (Decentralized MDP) is suggested. In contrast to MMDP, it does not assume that each agent knows the full MDP. It only assumes that the joint MDP state can be derived from the set of states of all agents. But how can we solve a DEC-MDP optimally? Unfortunately, it has been shown that <a href="https://arxiv.org/pdf/1301.3836.pdf">decentralized multi-agent MDPs are very hard to solve optimally</a> (NEXP-Complete). However, several attempts to model the decentralized MDP in a tractable way for <strong>specific cases</strong> have been suggested.</p><p>For example, <a href="https://www.jair.org/index.php/jair/article/view/10395/24898"><strong>Transition-Independent</strong> MDP</a> (TI-MDP) is a specific case of a DEC-MDP where the state transitions of an agent are <strong>independent</strong> of the states and actions of the other agents. In essence, it is the case when the actions taken by an agent do not affect other agents. Note that it does not mean that we can just decompose the n-agent DEC-MDP into n different MDPs. We could decompose it only if we further assume <strong>reward independence, </strong>which basically means that the reward function can be expressed as a sum of n-different reward functions, where each reward function knows only about a single agent&#39;s actions. A motivating example is a group of robots that scan a field together to find something. The reward for scanning a given piece of land is lower if another agent already scanned it before, therefore the reward is not independent. An optimal algorithm for TI-MDPs is detailed in <a href="https://www.jair.org/index.php/jair/article/view/10395/24898">their paper</a>.</p><p>While IT-MDP and other sub-classes of DEC-MDP yield optimal policies, this is not the case with the general DEC-MDP. Therefore, many research efforts focused on finding approximate solutions.</p><p><strong>Approximate Solutions for DEC-MDP</strong></p><p>Finding approximate solutions to DEC-MDP can be divided into two approaches. The first approach suggests algorithms with a guarantee on the solution quality, by measuring how worse their solution is from the optimal solution. One such algorithm that converges to an ε-optimal solution was suggested in 2005 by Bernstein in <a href="https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.77.9024&amp;rep=rep1&amp;type=pdf">his Ph.D. thesis</a>. The second approach suggests algorithms with no performance guarantee. We will see algorithms from this approach in our next chapter when we will go over algorithms for DEC-POMDPs.</p><p><strong>Conclusion</strong></p><p>An important milestone towards MARL is the notion of uncertainty which was introduced in this post. First, we defined how to reason about uncertainty for planning problems using MDP, and what is the notion of optimality under uncertainty. Then, we learned about algorithms that aim to find those optimal policies. Finally, we saw several frameworks that generalize the MDP into multi-agent settings. Those frameworks differ by several assumptions, such as the existence of a central authority and the interdependency between the agents. In general, an optimal solution to the decentralized multi-agent MDP is highly hard to find, and we briefly discussed approaches to finding approximate solutions.</p><p><a href="https://omrikaduri.github.io/2021/08/07/Part-4-Planning-Under-Uncertatinty-and-Partial-Observability.html">Next</a>, we will drop another crucial assumption about observability and introduce the framework of Partially Observable MDPs (POMDP). Similar to what we did in this chapter, we will see the generalization of this POMDP framework to the decentralized multi-agent case. Then, we will be ready to finish our journey at MARL.</p><p><strong>Acknowledgment</strong></p><p>I want to thank <a href="https://ronistern.wixsite.com/home">Roni Stern</a>, my MSc thesis supervisor. My interest in this area and large parts of this blog series stems from the wonderful course he teaches on multi-agent systems at Ben-Gurion University, which I had the privilege to take.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae2e2578591d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/from-a-to-marl-part-3-planning-under-uncertainty-ae2e2578591d">From A* to MARL (Part 3 — Planning Under Uncertainty)</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From A* to MARL (Part 2— AI Planning)]]></title>
            <link>https://medium.com/data-science/from-a-to-marl-part-2-ai-planning-8ae635a6491d?source=rss-bdd98c8f5e5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ae635a6491d</guid>
            <category><![CDATA[multi-agent-systems]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[ai-planning]]></category>
            <category><![CDATA[editors-pick]]></category>
            <dc:creator><![CDATA[Omri Kaduri]]></dc:creator>
            <pubDate>Fri, 20 Aug 2021 13:33:07 GMT</pubDate>
            <atom:updated>2021-08-23T16:14:39.237Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t3ORE1_WSCpd6IkS-LDfsA.jpeg" /><figcaption>A number of intelligent creatures plan together. How artificial ones can do that too? Image from <a href="https://unsplash.com/photos/wD1LRb9OeEo">Unsplash</a>.</figcaption></figure><h4>An intuitive high-level overview of the connection between AI planning theory to current Reinforcement Learning research for multi-agent systems</h4><p>Research of Reinforcement Learning (RL) and Multi-Agent RL (MARL) algorithms has advanced rapidly during the last decade. One might suggest it is due to the rise of deep learning and the use of its architectures for RL tasks. While it is true at some level, the foundations of RL, which can be thought of as a <strong>planning problem formulated as a learning system</strong>, lie in AI planning theory (which has been in development for over 50 years). However, the connection between RL and planning theory might seem vague, as the former is mostly related to deep learning for most practitioners nowadays.</p><p>This series of articles aims to start from the classical path-finding problem, with strict <strong>assumptions </strong>about the world we are tackling (deterministic, centralized, single-agent, etc.) and <strong>gradually drop </strong>assumptions until we end up with the MARL problem. In the process, we will see several algorithms suited for different assumptions. Yet, an assumption we will always make is that the <strong>agents are cooperative</strong>. In other words, they act together to achieve a common goal.</p><p>It is important to note that this series will focus on the “multi-agent systems path” from A* to MARL. This will be done by formulating the problems we want to solve and the assumptions we make about the world we operate in. It certainly won’t be an in-depth review of all algorithms and their improvement on each topic.</p><p>Specifically, I will review optimal multi-agent pathfinding (<a href="https://omrikaduri.github.io/2021/08/07/Part-1-MAPF.html">Part 1</a>), classical planning (Part 2), planning under uncertainty (<a href="https://omrikaduri.github.io/2021/08/07/Part-3-Planning-Under-Uncertainty.html">Part 3</a>), and planning with partial observability (<a href="https://omrikaduri.github.io/2021/08/07/Part-4-Planning-Under-Uncertatinty-and-Partial-Observability.html">Part 4</a>). Then, I will conclude our journey at RL and its generalization to multi-agent systems (<a href="https://omrikaduri.github.io/2021/08/07/Part-5-MARL.html">Part 5</a>). I will pick representative algorithms and ideas and will refer the reader to an in-depth review when needed.</p><p><strong>Part 2 —AI Planning</strong></p><p>In Part 1, we dealt with the pathfinding problem, where our goal was to find the shortest path from start to goal for a set of agents. In this article, we’ll discuss AI Planning, which can be thought of as a generalization of the MAPF problem. In general, planning is the task of finding a <strong>sequence of actions </strong>that will transform the <strong>start state </strong>into the <strong>goal state</strong>. We will start with the single-agent planning problem, and generalize to multi-agent, analogous to our path from the previous post.</p><p><strong>Brief History of AI Planning</strong></p><p>From its early days, the holy grail of AI planning was creating a domain-independent problem solver. This domain-independent problem solver would hopefully be able to tackle all kinds of planning problems, ranging from playing games to making cookies. In 1959, the <a href="http://bitsavers.informatik.uni-stuttgart.de/pdf/rand/ipl/P-1584_Report_On_A_General_Problem-Solving_Program_Feb59.pdf">GPS paper</a> introduced a general problem solver which could solve problems expressed by a <a href="https://en.wikipedia.org/wiki/Well-formed_formula">well-formed formula</a>. It was designed for <a href="https://en.wikipedia.org/wiki/Automated_theorem_proving">theorem proving</a>. Yet, for several reasons, it was not well-suited for planning problems. For example, it was not intuitive how to express concurrent events, and preferences for generated plans.</p><p>This work motivated researchers from Stanford Research Institute, who have worked on <a href="https://en.wikipedia.org/wiki/Shakey_the_robot">Shakey the robot</a>, to develop a well-formed language and domain-independent planning algorithm that is suited to planning, called <a href="https://en.wikipedia.org/wiki/Stanford_Research_Institute_Problem_Solver">STRIPS</a>. Several other languages and planners were suggested over the years. The development of several different languages, with different expressive power, made the comparison between the planners a difficult task. An attempt to standardize AI planning was done in 1998, called <a href="https://en.wikipedia.org/wiki/Planning_Domain_Definition_Language">PDDL</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ENLepJTeRCKIcIm_.jpg" /><figcaption><a href="https://en.wikipedia.org/wiki/Shakey_the_robot">Shakey the robot</a>, a high-impact research project from the 60s. Oh, and why “Shakey”, you ask? Well, “<a href="https://www.computerhistory.org/revolution/artificial-intelligence-robotics/13/289">it shakes like hell and moves around</a>”. Image from <a href="https://en.wikipedia.org/wiki/Shakey_the_robot#/media/File:SRI_Shakey_with_callouts.jpg">Wikipedia</a>.</figcaption></figure><p><strong>Classic AI Planning Assumptions</strong></p><p>In the classic planning problem, we deal with <strong>deterministic environments that can be fully observed. </strong>For now, we also assume that there is only one agent.</p><p><strong>Planning Domain Definition Language (PDDL)</strong></p><p>PDDL is a language we use to define the initial state, goal state, and actions our agent can perform. In essence, a PDDL problem is defined by <strong>conditions, actions, initial state, and goal state. </strong>A set of conditions describes a state, and actions defined by the <strong>effects</strong> they cause and <strong>preconditions</strong> under which they are applicable.</p><p>A famous planning example is the <a href="https://www.researchgate.net/publication/326779615_The_air_cargo_load_planning_problem_-_a_consolidated_problem_definition_and_literature_review_on_related_problems">air cargo load problem</a>. We will focus on a simple problem, with 2 cities (TLV and NYC), two airplanes (called P1, P2), and two different cargo (C1, C2) we want to transfer between the cities. At our initial state, we have C1 and P1 at TLV and C2 and P2 at NYC. Our goal is to have C1 at NYC and C2 at TLV. Let’s write it in PDDL.</p><pre>Init(At(C1, TLV) ∧ At(C2, NYC) ∧ At(P1, TLV) ∧ At(P2, NYC))</pre><pre>Goal(At(C1, JFK) ∧ At(C2, SFO))</pre><p>Now it&#39;s time to define the actions. Basically, we want our airplanes to be able to load cargo, fly between cities and then unload the cargo. Pretty straightforward. It can be defined as simply as:</p><pre>action(LOAD(cargo,plane,city),<br>    precondition: At(cargo,city) ∧ At(plane,city)<br>    effect: ¬At(cargo,city) ∧ In(cargo,plane))</pre><pre>action(FLY(plane,from,to),<br>    precondition: At(plane,from)<br>    effect: ¬At(plane,from) ∧ At(plane,to))</pre><p>Note that, even though it may be unintuitive, once an airplane loaded cargo, the cargo is no longer defined to be at the city, as defined by the effect of the “LOAD” action. Also, you probably noticed that the “UNLOAD” action is missing. Can you come up with it yourself?</p><p><strong>Important note — </strong>To fully define the problem in PDDL, we need to properly define some other things which I intentionally skipped. For example, we need to define the types we are using (Cargo, Airplane, etc.). You will encounter that in real PDDL problem definitions, yet I believe it is not required for understanding the essence of formulating a classic AI problem. If you are interested in the full definition, I <a href="http://stripsfiddle.herokuapp.com/?d=AXTAHgFSKyQ4xK5Xw&amp;p=AwHemmuFeYFqaFaYF&amp;a=BFS">wrote it on STRIPS-fiddle</a>. You can solve it and find the 6-steps solution!</p><p><strong>AI Planning Algorithms</strong></p><p>Now that we know how to <strong>define </strong>our planning problem, it is time to learn how to <strong>solve </strong>it. The naive approach for solving the planning problem would be to first apply all applicable actions to the initial state to create a set of successor states. Then, we would continue to apply all applicable actions to these successors until we reach a goal state. However, since the number of applicable actions might be quite large, this naive approach is impractical. Does it remind you of uninformed graph search algorithms, such as BFS/DFS? Yep, that’s exactly that. So one might ask to follow an A* informed approach and use a heuristic. Indeed, from classical pathfinding, we know that adding a good admissible heuristic is essential for effectively solving large state-space problems. Also, we remember that for A* to <strong>ensure optimality, the heuristic must be </strong><a href="https://en.wikipedia.org/wiki/Admissible_heuristic#:~:text=In%20computer%20science%2C%20specifically%20in,current%20point%20in%20the%20path."><strong>admissible </strong></a>(i.e., never over-estimate the cost of reaching the goal).</p><p><strong>Heuristics for Domain-Independent Planners</strong></p><p>Yet, a problem arises. How can we come up with a heuristic, which should encode problem-specific knowledge, in a problem-independent way? We need a method that automatically generates an admissible heuristic function from a STRIPS problem definition. A simple approach would be to relax our planning problem P into a simpler problem P`, compute the optimal cost for P`, and use it as a heuristic. A possible relaxation of P is removing all actions “negative effects” (i.e., all effects that make a condition false). For example, in P`, even after loading cargo to an airplane, it stays in the airport. Although this method would indeed produce an admissible heuristic, computing it might still be NP-Hard, which misses the goal of the heuristic, which is to inform the search <strong>efficiently </strong>towards the goal.</p><p>In 1998, the <a href="https://bonetblai.github.io/reports/aips98-competition.pdf">HSP algorithm</a> proposed a method to approximate the heuristic. Essentially, it proposes to <strong>decouple </strong>the goal conditions and compute the number of actions from a given state to satisfy each condition separately. Then, the heuristic value would be the sum of all actions to achieve all conditions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*iASjkyUYlG7xDVkpzQKyXg.png" /><figcaption>Value of heuristic in the state s is the sum of actions to achieve each condition, p, of the goal G.</figcaption></figure><p>To compute the number of actions to satisfy each condition, we iteratively updating the following function until no changes is observed in its values:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*kA4qqDI8MooY0BzhLCSk1Q.png" /><figcaption>The number of actions to achieve a condition, p, is updated iteratively until the function does not change.</figcaption></figure><p>At each iteration, we apply all actions whose corresponding preconditions hold in the current state (s).</p><p>Assuming that the goal conditions are independent and solving the relaxed P` problem result gives us an informative heuristic, which as shown in various AI planning competitions, is useful to solve large problems. Yet, those assumptions come with a price. This heuristic is not admissible, since independent goal conditions might contain redundant actions.</p><p>However, we can create a less informative but admissible heuristic if we choose to swap the number of solved problems for optimality. We can take a variation of the heuristic above, which is called “max-heuristic”. Basically, instead of summing over all independent goal conditions, we take the condition with the highest number of actions to satisfy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*diW-GlRLeRRsCANViZAuyw.png" /><figcaption>An admissible heuristic is given by counting the largest number of actions to achieve one of the independent conditions of the goal.</figcaption></figure><p><strong>Go Backwards!</strong></p><p>Whether we are using the admissible or inadmissible heuristic, we still need to compute it for every state to use it in a heuristic search algorithm, such as A*. Computing this heuristic for every state <strong>consumes ~80% of the search time</strong>. A simple yet effective solution is to <strong>reverse the search direction</strong>. Searching backward, from goal state to start state, is called <strong>regression search</strong>.</p><p>Intuitively, the regression approach is the process of: “I want to eat, so I need to cook dinner, so I need to have food, so I need to buy food, so I need to go to the store“. At each step, it chooses an action that might help satisfy one of the goal conditions.</p><p>The crucial point of using the regression approach is that the initial state does not change during the search, therefore we can utilize the already computed heuristic, and perform the search more efficiently. There are subtle points I am skipping regarding the implementation of using the regression approach with HSP (denoted as HSP-r). More details can be found in the <a href="https://bonetblai.github.io/reports/ecp99-hspr.pdf">HSP-r paper</a>.</p><p><strong>Beyond Search Algorithms</strong></p><p>As we previously learned, in the case of MAPF problems, algorithms developed for one problem might be useful to solve another problem. It is also true in AI Planning, where a powerful planner is given by converting the planning problem to a <a href="https://en.wikipedia.org/wiki/Boolean_satisfiability_problem">Boolean satisfiability problem</a> (SAT). One such planner is called <a href="https://www.cs.rochester.edu/u/kautz/satplan/">SatPlan</a>.</p><p><strong>Quick Recap</strong></p><p>Before continuing to multi-agent systems, let’s do a quick recap. We saw a language to represent planning problems and their corresponding domain, called STRIPS or PDDL. Then, we saw several approaches to construct a domain-independent solver for those planning problems. Some of them were naive uninformed search algorithms, and others are a bit more complicated. Of course, it is only a fraction of the algorithms that exist that tries to solve AI planning problems. Check out this <a href="http://aima.cs.berkeley.edu/newchap11.pdf">chapter on AI Planning</a> for more details.</p><p><strong>Generalizing to Multi-Agent Planning (MAP)</strong></p><p>At our logistics toy example, there were 2 airplanes. We can easily imagine real-world logistics problems with hundreds of airplanes or more. As we previously learned in the context of MAPF, a naive generalization to multi-agent systems results in an <strong>exponentially harder</strong> problem relative to the number of agents. It is much the same with MAP. Therefore, We need to find an efficient way to exploit a common fact for real-life multi-agent systems — the different agents might be <strong>loosely coupled</strong>. This recurring theme of decoupling planning problems to sub-problems and merge their solutions is a fundamental idea that is at the heart of most multi-agent systems. Indeed, we have seen it at MAPF and we will see it in the next post about MMDP as well.</p><p>Furthermore, real-life multi-agent planning might involve several different parties that collaborate to achieve a common goal, but desire to keep some information (i.e., actions and conditions) <strong>private</strong>. Consider a military covert mission where multiple robots coordinate behind enemy lines. We would not want each robot to contain the full information about all other robots (such as the number of robots, their location, equipment, etc.), since it might be compromised. We can also think of several enterprises that cooperate for a specific mission, and do not want to reveal private information.</p><p>Currently, as far as I know, in the multi-agent planning community, the work on privacy-preserving algorithms for multi-agent planning is an active research area. Although it is motivated by privacy-preserving, it is useful for distributed multi-agent planning, which provides efficient algorithms for loosely coupled multi-agent planning problems. It is an interesting line of work, but we will skip it and continue our path to MARL. I refer the curious reader to read about <a href="https://www.aaai.org/Papers/ICAPS/2008/ICAPS08-004.pdf">MA-STRIPS</a>, <a href="https://www.jair.org/index.php/jair/article/view/10909/26012">MAFS</a>, and <a href="https://www.ijcai.org/Proceedings/15/Papers/219.pdf">Secure-MAFS</a>.</p><p><strong>Conclusion</strong></p><p>We started from the definition of a domain-independent planning problem. After a quick historical overview and a STRIPS toy problem, we learned about the search-based algorithms, how heuristics can be automatically extracted from the planning problem, and the importance of the search direction. Then, we saw algorithms that are not search-based that solve the planning problem. We examined the case for the generalized MA-STRIPS problem and saw its applications to distributed planners and privacy-preserving conditions.</p><p><a href="https://omrikaduri.github.io/2021/08/07/Part-3-Planning-Under-Uncertainty.html">Next</a>, we will continue our path to MARL, as we will drop the assumption about the deterministic actions and full knowledge of the state. In particular, We will discuss the Markov Decision Process (MDP) and Partial-Observable MDP (POMDP), which as we will see later, are the foundations of model-based RL.</p><p><strong>Acknowledgment</strong></p><p>I want to thank <a href="https://ronistern.wixsite.com/home">Roni Stern</a>, my MSc thesis supervisor. My interest in this area and large parts of this blog series stems from the wonderful course he teaches on multi-agent systems at Ben-Gurion University, which I had the privilege to take.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ae635a6491d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/from-a-to-marl-part-2-ai-planning-8ae635a6491d">From A* to MARL (Part 2— AI Planning)</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From A* to MARL (Part 1 — MAPF)]]></title>
            <link>https://medium.com/data-science/from-a-to-marl-part-1-mapf-d4c0796ce1af?source=rss-bdd98c8f5e5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4c0796ce1af</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[multi-agent-systems]]></category>
            <category><![CDATA[pathfinding]]></category>
            <category><![CDATA[editors-pick]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <dc:creator><![CDATA[Omri Kaduri]]></dc:creator>
            <pubDate>Fri, 20 Aug 2021 13:28:59 GMT</pubDate>
            <atom:updated>2021-08-22T21:05:33.678Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*l9CpZyta8F7dspn5RCIZxw.jpeg" /><figcaption>A couple of robots, desperately waiting for algorithms to advise them how to act in the world. Image from <a href="https://unsplash.com/photos/JEfwd_OkQGE">Unsplash</a>.</figcaption></figure><h3>From A* to MARL (Part 1 — MAPF)</h3><h4>An intuitive high-level overview of the connection between AI planning theory to current Reinforcement Learning research for multi-agent systems</h4><p>Research of Reinforcement Learning (RL) and Multi-Agent RL (MARL) algorithms has advanced rapidly during the last decade. One might suggest it is due to the rise of deep learning and the use of its architectures for RL tasks. While it is true at some level, the foundations of RL, which can be thought of as a <strong>planning problem formulated as a learning system</strong>, lie in AI planning theory (which has been in development for over 50 years). However, the connection between RL and planning theory might seem vague, as the former is mostly related to deep learning for most practitioners nowadays.</p><p>This series of articles aims to start from the classical path-finding problem, with strict <strong>assumptions </strong>about the world we are tackling (deterministic, centralized, single-agent, etc.) and <strong>gradually drop </strong>assumptions until we end up with the MARL problem. In the process, we will see several algorithms suited for different assumptions. Yet, an assumption we will always make is that the <strong>agents are cooperative</strong>. In other words, they act together to achieve a common goal.</p><p>It is important to note that this series will concentrate on the “multi-agent systems path” from A* to MARL. This will be done by formulating the problems we want to solve and the assumptions we make about the world we operate in. It certainly won’t be an in-depth review of all algorithms and their improvement on each topic.</p><p>Specifically, I will review optimal multi-agent pathfinding (Part 1), classical planning (<a href="https://omrikaduri.github.io/2021/08/07/Part-2-AI-Planning.html">Part 2</a>), planning under uncertainty (<a href="https://omrikaduri.github.io/2021/08/07/Part-3-Planning-Under-Uncertainty.html">Part 3</a>), and planning with partial observability (<a href="https://omrikaduri.github.io/2021/08/07/Part-4-Planning-Under-Uncertatinty-and-Partial-Observability.html">Part 4</a>). Then, I will conclude our journey at RL and its generalization to multi-agent systems (<a href="https://omrikaduri.github.io/2021/08/07/Part-5-MARL.html">Part 5</a>). I will pick representative algorithms and ideas and will refer the reader to an in-depth review when needed.</p><p><strong>Part 1 — Path Finding</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SN7Bg5IM9B_YeUWD.png" /><figcaption>Two shortest paths between A and B. <a href="https://informatika.stei.itb.ac.id/~rinaldi.munir/Matdis/2010-2011/Makalah2010/MakalahStrukdis2010-016.pdf">Image source</a>.</figcaption></figure><p>The fundamental problem of pathfinding is <strong>finding the shortest path between two points. </strong>Specifically, in pathfinding, we assume that we want to solve the problem for a <strong>single agent</strong>. Also, we assume that:</p><ol><li>Time is discretized and actions can only be taken one at a time.</li><li>Actions are deterministic and durationless, i.e. applying an action is immediate and it would change the state by a deterministic function.</li><li>We have full knowledge about the world, i.e. where obstacles are located, how many points there are, etc.</li></ol><p>Surely, there are other assumptions we make (i.e., the agents are cooperative and not self-interested). However, I aim to only explicitly write the assumptions that we will soon try to drop.</p><p>A classical algorithm in AI for solving the pathfinding problem is A*. Given a weighted graph, A* maintains a tree of paths originating at the start node and extends those paths according to a heuristic one edge at a time until reaching the goal. If graphs, heuristics, and A* are new to you, follow the links for a great introduction for <a href="https://www.redblobgames.com/pathfinding/grids/graphs.html">graphs</a> and <a href="https://www.redblobgames.com/pathfinding/a-star/introduction.html">A*</a>.</p><p><strong>Generalizing to Multi-Agent Path Finding (MAPF)</strong></p><p>A* solves the problem of single-agent pathfinding. But, in many real-world applications, we deal with multiple agents. Therefore, MAPF illustrates the problem of finding a shortest path for <strong>all agents </strong>to reach their goals <strong>without collisions</strong> (i.e., no couple of agents can be in the same location at the same time).</p><p><strong>What do we mean by “shortest”?</strong></p><p>For a single agent, we looked for the minimal number of actions it needs to perform to reach its goal. For multiple agents, there are two main metrics for path length in use today:</p><ol><li><strong>Sum Of Costs</strong> — As it sounds, simply sum the cost of all agents’ paths.</li><li><strong>Makespan</strong> — Take the maximal single-agent cost.</li></ol><p>Clearly, optimizing for each metric will result in different shortest path solutions. I will focus on algorithms that optimize for the <strong>Sum Of Costs.</strong></p><p><strong>Exponential search-space</strong></p><p>Fortunately, A* time complexity is polynomial (given a good heuristic). Generally, in computer science, a polynomial running time is considered efficient. Can we generalize it to multiple agents and keep the polynomial time complexity?</p><p>First, we need to remember about A* <a href="https://en.wikipedia.org/wiki/Branching_factor">branching factor</a>. The branching factor of a graph is the number of children at each node. For A* with a single agent, where the agent performs one action (out of <strong>b </strong>actions) at each time step, the branching factor is <strong>b</strong>. For A* with <strong>k</strong> agents, at each timestep we need to consider all possible actions (b) for all agents (k), leaving us with a branching factor of b^k<strong>. </strong>For a simple grid-world with 5 possible actions (wait, or move right/left/up/down), the branching factor for 20 agents is <strong>5²⁰</strong> =95,367,431,640,625. Clearly, a trivial generalization of A* to MAPF is not feasible. Moreover, MAPF has already <a href="http://people.csail.mit.edu/jingjin/files/YuLav13AAAI.pdf">proven to be NP-Hard</a>.</p><p><strong>A* Improvements</strong></p><p>So, how can we tackle that exponential branching factor? Back in 2010, <a href="https://ojs.aaai.org/index.php/AAAI/article/view/7564">Standley</a> proposed a simple yet powerful idea — let’s try to divide the problems into smaller subproblems, and solve for each subproblem! Specifically, he proposed an iterative algorithm called <strong>Independence Detection (ID)</strong> which begins by searching for the shortest path for each agent alone and checking for conflicting agents. When a couple of conflicting agents are found, they are merged to be a <em>group. </em>This process of replanning and merging groups is repeated until there are no conflicts between the plans of all <em>groups</em>. Even though this algorithm hasn’t improved the worst-case time complexity of A*, it did, in fact, reduce the runtime to be exponential by the number of agents in the largest independent subproblem.</p><p>Yet, for problems with dependent groups consisting of only dozens of agents, we still have a very expensive search space to explore.</p><p>Therefore, <a href="https://ojs.aaai.org/index.php/AAAI/article/view/7564">Standley </a>suggested modifying the search space. As we now know, at each timestep at A*, we <em>generate </em>nodes for all possible actions of all agents. Then, we <em>expand </em>the nodes with minimal f-value (sum of current path costs and heuristic prediction of future cost). Generated nodes with costs higher than the optimal cost are called <strong>surplus nodes.</strong> An important enhancement to A* would be to avoid generating surplus nodes.</p><p>Standley’s method to avoid the generation of surplus nodes is called <strong>Operator Decomposition (OD)</strong>. OD suggests applying orders for the agents. When expanding a node, OD applies only the moves of the first agent, introducing an <strong>intermediate node.</strong> At intermediate nodes, only the moves of the next agent are considered, thus generating further intermediate nodes. When the last agent action is expanded, a <strong>regular node</strong> is generated.</p><p>So basically, Operator Decomposition trades tree width for depth, hoping that a good heuristic would allow it to avoid the generation of surplus nodes.</p><p>Another algorithm that tackles the surplus node generation problem is <a href="https://www.jair.org/index.php/jair/article/view/10882"><strong>Enhanced Partial Expansion A* (EPEA*)</strong></a><strong>. </strong>Despite not explaining EPEA* here, it is important to note that practically it is shown that given <em>a priori</em> knowledge about the domain, EPEA* outperforms OD for the task of avoiding surplus node generation.</p><p><strong>Moving to another space</strong></p><p>All the above algorithms execute A* on the agent state space. Even though A* enhancements indeed improve the performance of the algorithm significantly, it is generally still very computationally expensive to solve for large maps with many agents (more than 100). Therefore, two MAPF algorithms developed over the last decade have tried to change the state space they search upon. Both can be viewed as <strong>two-level solvers.</strong></p><p><a href="https://www.ijcai.org/Proceedings/11/Papers/117.pdf"><strong>Increasing Cost Tree Search (ICTS)</strong></a></p><p>ICTS combines a high-level and low-level solver. The high-level solver searches the <strong>Increasing Cost Tree (ICT).</strong> At ICT, every node contains a vector of length k of costs allowed for each agent path. The ICT root node contains a vector with the cost of each agent’s shortest path length (without considering other agents). Then, the low-level solver’s job is to validate if a joint solution can be found by planning for each agent separately under the defined cost by the high-level solver. It is important to note that ICTS low-level solver doesn’t plan for the agents together, but rather only checks for conflicts between single-agent paths at a given cost.</p><p>If the low-level solver failed to find non-conflicting shortest paths under the given cost vector, the high-level solver expands the ICT root by generating k ICT nodes, where each node corresponds to increasing the cost for one of the agents by one. The high-level solver performs a breadth-first search of the ICT (which guarantees to find the optimal solution).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*HIXhlYHWfMvib8fJt6YBtA.png" /><figcaption>Illustration of ICTS algorithm for 3 agents. <em>Taken from </em><a href="https://ronistern.wixsite.com/home"><em>Roni Stern’s</em></a><em> slides.</em></figcaption></figure><p>For me, it felt weird that ICTS would work better, yet with a good implementation of the low-level solvers (using <a href="https://www.ijcai.org/Proceedings/11/Papers/117.pdf">MDD</a>) and pruning techniques for the ICT nodes, ICTS might outperform other optimal MAPF algorithms.</p><p>It is important to note that ICTS did not magically remove the exponential factor of the time complexity. It is still exponential, but to another factor — the ICT depth. Thus, intuitively, as the optimal solution single-agent path costs would be further away from the single-agent path costs when planned individually, the high-level solver would need to build a deeper ICT. The time complexity of ICTS is exponential by that depth.</p><p><a href="https://www.sciencedirect.com/science/article/pii/S0004370214001386#:~:text=In"><strong>Conflict Based Search (CBS)</strong></a></p><p>CBS is also a two-level solver that searches in different state spaces. Specifically, it searches in <strong>conflict space.</strong></p><p>CBS associates agents with <strong>constraints. </strong>A constraint is defined for a specific agent <strong>(a)</strong>, a location (<strong>v</strong>) which he must avoid at a specific time step (<strong>t</strong>). A constraint is noted by a tuple (<strong>a</strong>,<strong> v, t</strong>).</p><p>For every single agent, CBS low-level solver searches for a shortest path that is consistent given a set of constraints. CBS high-level solver searches the <strong>constraint tree (CT). </strong>The CT is a binary tree, where each node contains a set of constraints and a solution consistent with the constraints (consistent means that all constraints are satisfied). The consistent solution is found by the low-level solver for <strong>every single agent. </strong>Then, CBS high-level solver checks for conflicts in the single-agent shortest paths. If no conflicts are found, we found the optimal plan. Yet, if a conflict is found, the high-level solver splits the corresponding CT node and generates nodes with constraints that avoid the conflict we found. Performing a <em>best-first search </em>on the CT is guaranteed to find the optimal solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*D51jg9ZMokHPjX-pFs_d4w.png" /><figcaption>A canonical MAPF example. CBS will generate a node with a constraint for one of the mice at timestep 2 at location C, and will then find an optimal joint path. Image from the <a href="https://reader.elsevier.com/reader/sd/pii/S0004370214001386?token=2CA53FCC985635AFCF45CBD419B2C69B9E6D6C41659E8A8918445C819C4FF0AB45CA7D2767F35367ADF7DA101F50189B&amp;originRegion=eu-west-1&amp;originCreation=20210821160939">CBS paper</a>.</figcaption></figure><p>During the 6 years since CBS was developed, it emerged as a powerful MAPF algorithm and was suggested with many improvements. The main weakness being addressed is its runtime being exponential to the number of conflicts it needs to solve. Thus, in crowded problems with many conflicts, it would perform poorly.</p><p><strong>Reduce MAPF to another NP-Hard problem</strong></p><p>Another interesting line of work for MAPF is by reduction to other NP-Hard problems. The idea behind it is that researchers have already developed powerful algorithms for other NP-Hard problems during the last decades. Therefore, instead of developing MAPF algorithms, we can just reduce MAPF and use existing solvers.</p><p>I won’t dive into the details of the reductions made, but I will state that this line of research has lately been shown to produce highly powerful MAPF algorithms. A partial list of the NP-Hard problems which successfully solve a reduction of MAPF contains <a href="https://www.andrew.cmu.edu/user/gswagner/workshop/IJCAI_2016_WOMPF_paper_5.pdf">Boolean Satisfiability</a> (SAT), <a href="https://ed-lam.com/papers/bcpmapf2019.pdf">Mixed Integer Programming</a> (MIP), <a href="https://ojs.aaai.org/index.php/ICAPS/article/view/3471/3339">Constraint Programming</a> (CP).</p><p><strong>So… What MAPF algorithm should I use?</strong></p><p>Well, it depends. Basically, if you know the specific properties of your MAPF domain (Is it a large graph? How many agents? Are the agents crowded?), current research has some guidelines about what algorithm to use. Yet, selecting the most suitable algorithm for a MAPF problem is currently under research. Recently, a<a href="https://ojs.aaai.org/index.php/SOCS/article/view/18560"> thorough analysis of the different MAPF algorithms</a> had been made and points out cases where some algorithms are better than others.</p><p><strong>The dynamic problem requires different algorithms</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2Fagonizingregularafricanfisheagle&amp;display_name=Gfycat&amp;url=https%3A%2F%2Fgfycat.com%2Fagonizingregularafricanfisheagle&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FAgonizingRegularAfricanfisheagle-size_restricted.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=gfycat" width="480" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6154018e92925791a32f380ef9b1f316/href">https://medium.com/media/6154018e92925791a32f380ef9b1f316/href</a></iframe><p>The dynamic variant of MAPF extends it to be practical for a wide range of interesting practical problems (such as <a href="https://www.jair.org/index.php/jair/article/view/10542">Autonomous Intersection Management</a>). It is a highly interesting variation of MAPF. However, in this series of articles, we focus on the “multi-agent path” from A* to MARL, and will not get into it. I encourage the curious reader to read the papers about <a href="https://ojs.aaai.org//index.php/AAAI/article/view/4769">online MAPF</a> and <a href="https://arxiv.org/abs/1705.10868">lifelong MAPF</a>.</p><p><strong>Conclusion</strong></p><p>We started from the basic problem of shortest pathfinding for a single agent and generalized it to the multi-agent pathfinding problem. We saw that even for that relatively “easy problem”, where we assumed full knowledge about the world, discretized time, and deterministic actions, finding an optimal solution is difficult and might be intractable. Then, we heard about the interesting generalization of MAPF to dynamic problems. Of course, there are many other interesting variants of MAPF, such as self-interested agents, yet I focused on the classical MAPF problem.</p><p><a href="https://omrikaduri.github.io/2021/08/07/Part-2-AI-Planning.html">Next</a>, we will look at the generalized problem of AI planning, which is the case when our agents can do a little more than just move, and need to fulfill more complex goals. Then, we will continue to remove more and more assumptions, until we end up with Multi-Agent Reinforcement Learning.</p><p><strong>Acknowledgment</strong></p><p>I want to thank <a href="https://ronistern.wixsite.com/home">Roni Stern</a>, my MSc thesis supervisor. My interest in this area and large parts of this blog series stems from the wonderful course he teaches on multi-agent systems at Ben-Gurion University, which I had the privilege to take.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4c0796ce1af" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/from-a-to-marl-part-1-mapf-d4c0796ce1af">From A* to MARL (Part 1 — MAPF)</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>