minizinc

    0熱度

    1回答

    我想在運行時用Java解決具有動態參數的模型。我有我的問題寫在MiniZinc。 mzn2fzn model.mzn model_data.dzn (this produces model.fzn file) fzn-gecode model.fzn (actually solves the model) 基本上有2個步驟,首先我需要模型編譯minizinc成flatzinc格式,而供給該數

    1熱度

    1回答

    我在不同的地方看到了「dot-dot」符號(..)。在以下示例中,0..n告訴我們決策變量的域(在這種情況下,是數組s的條目)。 int: n; array[0..n-1] of var 0..n: s; 另一個例子是在for循環: constraint forall(i in 0..sequence_length)( t[i] = sum(k in 0..sequence_leng

    1熱度

    1回答

    列給定的矩陣Z [N,M]: 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 我想檢查多少個「1」,也有在不同的列的矩陣。因此,在這種情況下給定k = 1,問題應該是不可滿足的,因爲在列中有2個「1」,所以「數目1」> k。我試過這種方式,但它不起作用: constraint forall(i in n, j in m) forall

    1熱度

    1回答

    我有一個關於Minizinc的語法的簡單問題。我的.dzn文件輸入包含一組2門維陣列(約高達30陣列),聲明如下: rates_index_0 = array2d(1..3, 1..501, [ 15, 20, 23, .... rates_index_12 = array2d(1..3, 1..501, [ 21, 24, 27, .... ... 注:索引號中都有間隙(例如,12 -

    0熱度

    1回答

    我有一個需要限制一個變種float數組中的每個元素的模型被AllDifferent屬性 不等於約束我試圖用全球AllDifferent屬性全局約束,但我得到以下錯誤: MiniZinc: type error: no function or predicate with this signature found: `alldifferent(array[int] of var float)'

    1熱度

    1回答

    問題是要找到一些時間表,讓一些人以固定大小的羣體打高爾夫球(或其他)。 我們必須保證每個玩家一次只能在一個組中。 這裏是我的代碼: int: gr; % number of groups int: sz; % size of groups int: we; % number of weeks int: n=gr*sz; % number of players set

    0熱度

    1回答

    我有一個數組:array[backpacks] of int: capacity指定每個揹包的容量。 現在我想創建一個約束求解器必須滿足的變量數組。我希望每個變量在域1..capacity中取值,其中容量對應於上述數組中指定的值。 會是這樣的工作:array[backpacks] of var capacity: bagcaps? 還是我必須做的是這樣:array[backpacks] of va

    0熱度

    1回答

    我試圖在單個mzn文件所施加的結構如下: define Variables; %% first set of constraints constraint ...; constraint ...; solve satisfy; %% second set of constraints constraint ...; constraint ...; solve satisfy;

    1熱度

    1回答

    我試圖將教程的澳大利亞程序轉換爲使用數組。 我有麻煩與輸出,即: % Coloring Australia using nc colors int: nc = 3; % number of colors int: ns = 7; % number of states array[1..nc] of string: colors = ["red", "green", "blue"]; a

    0熱度

    1回答

    我有n個作業和m個機器,並且具有作業類型的作業類型數組。如果作業是作業類型數組中的特定類型,則必須將偶數編號的機器分配給奇數編號的機器。 minizinc可能嗎? 摘錄我試過如下: forall(w in 1..num_workers) ( if jobtype[job] == "NC" then assignment[job,(w mod 2 ==0)]=1 else assi