簡體   English   中英

是否可以在 python 中更改 cplex 的決策變量類型?

[英]Is possible to change the decision variable type for cplex in python?

(1) 當我在 python 中為 cplex 定義決策變量時,

x = np.empty((6,1), dtype= object)
for i in range(6):
    x[i] = mdl.integer_var(lb= 0, ub= inf, name='x' + str(i+1))

如何將 x 的決策變量類型從 integer_var 更改為 integer_var_list?

(2) 當我如下定義決策變量時。

x = mdl.integer_var_list(6, 0, inf, name='x')

x 的大小為 (6, )。 對於 (6,1) 的大小,如何將 x 定義為 integer_var_list ?

先感謝您。

使用 integer_var_matrix

示例在

對決策變量進行排序

permx = mdl.integer_var_matrix(r,r,name="xperm")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM