本文主要是介绍GUROBI实战案例(五)——排产排程(1),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
排产排程【系列】 (aliyun.com)
import gurobipy as gb
from gurobipy import *# parametersprofit = {"Bands": 25,"Coils": 30,"Plate": 29
}rate = {"Bands": 1/200,"Coils": 1/140,"Plate": 1/160
}
max_work_time = 40
# model
model = gb.Model()
# decision var
product = profit.keys()
x = model.addVars(product, lb = [1000, 500, 750], ub = [6000, 4000, 3500], name = "x_num")
# constraints
# time constraints
model.addConstr(x.prod(rate) <= max_work_time, name = "time constrains")
# obj
model.setObjective(x.prod(profit), GRB.MAXIMIZE)
model.optimize()
这篇关于GUROBI实战案例(五)——排产排程(1)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!