Created
February 26, 2019 17:35
-
-
Save ikatsov/559dda69b7a8f86c5e0d6fb394eeb702 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def linear(a, b, x): | |
return b + a*x | |
# a linear demand function is generated for every | |
# pair of coefficients in vectors a_vec and b_vec | |
def demand_hypotheses(a_vec, b_vec): | |
for a, b in itertools.product(a_vec, b_vec): | |
yield { | |
'd': functools.partial(linear, a, b), | |
'p_opt': -b/(2*a) | |
} |
def linear(a, b, x):
return b + a*x
a linear demand function is generated for every
pair of coefficients in vectors a_vec and b_vec
def demand_hypotheses(a_vec, b_vec):
for a, b in itertools.product(a_vec, b_vec):
yield {
'd': functools.partial(linear, a, b),
'p_opt': -b/(2*a)
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/ikatsov/559dda69b7a8f86c5e0d6fb394eeb702#file-dynamic-pricing-c01-py