MathModelAgent Documentation

repository·main·Indexed 25 days ago

https://github.com/jihe520/mathmodelagent

An automated agent for mathematical modeling competitions that analyzes problems, writes code, performs computations, and generates formatted research papers using Typst. It features a Vue 3 frontend, a FastAPI backend, and can be integrated as a SKILL within agent harnesses like Claude Code or Codex. Supports advanced capabilities including RAG knowledge bases, web search via Tavily, E2B code execution, and Human-in-the-loop (HIL) approval steps.

Tokens
177.6K
Snippets
605
Records
1.1K
Agent score
86%

What's inside MathModelAgent

  1. Overview of MathModelAgent features

    main

    MathModelAgent is an agentic system designed for mathematical modeling. It automates problem analysis, modeling, code writing, error correction, and paper generation.

    Key Capabilities:

    • Multi-Agent Workflow: Uses specialized agents (modeling expert, coding expert, paper expert, etc.).
    • Code Interpreter: Supports Local (Jupyter-based, saves as .ipynb) and Cloud (E2B, Daytona) interpreters.
    • LLM Flexibility: Supports multiple LLMs via litellm for different agents.
    • Output: Generates well-formatted papers and code notebooks.
  2. Use the typst-author skill for Typst documents

    main

    The typst-author skill is designed to generate, edit, troubleshoot, and answer questions regarding Typst (.typ) documents. It is the primary tool for working with Typst syntax, templates, and packages.

    Core Workflows

    • New Projects: Start with a minimal document template and use the docs/tutorial/writing-in-typst.md guide for basics.
    • Editing: Locate target text, apply changes, and verify syntax against the local docs/reference/.
    • Formatting: After editing, use typstyle to ensure idiomatic code.
    • Validation: Use typst compile to verify the final document structure.
  3. Review Typst basic document features

    main

    Typst allows for basic document composition including text emphasis, lists, image insertion, content alignment, and mathematical typesetting. It also utilizes a function-based system for content insertion.

    For advanced content types, refer to the following Typst features:

    • Tables: For structured data.
    • Shapes: For visual elements.
    • Code blocks: For raw text/code formatting.

    To export your work, use the download button in the interface to save the document as a PDF.

  4. Execute the Analysis and Modeling Skill

    main

    The 2analysis-modeling skill is used for the combined phase of mathematical modeling competition analysis and design. It involves reading problem statements and attachments to complete sub-problem decomposition, data understanding, assumption sensitivity checks, variable definitions, model formulas, objective functions, constraints, and solving strategies. This phase produces a modeling report intended for the subsequent coding phase.

    Allowed Tools:

    • Bash(*)
    • Read
    • Write
    • Edit
    • Grep
    • Glob
    • Agent
    • WebSearch
    • WebFetch
  5. Use Typst Counters to track elements

    main

    Counters in Typst allow you to track and display counts for pages, headings, figures, or custom elements. Because counters change throughout a document, accessing their value is a contextual operation and typically requires a #context block.

    To create a counter, use the counter() function. You can pass:

    • A str (e.g., counter("mycounter")) to create a custom global counter.
    • The page function to track page numbers.
    • A selector (like an element function or a label) to count specific elements.
    #let mine = counter("mycounter")
    #context mine.display()
  6. Typst Tutorial Curriculum Overview

    main

    The Typst tutorial is structured into four progressive chapters:

    1. Writing in Typst: Learn basic text entry, inserting images, equations, and other elements.
    2. Formatting: Learn to adjust document formatting, including font sizes and heading styles.
    3. Advanced Styling: Create complex page layouts for scientific papers, including author lists and run-in headings.
    4. Making a Template: Learn to build reusable templates based on your styled documents.
  7. Use Typst introspection to interact with document parts

    main

    Typst provides introspection capabilities to allow interactions between different parts of a document. You can use these tools to access and manipulate counters (for pages, sections, figures, or equations), search for specific elements using queries (to build lists of figures or dynamic headers), and manage document state.

    Note: Most introspection functions are contextual. It is highly recommended to understand how context works before using these functions.

  8. Use the 4drawio skill for non-data diagram generation

    main

    The 4drawio skill is responsible for creating non-data diagrams for mathematical modeling papers, such as technical roadmaps, sub-problem flowcharts, model structure diagrams, and data processing pipelines. It follows the 3coding-visual stage but focuses exclusively on non-data visualizations.

    Scope:

    • Included: Technical roadmaps (fig_roadmap), sub-problem flowcharts (fig_flow_q1, etc.), data pipelines (fig_pipeline), model structures (fig_model), indicator systems (fig_index_system), and decision trees (fig_decision_tree).
    • Excluded: Data-driven charts like line graphs, bar charts, scatter plots, heatmaps, box plots, or radar charts (these are handled by 3coding-visual).
    • Constraints: This skill does not re-run models, modify code/, or change numerical conclusions in reports/RESULTS_REPORT.md.
  9. Develop with the MathModelAgent frontend template

    main
    The frontend of MathModelAgent is built using Vue 3, TypeScript, and Vite. It utilizes Vue 3 <script setup> Single File Components (SFCs). For best results, follow the recommended Project Setup and IDE Support guidelines in the official Vue TypeScript guide.