Skip to content

Optimization Modeling Using mip Solvers and large language models

License

Notifications You must be signed in to change notification settings

teshnizi/OptiMUS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image OptiMUS: Optimization Modeling Using mip Solvers and large language models

This repository contains the official implementation for OptiMUS: Optimization Modeling Using mip Solvers and large language models. Demo (Under construction): https://optimus-demo.vercel.app/



optimus_agent

NLP4LP Dataset

You can download the dataset from https://nlp4lp.vercel.app/. Please note that NLP4LP is intended and licensed for research use only. The dataset is CC BY NC 4.0 (allowing only non-commercial use) and models trained using the dataset should not be used outside of research purposes.

Usage

  1. Clone this repository

  2. Download NLP4LP dataset zip file, extract the contents, and replace the empty datasets/ folder in the root directory of the repo with the downloaded one (beside gpt4or.py):

    image
  3. Add your OpenAI API key(s) in configure.py:

from utils import get_templates

api_keys = [
    # "sk-API-KEY-1",
    # "sk-API-KEY-2",
    # ...
]

# Get templates
templates = get_templates()
...
  1. Install the requirements
pip install langchain
pip install openai
  1. Run the agent:
python gpt4or --model gpt-4 --maxtry 5 --mode 105 --verbose True --prob ./datasets/introduction_to_linear_optimization/problem_1

Modes and Options:

options:
  -h, --help           show this help message and exit
  --model MODEL        Model name
  --prob PROB          Problem path
  --stdfname STDFNAME  Description file name
  --maxtry MAXTRY      Maximum attempts
  --human HUMAN        Human test file
  --aug AUG            Number of augmentations. Uses the rephrases generated by using the --rephrase parameter.
  --solver SOLVER      Solver name (cvxpy/gurobi)
  --mode MODE          102: Prompt, 103: Prompt + Debug, 104: Prompt + Debug + AutoTest, 105: Prompt + Debug + Human Test
  --rephrase REPHRASE  Number of rephrases. If more than 0, the agent will only generate rephrases of the problem and will
                       NOT solve the problem. The rephrased instances can then later be used by setting the aug parameter to
                       the number of rephrases.
  --verbose VERBOSE    Verbose mode

About

Optimization Modeling Using mip Solvers and large language models

Resources

License

Stars

Watchers

Forks

Packages

No packages published