Writing your first prompt

At this point, you might still wonder how to get started on writing an prompt. In Getting started, we were presented with a problem description and constraints. In Use cases some possible applications were mentioned.

But how can we now find use cases in our daily life? It is very likely that there are multiple opportunities for optimization in both your daily professional and personal encounters [1]. However, to identify those it requires looking at challenges through the lens of optimization. If you are new to optimization, this likely does not come naturally (yet).

To put it clearly, taking the route of utilizing an LLM to build and solve an optimization model you would need to traverse the following steps:

1. Recognize a situation as an optimization problem

2. Identify the elements in the problem (objective, constraints & data)

3. Write down these elements into a well-written and unambiguous LLM prompt

4. Generate and solve the model and interpret the results

You could say that in the Getting started chapter we only demonstrated Step 4. Steps 1-3 all require getting acquainted with the elements of optimization and learning to recognize these problems in the wild.

Here, again, we found that ChatGPT can be of help. To support Steps 1-3 we have devised another Custom GPT called Gurobi AI Modeling Prompt Engineer. This GPT should act as an optimization expert to assist with Steps 1 and 2, and once you collaboratively have come to a defined problem, the GPT should propose a prompt (Step 3) that you can then hand over to Gurobi AI Modeling Assistant to generate and solve the model.

Gurobi AI Modeling Prompt Engineer Gurobi AI Modeling Prompt Engineer
Explore, identify and create the prompt
Gurobi AI Modeling Assistant Gurobi AI Modeling Assistant
Generate the model
Optimization Model Optimization Model

For instance, we can start with the following prompt:

I am a CFO and need to decide how to divide bonuses across the organization. What are the elements that I can take into consideration for optimizing this?
Supplying the prompt

The GPT will likely give some ideas which factors might be of interest to take into account:

First response

To answer these questions, we can say something like:

I have a total of 20% of revenue as bonus to award. There are some team limits defined as percentages of the total bonus pool.
I want to use team performance metrics.
Higher level people should get more bonus.
Tenure is a variable that should get taken into account.
I also want to give some teams a little bit more since they worked a lot of overtime this year.
Answering questions

At this point, the GPT will either:

  1. ask follow-up questions, or

  2. decide it has enough information to come up with a prompt for Gurobi AI Modeling Assistant.

Important

If the GPT has decided on option 2, you should take a moment and reflect whether the prompt does exactly what you want and is as unambiguous as possible. Poorly written or incomplete prompts will still lead to incomplete or bad models.

In the second case, the output should follow a prompt template from a future chapter:

Answering questions
Answering questions

If you are happy with this prompt. The next step will be to collect the necessary data to supply to the prompt. To get an idea of what this data could look like, our Example prompts section has many examples that utilizes external data, but you could also use inline data as in Getting started. In the future, we should probably write a section about which data types are suitable in this context.

At this point, it is highly recommended to take a look at some of the Example Prompts in the next section to get inspiration on what an effective an unambiguous prompt could look like.