Skip to content

denix372/bpc-2026-hex-network-optimizer

Repository files navigation

BPC 2026: Hexagonal Network Optimizer

C++ algorithmic solution for the Bitdefender Programming Contest 2026. The project simulates and optimizes a dynamic data center network on a hexagonal grid under randomized resource constraints. I applied OOP, BFS graph pathfinding for connectivity, and custom greedy heuristics to maximize dynamic resource allocation and infrastructure growth.


Problem Overview: A Tale of Two Suns

This project was developed for Bitdefender Programming Contest (BPC) 2026. The scenario involves saving a human colony on a dying planet by building an Artificial General Intelligence (AGI) network. The infrastructure must be built on a 19-hexagon grid map, utilizing the unpredictable solar energy of the planet's two suns.

Key Mechanics:

  • Hexagonal Grid: The map consists of 54 interconnected nodes across 19 hexagons.
  • Resource Generation: Factories produce 5 types of components: Energy, Water, Data, RAM, and GPU. Production depends on random daily solar energy levels (ranging from 2 to 12).
  • Infrastructure Constraints: Data centers cannot be built adjacent to each other due to electromagnetic interference. Cables must be built along the hexagon edges to connect the network.
  • Component Conversion: Converters allow trading excess resources for needed ones at different exchange rates (2:1, 3:1, or 4:1).

Technical Approach

Since random daily resource generation prevents a static pre-computed solution, I developed a dynamic simulation engine that reacts to the environment day by day.

Core Algorithms & Concepts:

  • Object-Oriented Programming (OOP): The system state is managed through custom structures (Hex, Resource, Node, Edge) and a central Board class that handles the simulation logic cleanly.
  • Greedy Heuristics: The placement of Data Centers and Cables is determined by a custom scoring function (scoreNode). Nodes are evaluated dynamically based on:
    • Adjacent resource diversity and volume.
    • Statistical probability of the adjacent factories activating (based on solar energy distribution).
    • Access to high-tier converters.
  • Graph Theory (BFS): Implemented Breadth-First Search (findPath) to calculate the most efficient cable routing from the existing infrastructure grid to high-value, unbuilt target nodes.
  • Resource Management: Automated conversion logic (doConvert) trades surplus components efficiently using the best available converters on the grid to continuously fund network upgrades.

How to Build and Run

Prerequisites

  • A standard C++ compiler (e.g., g++, clang++) supporting C++17 or higher.

Compilation

Open your terminal and compile the solution using:

g++ -O3 -std=c++17 main.cpp -o bpc_solution

About

C++ algorithmic solution for the Bitdefender Programming Contest 2026. The project simulates and optimizes a dynamic data center network on a hexagonal grid under randomized resource constraints. I applied OOP, BFS graph pathfinding for connectivity, and custom greedy heuristics to maximize dynamic resource allocation and infrastructure growth.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors