MODEL.setObjective(gurobipy.quicksum((x[i,j,c] * self.C1 * (max(0,t[j,c] - self.DueDate[j])) File src\gurobipy\linexpr.pxi:444 in gurobipy.LinExpr.__richcmp__ NotImplementedError
时间: 2023-06-20 20:06:14 浏览: 110
这 error 有可能是由于使用了 gurobipy 的版本不兼容所导致的。你可以尝试升级 gurobipy 的版本或者更改代码中的语法来解决这个问题。
此外,如果你在使用 gurobipy 运行优化模型时遇到问题,建议你检查输入数据是否正确以及模型是否符合要求。也建议你在 gurobi 官网或者社区中寻求帮助。
相关问题
MODEL.setObjective(gurobipy.quicksum((x[i,j,c] * self.C1 * gurobipy.quicksum(gurobipy.max_(0,t[j,c] - self.DueDate[j])) File src\gurobipy\gurobi.pxi:3631 in gurobipy.quicksum TypeError: 'GenExprMax' object is not iterable
这错误提示是因为在你的代码中使用了 `gurobipy.max_()` 这个函数,它返回的是一个 `GenExprMax` 对象,而不是一个可迭代的对象。因此在调用 `gurobipy.quicksum()` 函数时就会抛出这个错误。
你需要将 `gurobipy.max_()` 函数替换为一个可以迭代的函数,例如 `gurobipy.max_(0,t[j,c] - self.DueDate[j])` 可以替换为 `max(0, t[j,c] - self.DueDate[j])`。这样就可以避免这个错误。
MODEL.setObjective(gurobipy.quicksum((x[i,j,c] * self.C1 * (gurobipy.max(0,t[j,c] - self.DueDate[j])) AttributeError: module 'gurobipy' has no attribute 'max'
这 error 的原因可能是因为 gurobipy 模块中没有名为 max 的函数。可能是您想要使用 Python 内置的 max 函数,而不是 gurobipy 模块中的函数。您可以尝试将 "gurobipy.max" 更改为 "max",以调用 Python 内置的 max 函数。如果您需要使用 gurobipy 模块中的 max 函数,请查看 gurobipy 文档以了解如何正确使用它。
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044833.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)