我有一个客观的功能:
def calculate_output(social_sum, learning_sum, w_1, w_2):
economy_output = sum(social_sum) * sum(learning_sum) - w_1 * sum(learning_sum) - w_2 *sum(social_sum)
return economy_output
和两个约束,我需要满足,而不是优化,而只是满足。
这两个限制是:
def calculate_fz_1(w_1, w_2):
social_sum, learning_sum = calculate_decisions(w_1, w_2, gamma_physical_social, gamma_physical_learning,
gamma_online_learning, gamma_online_social, Cost_Online,
Cost_Physical, bivariate_distribution, types_of_agents)
total_social = sum(social_sum)
total_learning = sum(learning_sum)
marginal_product_z1 = sum(social_sum) - w_1
return marginal_product_z1
和
def calculate_fz_2(w_1, w_2):
social_sum, learning_sum = calculate_decisions(w_1, w_2, gamma_physical_social, gamma_physical_learning,
gamma_online_learning, gamma_online_social, Cost_Online,
Cost_Physical, bivariate_distribution, types_of_agents)
marginal_product_z2 = sum(learning_sum) - w_2
return marginal_product_z2
并且这些约束必须等于零。
对我来说问题是,用于计算边际产品的两个变量本质上是非线性和离散的(变量社会和和学习总和实际上由几个离散的变量决定),所以我想我会无法使用scipy.optimise但我在堆栈上听说这可能与scipy这样做,这是真的吗?我会很感激!