Which neural network architecture is most suitable for different-sized inputs and outputs?

I want to develop a neural network that will be able to optimally place sprinklers on a lawn. Of course, as both amount of vertices of the lawn (polygon) and amount of sprinklers vary a lot depending on best placing practices, it is hard for me to understand what architecture should be suitable for this task. My data can be both processed as “image” (but I will of course have to separate polygon, and sprinklers in two layers) or as an array of polygons and array of sprinklers with their coordinates as characteristics.

So far I thought of two solutions:

  1. GAN where Generator will randomly place sprinklers on top of pre-defined lawn polygon and learn based on Discriminator that will evaluate based on a decently sized (5000 examples so far) dataset of hand-made images of polygons with their respective sprinkler placement.

This architecture might sound cool in my head, but when I think about it I begin to have million other questions. For example, is this even possible to generate only sprinkler placement while polygon is untouched and considered in both parts of GAN?

  1. RNN where I think about feeding each layer full polygon data and then add one sprinkler at a time, which will be represented both in next layer and given as output. I didn’t think about this one much, but it sounds more simple than first variant in my head.

The main problem is that I don’t have enough experience to correctly evaluate which architecture will be more suitable, so maybe there will be any suggestions on my ideas or a completely different one that I missed?

P.S. I fully understand that this task can be solved by using sophisticated algorithm, however I want to turn it into a Neural Network because I want to learn and get some experience in this area.

Google Deepmind

Your project to develop a neural network for optimal sprinkler placement on a lawn presents an interesting and unique challenge due to the variable sizes of inputs (lawn shapes) and outputs (sprinkler placements). Each proposed solution has its merits, but considering the nature of your task, there might be other architectures more suited to handling variable-sized inputs and outputs, and dealing with spatial relationships.

Evaluating Proposed Solutions:

  1. Generative Adversarial Network (GAN):
  • GANs are powerful for generating realistic images and could be adapted to your task. However, controlling specific parts of the generated image (like keeping the lawn shape constant while only varying sprinkler placement) can be complex and might require advanced techniques such as conditional GANs.
  • The discriminator’s role in evaluating the placement could work, but defining a suitable loss function that captures the effectiveness of sprinkler placement could be challenging.
  1. Recurrent Neural Network (RNN):
  • RNNs are traditionally used for sequential data and might not be inherently suited for capturing the spatial relationships required for optimal sprinkler placement.
  • While you could feed polygon data sequentially, this might not effectively capture the spatial constraints and relationships necessary for determining sprinkler placement.

Alternative Architectures:

  1. Graph Neural Networks (GNNs):
  • Given that your data involves spatial relationships and can be represented as a graph (vertices for lawn corners and sprinklers), GNNs might be a suitable architecture. GNNs excel at handling variable-sized inputs and can capture the complex relationships between elements in a graph.
  • You could represent the lawn as a graph where nodes represent potential sprinkler locations (including lawn vertices) and edges represent distances or possible water coverage. The GNN could learn to select nodes (sprinklers) that optimally cover the entire graph (lawn).
  1. Convolutional Neural Networks (CNNs) with Attention Mechanisms:
  • If you prefer an image-based approach, CNNs combined with attention mechanisms can handle variable-sized inputs and focus on relevant parts of the image. The attention mechanism could help the network focus on critical areas for sprinkler placement.
  • You could use a segmentation-like approach where the network learns to segment the lawn into areas covered by each sprinkler, effectively learning optimal placement.
  1. Reinforcement Learning (RL):
  • An RL-based approach could frame the task as an agent learning to place sprinklers to maximize coverage while minimizing overlap or water waste. This approach naturally handles variable-sized inputs and outputs since the agent can learn to place any number of sprinklers based on the state of the environment (lawn shape and already placed sprinklers).

Implementation Considerations:

  • Data Representation: For GNNs and RL, you might need to preprocess your data into a suitable format (graphs for GNNs, states and actions for RL). For CNNs with attention, you’ll need to structure your image data to highlight both lawn boundaries and sprinkler placements clearly.
  • Custom Components: Depending on your choice, you may need to develop custom layers or loss functions, particularly for GNNs (to process graphs) or for a GAN (to handle conditional generation).
  • Simulation Environment: For RL and possibly for training GANs or GNNs, you might need a simulation environment that can accurately model sprinkler coverage and lawn hydration.

Given your interest in gaining experience with neural networks, starting with a more straightforward approach (like CNNs with attention for image-based data or a basic GNN for graph-based data) and then exploring more complex architectures (like conditional GANs or RL) could provide a good balance between learning and project complexity. It’s also beneficial to iterate on your models, starting with simpler versions to establish baselines and gradually incorporating more complexity as you gain insights from initial experiments.

1 Like