组合优化算法问题

huangapple go评论64阅读模式
英文:

Combinatorial Optimization Algorithm Problem

问题

我需要找到最佳的组合,以适应连接到PLC的一堆IO模块的问题。每个PLC都需要选择一种模拟和数字输入输出的组合,而可用的IO模块有不同的模拟和数字输入输出组合,可以连接到PLC以选择它们。我正在寻找一种算法,该算法将考虑所需的IO数量,然后对各种可用选项进行排序,以输出最佳的模块组合(甚至只是可能的模块组合),然后根据每个模块的价格进行排序。

例如:

面板1需要连接以下IO:

  • 数字输入 - 73
  • 数字输出 - 20
  • 模拟输入 - 37
  • 模拟输出 - 19

我可以选择的模块可能是:

  • 8个数字输入
  • 4个模拟输入4个模拟输出
  • 4个数字输入4个数字输出
  • 24个数字输入
  • 8个模拟输入12个数字输入12个数字输出6个模拟输出
  • 5个模拟输入5个数字输入4个数字输出4个模拟输出

我认为这可能类似于切割库存问题,但我一筹莫展,不确定我是否正在陷入困境。

对任何建议都将不胜感激。

我尝试过各种二维和三维切割库存算法,但没有得到最佳输出。

英文:

I have a problem whereby i need to find the optimum combination for a bunch of IO modules attached to a PLC. Each PLC will have a combination of analogue and digital inputs and outputs that it requires to pick up and there are different IO modules available with different combinations of analogue and digital inputs and outputs that I can attach to the PLC to pick them up. I was looking for an algorithm that would take the required IO count and then sorts through the various options available to output the optimum combinations of modules (or even just the possible combinations of modules) and then sort it via price of each one.

For example:

Panel 1 requires the following IO to be attached to it:

  • Digital Inputs - 73
  • Digital Outputs - 20
  • Analogue Inputs - 37
  • Analogue Outputs - 19

and the modules I can choose from might be:

  • 8 Digital Input
  • 4 Analogue Input 4 analogue output
  • 4 Digital Input 4 Digital Output
  • 24 Digital Input
  • 8 Analogue inputs 12 Digital Inputs 12 digital Outputs 6 Analogue outputs
  • 5 Analogue inputs 5 Digital Inputs 4 digital Outputs 4 Analogue outputs

I thought this might be something like the cutting stock problem however i have drawn a blank and i am not sure if i am going down a rabbit hole.

Any suggestions would be appreciated.

I have tried a variation of 2 and 3 dimensional cutting stock algorithms however it doesn't give an optimum output

答案1

得分: 1

你可以将你的约束条件写成一组线性不等式:

D_i: 8M_1 + 4M_3 + 24M_4 + 12M_5 + 5M_6 >= 73
D_o: 4
M_3 + 12M_5 + 4M_6 >= 20
A_i: 4M_2 + 8M_5 + 5M_6 >= 37
A_o: 4
M_2 + 6M_5 + 4M_6 >= 19

M_i 是类型 i 的模块数量。

优化目标是最小化模块成本之和:

Cost = P_1M_1 + P_2M_2 + P_3M3 + P_4M_4 + P_5M_5 + P_6M_6

P_i 是每个模块 i 的成本。

这一不等式系统连同目标函数可以通过专门的整数线性规划求解器(如CBC)来解决。但其他通用约束编程求解器,如z3pyMiniZinc,也能够解决这种系统。

英文:

You could write your constraints as a set of linear inequations:

D_i: 8*M_1         + 4*M_3 + 24*M_4 + 12*M_5 + 5*M_6 >= 73
D_o:                 4*M_3          + 12*M_5 + 4*M_6 >= 20
A_i:         4*M_2                  +  8*M_5 + 5*M_6 >= 37
A_o:         4*M_2                  +  6*M_5 + 4*M_6 >= 19

M_i is the number of modules of type i.

The optimization strives to minimize the sum of module costs:

Cost = P_1*M_1 + P_2*M_2 + P_3*M3 + P_4*M_4 + P_5*M_5 + P_6*M_6

P_i is the cost per module i

This system of ineqations together with the objective function can be solved by a designated integer linear programming solver like CBC. But other general purpose constraint programming solvers like z3py or MiniZinc are also capable of solving such systems.

huangapple
  • 本文由 发表于 2023年6月12日 18:22:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/76455695.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定