What You Will Learn
You will learn how to use Gemini to structure a constrained optimization problem, such as allocating marketing budget across campaigns or assigning staff to projects, while checking that the recommendation satisfies business constraints.
Required Dataset
Use the Northstar_SaaS_Dataset.
Use the tab from Lesson 39:
Campaign_ROI_Summary
Create three new tabs:
Optimization_Model
Constraint_Check
Optimization_QA
Before You Start
Optimization requires three things:
Objective: What you want to maximize or minimize.
Decision variables: What Gemini is allowed to change.
Constraints: Rules the solution must follow.
For this lesson, use this objective:
Allocate marketing budget across campaigns to maximize expected pipeline.
Step-by-Step Instructions
Step 1. Ask Gemini to frame the problem
Use this prompt:
Act as a marketing budget optimization consultant.
Use the Campaign_ROI_Summary tab.
Objective: Allocate a fixed marketing budget across campaigns to maximize expected pipeline.
Decision variable: Recommended Spend by campaign.
Constraints:
– Total spend must equal 300000.
– Each campaign must receive at least 10000.
– No campaign can receive more than 90000.
– No campaign can receive more than 35% of total budget.
– Maintain at least four active channels.
– Do not overallocate to low-confidence campaigns.
Return recommended spend by campaign, rationale, expected pipeline, constraint concerns, and review-needed status.
Step 2. Build the model
In Optimization_Model, include campaign name, current spend, pipeline per dollar, confidence level, recommended spend, expected pipeline, budget share, and constraint status.
Use formulas such as:
=IFERROR(Influenced Pipeline/Current Spend,””)
=Recommended Spend*Pipeline per Dollar*Confidence Factor
=IFERROR(Recommended Spend/Total Recommended Spend,””)
Step 3. Check constraints
In Constraint_Check, calculate whether total spend equals budget, any campaign is below minimum, any campaign exceeds maximum, any campaign exceeds maximum share, and at least four channels remain active.
Ask Gemini:
Review the Constraint_Check tab. Identify failed constraints, explain why they matter, and recommend revisions to the allocation.
Expected Result
You should have an optimization model that recommends budget allocation by campaign and checks whether the recommendation satisfies all constraints.
Check Your Work
Confirm that total recommended spend equals the budget, all minimum and maximum rules are respected, low-confidence campaigns are not overallocated, and expected pipeline is formula-backed.
Optional Extension
Ask Gemini:
Create a staff assignment optimization model with project requirements, staff availability, skills, hourly cost, maximum projects, recommended assignment, constraint concerns, and review-needed status.
