MathModelAgent - An open-source mathematical modeling agent for a fully automated modeling process.
MathModelAgent is an agent specifically designed for mathematical modeling, capable of automating the entire process from problem analysis to paper generation. Based on multi-agent collaboration, it automatically builds mathematical models, writes code, verifies results, and generates formatted documents...
What is MathModelAgent?
MathModelAgent is an agent specifically designed for mathematical modeling, automating the entire process from problem analysis to paper generation. Based on multi-agent collaboration, it automatically builds mathematical models, writes code, verifies results, and generates formatted papers. MathModelAgent supports various Large Language Models (LLMs) and has a built-in native code interpreter for real-time code debugging and optimization. It is suitable for scenarios such as mathematical modeling competitions, data analysis, academic paper writing, and teaching assistance.
Main functions of MathModelAgent
- Fully automated modeling processIt automatically analyzes the problem background, builds a mathematical model, writes code to implement it, verifies the results, and generates a paper with a standard format.
- Built-in code interpreterSupports local code execution and debugging, providing real-time error feedback to optimize code.
- Multi-Agent CollaborationBased on the division of labor and cooperation among intelligent agents such as code agents and paper agents, tasks can be completed efficiently.
- Supports multiple LLM modelsEach Agent is configured with a different large language model, flexibly adapting to different needs.
- Low cost and high efficiencyThe cost per task is as low as about 1 RMB, making it extremely cost-effective.
Technical Principles of MathModelAgent
- Multi-agent architectureBased on a multi-agent system, complex modeling tasks are decomposed into multiple sub-tasks, each completed by a different agent.
- Problem Analysis Agent: Responsible for understanding the background and requirements of the problem.
- Modeling AgentBased on the problem analysis results, select an appropriate mathematical model.
- Code AgentTransform mathematical models into runnable code and then debug and optimize them.
- Paper AgentOrganize the modeling process and results into a formatted paper.
- Large Language Model (LLM) drivenEach agent is configured with a different large language model, using the powerful language generation and logical reasoning capabilities of LLM to complete its respective task.
- Native code interpreterThe built-in code interpreter supports local code execution and debugging, providing real-time feedback on code errors for optimization, ensuring that the generated code is runnable and efficient.
- WebUI and Command Line OperationsIt provides a WebUI interface and command-line mode, allowing users to operate the tool based on an intuitive interface or command-line commands, flexibly adapting to the needs of different users.
- Task Flow AutomationBased on the automated design of task flow, from problem input to paper output, the entire process is automated, which greatly improves the efficiency of mathematical modeling.
How to use MathModelAgent
- Environmental preparationInstall Python, Node.js, and Redis.
- Cloning project:
git clone https://github.com/jihe520/MathModelAgent.git
- configuration file:
- Copy /backend/.env.dev.example to /backend/.env.dev.
- Copy /frontend/.env.example to /frontend/.env.
- Enter the API key and model.
- Start the backend:
cd MathModelAgent/backend
pip install uv
uv sync
source .venv/bin/activate # MacOS/Linux
venv\Scripts\activate.bat # Windows
ENV=DEV uvicorn app.main:app --host
0.0.0.0 --port
8000
--reload
- Start the front end:
cd MathModelAgent/frontend
npm
install
-g
pnpm
pnpm i
pnpm run dev
- Access WebUIOpen your browser and visit http://localhost:3000.
- View resultsThe results are saved in the backend/project/work_dir/xxx/ folder.
Project address for MathModelAgent
- GitHub repository:https://github.com/jihe520/MathModelAgent
Application scenarios of MathModelAgent
- Mathematical Modeling CompetitionQuickly generate modeling ideas, code, and formatted papers, saving time.
- Data analysis projectsUsed in scenarios that require modeling and programming, it automatically generates analysis result documents.
- Academic paper writingWe provide initial drafts of the paper to help organize ideas and optimize content.
- Teaching aidsIt helps teachers and students validate modeling ideas and improve teaching effectiveness.
- Scientific Research ExperimentAs an automated modeling platform, it generates model comparison experiments to support scientific research.