TransitLogix Co. offers two competing shipping services: Priority and Economy. The company aims to sell these services to two distinct customer segments: small businesses and large enterprises. The perceived value of each service by the customer segments is shown in the table below: 

| Customer Segment | Value of Priority Service ($) | Value of Economy Service ($) |  
|-------------------|--------------------------------|-------------------------------|  
| Small Businesses  | 120                            | 80                            |  
| Large Enterprises | 90                             | 110                           |  

Each customer will choose either Priority or Economy, but not both. If customers believe that the value of priority service exceeding its price is greater than or equal to the value of economic service exceeding its price, they will choose priority service. Similarly, If customers believe that the value of economic service exceeding its price is greater than or equal to the value of priority service exceeding its price, they will choose economic service. The small business segment has 1,000 potential customers, and the large enterprise segment has 1,500 potential customers. TransitLogix wants to set prices for each service to ensure that small businesses choose Priority and large enterprises choose Economy. And to maintain a clear differentiation and brand image, TransitLogix has decided that the price of the Priority service must be at least $15 higher than the price of the Economy service. How can TransitLogix maximize its total revenue from these two customer segments?

Problem type: LP (Toy: 2 variables, 3 constraints, 6 nonzeros)

Mathematical model:
Set:
1. Segment
The set of customer segments, \( S = \{1, 2\} \)  # 1: Small Businesses, 2: Large Enterprises
2. Service
The set of services, \( T = \{1, 2\} \)  # 1: Priority, 2: Economy

Parameter:
1. PriorityServiceValue
[120, 90]  # in dollars
2. EconomyServiceValue
[80, 110]  # in dollars
3. SmallBusinessPotential
1000  # number of customers
4. LargeEnterprisePotential
1500  # number of customers

Decision Variable:
1. PriorityPrice
Continous variable, \( PriorityPrice \) 
2. EconomyPrice
Continous variable, \( EconomyPrice \)  

Objective:
1. Maximize the total revenue.
max: (SmallBusinessPotential * PriorityPrice) + (LargeEnterprisePotential * EconomyPrice)

Constraint:
1. Small business chooses Priority.
PriorityServiceValue[1] - PriorityPrice \geq EconomyServiceValue[1] - EconomyPrice
2. Large enterprise chooses Economy.
PriorityServiceValue[2] - PriorityPrice \leq EconomyServiceValue[2] - EconomyPrice
3. price difference constraint.
PriorityPrice - EconomyPrice >= 15
4. bound constraint.
PriorityPrice >= 0
EconomyPrice >= 0
PriorityPrice <= PriorityServiceValue[1]
EconomyPrice <= EconomyServiceValue[2]

Type:
Continous, Linear, Linear
LP

Gurobi implementation:
import gurobipy as gp
from gurobipy import GRB


def solve_pricing_optimization(
    priority_service_value=[120, 90],
    economy_service_value=[80, 110],
    small_business_potential=1000,
    large_enterprise_potential=1500
):
    """
    Models and solves the pricing optimization problem.
    """
    # Create a new model
    model = gp.Model("pricing_optimization")

    # Decision Variables
    priority_price = model.addVar(name="PriorityPrice", lb=0, ub=priority_service_value[0])
    economy_price = model.addVar(name="EconomyPrice", lb=0, ub=economy_service_value[1])

    # Objective: Maximize total revenue
    model.setObjective(
        small_business_potential * priority_price + large_enterprise_potential * economy_price,
        GRB.MAXIMIZE
    )

    # Constraint 1: Small business chooses Priority
    model.addConstr(
        priority_service_value[0] - priority_price >= economy_service_value[0] - economy_price,
        "small_business_preference"
    )

    # Constraint 2: Large enterprise chooses Economy
    model.addConstr(
        priority_service_value[1] - priority_price <= economy_service_value[1] - economy_price,
        "large_enterprise_preference"
    )

    # Constraint 3: Price of Priority service must be at least $15 higher than Economy service
    model.addConstr(
        priority_price - economy_price >= 15,
        "price_difference"
    )

    # Solve the model
    model.optimize()

    # Return Results
    if model.status == GRB.OPTIMAL:
        return {"status": "optimal", "obj": model.ObjVal}
    else:
        return {"status": f"{model.status}"}


if __name__ == "__main__":
    result = solve_pricing_optimization()
    print(result)


Solution status: OPTIMAL
Optimal objective value: 277500