Custom GPTs

Since the steps necessary for translating a problem description into an optimization model are well defined in Answer engineering, we can leverage a feature that OpenAI’s ChatGPT provides to have these steps baked-in: the Custom GPT.

Gurobi AI Modeling Assistant

We have published a Custom GPT called: Gurobi AI Modeling Assistant which incorporates many of the reasoning steps and helps build, execute and interpret the results of the model within ChatGPT so users can focus on writing an effective problem description.

See below for a walkthrough through the model building process using the Gurobi AI Modeling Assistant GPT:

Advantages

Leveraging the functionalities of a Custom GPT, we have also attached a gurobipy Python wheel, so ChatGPT can model and optimize server-side [1].

With this, ChatGPT is sometimes able to spot mistakes it might make in a first draft of the code and fix them autonomously.

Prompt Template

While it is possible to supply the Custom GPT with a wide range of problem-describing prompts, our advice is to write your prompt following a template. We have devised the following prompt template that help guide users write a prompt that contain the elements necessary for an optimization problem:

Problem description:
As a <role> you are responsible for <job context>.
<describe the problem on a high level, making sure you also introduce the context. Normally, 2-5 sentences is sufficient for this.>

Objective: <Maximize/Minimize> <objective>
Constraints:
- <constraint name 1>: <describe constraint>
- <constraint name 2>: <describe constraint>
- <constraint name 3>: <describe constraint>
- etc.

Data:
<data in csv format, including headers> or <upload your files and name the filename here>

As an added bonus, when one follows this template, users are more likely to think about these elements in a structured way. Moreover, in the Example prompts section we will look at some example prompts we recommend trying out with Gurobi AI Modeling Assistant. You will find that most of these prompts follow this template. After going through some of the examples and subsequently using the same template, it should be more natural to follow our prompting recommended best practices.

Gurobi AI Modeling Prompt Engineer

We have introduced Gurobi AI Modeling Prompt Engineer in the Writing your first prompt section. This GPT is for people who feel like they need help with identifying optimization problems in their surroundings or help identify and formulate the elements that constitute an optimization problem description.

Gurobot

Aside from Gurobi AI Modeling Assistant, Gurobi has put out another Custom GPT: Gurobot. Whereas Gurobi AI Modeling Assistant is a very specific tool for helping new users create models from a problem description, Gurobot is a general-purpose GPT for asking Gurobi-related questions. We found that it performs better than using vanilla ChatGPT when asking questions about, for instance, how to best add a specific constraint to your existing model.

We recommend using this GPT for existing Gurobi users (not restricted to gurobipy) that have specific modelling and API questions.

Note

Nevertheless, as with all LLMs, keep in mind that answers from Gurobot can be wrong or misleading. If in doubt, you may want to consult our human experts via our Community Forum or the Gurobi Help Center.