Skip to content

A sophisticated mathematical modeling assistant that leverages advanced language models to iteratively solve, evaluate, and improve mathematical modeling problems.

Notifications You must be signed in to change notification settings

pancacake/Model-Agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Model-Agent πŸ€–

A sophisticated mathematical modeling assistant that leverages advanced language models to iteratively solve, evaluate, and improve mathematical modeling problems.

🌟 Features

  • Iterative Problem Solving: Multi-round approach combining solution generation, evaluation, and improvement
  • Rigorous Mathematical Validation: Strict verification of mathematical correctness and completeness
  • LaTeX Support: Full support for mathematical expressions using TeX notation
  • Structured Output: Well-organized solution format with summaries and detailed derivations
  • Continuous Improvement: Progressive refinement through automated review and enhancement cycles

πŸ—οΈ Project Structure

Model-Agent/
β”œβ”€β”€ api_client.py      # API client for model interactions
β”œβ”€β”€ prompt.py         # Core system prompts and instructions
β”œβ”€β”€ reasoning.py      # Main iterative solving logic
β”œβ”€β”€ api.ENV          # API configuration (create from template)
β”œβ”€β”€ problem.txt      # Input problem statement
└── extra.txt        # Additional requirements/constraints

πŸš€ Getting Started

Prerequisites

  • Python 3.9+
  • Access to a compatible language model API

Installation

  1. Clone the repository:
git clone https://github.com/pancacake/Model-Agent.git
cd Model-Agent
  1. Create and configure your API environment file:
cp api.ENV.template api.ENV
# Edit api.ENV with your API credentials

Usage

  1. Place your mathematical modeling problem in problem.txt
  2. (Optional) Add additional requirements in extra.txt
  3. Run the solver:
python reasoning.py --rounds 3 --max_tokens 15000

Command Line Arguments

  • --problem_txt: Problem statement file (default: problem.txt)
  • --extra_txt: Additional requirements file (default: extra.txt)
  • --env: API configuration file (default: api.ENV)
  • --rounds: Number of improvement iterations (default: 3)
  • --outdir: Output directory (default: outputs)
  • --run_name: Name for this run (default: run)
  • --max_tokens: Maximum tokens per response (default: 15000)
  • --temperature: Response randomness (default: 0.2)

πŸ“€ Outputs

The system generates three main outputs in the specified output directory:

  1. trace.md: Detailed record of each iteration, including:

    • SOLVE: Initial solution attempt
    • JUDGE: Validation and error identification
    • IMPROVE: Enhanced solution based on feedback
  2. final.md: The final, polished solution

  3. memory.json: Complete execution record including:

    • Metadata (rounds, parameters)
    • Context (problem, requirements)
    • Full iteration history

πŸ’‘ Solution Process

  1. SOLVE Phase

    • Constructs rigorous mathematical model
    • Provides structured solution with clear assumptions
    • Ensures LaTeX formatting for mathematical content
  2. JUDGE Phase

    • Validates mathematical correctness
    • Identifies critical errors and gaps
    • Provides detailed verification log
  3. IMPROVE Phase

    • Addresses identified issues
    • Refines mathematical arguments
    • Maintains solution coherence

πŸ” Quality Assurance

The system enforces:

  • Rigorous mathematical reasoning
  • Complete step-by-step derivations
  • Clear documentation of assumptions
  • Proper LaTeX formatting
  • Systematic error detection
  • Progressive solution improvement

πŸ“– Examples

Example run with a basic optimization problem:

python reasoning.py --problem_txt examples/optimization.txt --rounds 2

The solution will be generated in outputs/run-TIMESTAMP/ with full iteration history and final solution.

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

✨ Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

🀝 Support

If you encounter any problems or have suggestions, please open an issue on GitHub.

About

A sophisticated mathematical modeling assistant that leverages advanced language models to iteratively solve, evaluate, and improve mathematical modeling problems.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages