小编Leo*_*ong的帖子

Google OR Tools 中 MIP 程序的非最佳结果

我当时正在开发一个示例 MIP 程序,该程序选择了男女混合运动队的首发阵容,并发现了一个在 Google OR 工具中得出非最佳结果的小示例。

基础知识:从 n>5 名玩家组成的团队中选择 5 名首发。至少两名首发必须是女性。被划伤的玩家无法启动。目标函数是初学者技能水平的简单总和。代码是:

import pandas as pd
from ortools.linear_solver import pywraplp

# %% Read the data from an external file
pname   = ["Tom", "Joe", "Bill", "Mike", "Frank", "Mary", "Sue", "JoAnn"]
skill   = [ 11.0,  13.0,   11.0,   12.0,    14.0,   10.0,  10.0,     7.0]
female  = [    0,     0,      0,      0,       0,      1,     1,       1]
scratch = [    0,     0,      0,      0,       1,      0,     0,       0]

# %% Create the mip solver with the SCIP …
Run Code Online (Sandbox Code Playgroud)

python linear-programming python-3.x or-tools mixed-integer-programming

4
推荐指数
1
解决办法
1991
查看次数