Inspiration

Optimization problems appear everywhere, from logistics and scheduling to engineering and resource allocation. However, choosing the right optimization algorithm often requires significant mathematical and technical knowledge. We wanted to build an agent that could reason about an optimization problem and automatically decide how it should be solved instead of forcing the user to manually select an algorithm.

This led us to build OptiAgent, an AI-powered autonomous optimization system that combines Gemini's reasoning capabilities with traditional numerical optimization algorithms.

What it does

OptiAgent allows users to provide an objective function, number of dimensions, and variable bounds through an interactive web interface.

The agent analyzes the optimization problem and selects an appropriate optimization strategy from multiple algorithms, including CMA-ES, Differential Evolution, Genetic Algorithm, Simulated Annealing, Hill Climbing, Nelder-Mead, and Random Search.

It then runs the optimization, monitors convergence, validates the result, and can adapt its strategy when progress becomes stagnant.

The system also provides the best solution, objective score, strategy history, convergence information, and an AI-generated explanation of why a particular strategy was selected.

How we built it

We built OptiAgent using Python, Flask, NumPy, SciPy, JavaScript, HTML, and CSS. Gemini is integrated as the reasoning layer responsible for analyzing the optimization problem and recommending an appropriate strategy.

We implemented a safe mathematical expression parser so users can enter objective functions without directly executing arbitrary code. The backend exposes a REST API, while the frontend provides an interactive interface for configuring and running optimization problems.

The system follows an autonomous workflow:

Observe → Reason → Decide → Act → Validate → Adapt

We deployed the backend and frontend using Google Cloud Run and connected the project to GitHub for continuous deployment.

Challenges we ran into

One of the biggest challenges was making an AI agent work reliably with numerical optimization algorithms. An AI recommendation alone is not enough—the selected algorithm must actually produce a valid numerical solution.

We therefore added validation, convergence monitoring, error handling, and fallback logic. Another challenge was handling real deployment requirements such as HTTP port configuration, Cloud Run containers, environment variables, CORS, and connecting the deployed frontend to the backend API.

We also had to make the system robust when Gemini is unavailable or its API quota is reached, so the application can continue operating using its local strategy-selection logic.

Accomplishments that we're proud of

We are proud of building a working end-to-end autonomous optimization system rather than a simple chatbot or algorithm selector.

OptiAgent can take an optimization problem from the user, reason about it, select an optimization method, execute it, validate the result, monitor its progress, and return an interpretable result through a web interface.

We also successfully deployed the application to Google Cloud Run, making it accessible through public web URLs rather than requiring the application to run locally.

What we learned

Through this project, we learned how to combine generative AI with traditional algorithms instead of treating AI as the entire solution.

We gained practical experience with Gemini function calling, agent design, optimization algorithms, safe expression parsing, REST APIs, frontend-backend integration, Git/GitHub workflows, environment variables, container deployment, and Google Cloud Run.

Most importantly, we learned that an effective AI agent needs validation and fallback mechanisms. AI can make decisions, but deterministic algorithms and validation are essential for producing reliable numerical results.

What's next for OptiAgent

Our next goal is to move OptiAgent from a general mathematical optimization platform toward real-world optimization problems.

We plan to extend it into a Smart Logistics Optimizer capable of handling problems such as vehicle routing, delivery scheduling, fleet utilization, and route-cost optimization.

We also plan to add richer visualizations, real-world datasets, multi-objective optimization, improved benchmarking between algorithms, and more autonomous adaptation so that OptiAgent can continuously learn which strategies work best for different classes of problems.

Built With

Share this project:

Updates

Submission history