GithubHelp home page GithubHelp logo

hermabr / optimus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from teshnizi/optimus

0.0 0.0 1.0 2.06 MB

Optimization Modeling Using mip Solvers and large language models

License: Other

Python 34.23% Jupyter Notebook 64.53% Shell 0.14% TeX 1.10%

optimus's Introduction

Getting started

Install dependencies

pip install google langchain google-generativeai langchain-google-genai python-dotenv gurobipy

Run the code

python gpt4or.py --verbose True --maxtry 5 --mode 105 --prob ./data/introduction_to_linear_optimization/problem_1

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: https://optimus-solver.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.py --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

Links

optimus's People

Contributors

hermabr avatar teshnizi avatar shayantalaei avatar

Forkers

xinxin-m

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.