I want to model a dynamic pricing model with exponentially falling demand at a rising price (see picture). Demand is always above 0, as well as the price.
The price and the demand are variables. a and b are parameters.
I modeled in python with gurobi:
m = gp.Model("test")
price = m.addVar(vtype=GRB.CONTINUOUS, name="price", lb=0)
demand = m.addVar(vtype=GRB.CONTINUOUS, name="demand")
help = m.addVar(vtype=GRB.CONTINUOUS, name="help")
help_2 = m.addVar(vtype=GRB.CONTINUOUS, name="help_2")
obj = price*20*demand
a = 10
b = 0.038
m.addConstr(a*help == demand)
m.addConstr(-b*price == help_2)
m.params.FuncPieces = 1
m.params.FuncPieceLength = 1e-3
As a result I get:
- price = 0
- demand = 10
- result obj. = 0 (which is not the maximum, as with a rising price, the objective could increase)
Where is the problem?
If I model a linear demand curve it works perfectly fine and determines the optimal price.
Constraint that works:
m.addConstr(a - b * price[t, j] == demand[t, j, q])
Please sign in to leave a comment.