简体   繁体   English

纸浆 - LP Objective function 配方

[英]Pulp - LP Objective function formulation

I am working on solving a set covering problem for electric vehicle charging stations.我正在努力解决电动汽车充电站的集合覆盖问题。 My objective is to maximize the demand covered by the radius of a charging station.我的目标是最大化充电站半径所覆盖的需求。

I have two variables to make up the objective function. Yij denotes the demand location i is covered by the radius of charging station j.我有两个变量来组成目标 function。Yij 表示需求位置 i 被充电站 j 的半径覆盖。 Similarly, Xj denotes if charging station j is open.类似地,Xj 表示充电站 j 是否开放。

I am looking to create an objective function such as the following: Maximize OF = ((Y11 + Y21+ Y31 +.... Yn1) * X1) + ((Y12 + Y22+ Y32 +.... Yn2) * X2) +....我希望创建一个目标 function,如下所示: Maximize OF = ((Y11 + Y21+ Y31 +.... Yn1) * X1) + ((Y12 + Y22+ Y32 +.... Yn2) * X2) + ....

I tried the following, but am running into issues:我尝试了以下方法,但遇到了问题:

OptModel += lpSum(((Y[i,j] for i in range (I)) * X[j]) for j in range(J))

Any idea on how to formulate this?关于如何制定这个的任何想法?

It isn't clear from your description why Y is a variable?从您的描述中不清楚为什么Y是变量? It sounds like it should be a parameter (known value) if the demand location is within the radius of some source.... There must be some other nuance as to why this isn't known.如果需求位置在某个来源的半径范围内,听起来它应该是一个参数(已知值)......关于为什么这不知道,肯定还有一些其他的细微差别。 (If it can be calculated, do it and make it a parameter and your problem is solved.) (如果能算出来,算出来,做成参数,你的问题就解决了。)

The statement you propose is illegal because you are multiplying variables together and that makes the statement non-linear.您提出的陈述是非法的,因为您将变量相乘并且使陈述非线性。 You need to reformulate....你需要重新制定......

You have an implicit "and" condition in there in that you only want to receive credit if both Y and X are true, so you will need an additional variable or be clever in how you relate X and Y because you can't multiply them.你在那里有一个隐含的“和”条件,因为你只想在YX都为真时获得信用,所以你将需要一个额外的变量或者在你如何关联XY时要聪明,因为你不能将它们相乘.

Why don't you just add this constraint:你为什么不添加这个约束:

Y[i, j] <= X[j]    for each j

that would essentially change the meaning of Y to "in range of an operating charger".这将从根本上将Y的含义更改为“在工作充电器的范围内”。

Also realize if you sum up all of these Y vars (or as you appear to try to do in your objective) you will get double counting of any demand that can be charged from multiple stations--not sure if that is intent or not.还要意识到,如果您总结所有这些Y变量(或者正如您在目标中似乎尝试做的那样),您将重复计算可以从多个站点收取的任何需求——不确定这是否有意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM