Minizinc 似乎生成无效的 FZ 代码
Minizinc seemingly generates invalid FZ code
我的模型有以下部分:
constraint forall(d in Day, s in Student)
(
let {
%groups in day
array[int] of var opt Group: gid = [g | g in assignment[s] where group_day[g] == d];
%groups starts in day
array[int] of var opt Time: gsid = [group_start[g] | g in gid];
%groups ends in day
array[int] of var opt Time: geid = [group_end[g] | g in gid];
%groups durations in day
array[int] of var opt Time: gdid = [group_duration[g] | g in gid];
var opt Time: min_start = min(gsid);
var opt Time: max_end = max(geid);
var opt Time: sum_dur = sum(gdid);
var opt int: time = ((max_end - min_start) - sum_dur);
} in
wasted_time_units[d,s] = deopt(time)
);
我一直试图通过从模型中删除 opt
数据类型,通过取消选择整个 gid
来让它工作,但这引发了 model inconsistency detected
错误。修复和取消 gid
数组有效,但 assignment
是一个变量,因此会产生无效输出。最后我到达了上面显示的模型,它通过了类型检查,但现在我收到了一个神秘的错误:
Error: Unknown character in line no. 1914
Error: Unknown character in line no. 1914
Error: Unknown character in line no. 1914
Error: syntax error, unexpected '(', expecting FZ_ID in line no. 1914
下面我附上了 FlatZinc 输出(行号在方括号中):
[1913] constraint int_lin_eq([1,1,1,-1],[X_INTRODUCED_894_,X_INTRODUCED_908_,X_INTRODUCED_922_,X_INTRODUCED_955_],0):: defines_var(X_INTRODUCED_955_);
[1914] constraint '-'(X_INTRODUCED_954_,X_INTRODUCED_952_,X_INTRODUCED_956_):: defines_var(X_INTRODUCED_956_);
[1915] constraint '-'(X_INTRODUCED_956_,X_INTRODUCED_955_,X_INTRODUCED_957_):: defines_var(X_INTRODUCED_957_);
[1916] constraint int_ne_reif(X_INTRODUCED_963_,0,X_INTRODUCED_962_):: defines_var(X_INTRODUCED_962_);
错误是什么意思,我该如何避免?似乎 minizinc 正在生成无效的 FZ 代码。
问题已通过修补 minizinc 解决。
问题已在此处处理:
https://github.com/MiniZinc/libminizinc/issues/588
编译开发分支后,问题消失!
我的模型有以下部分:
constraint forall(d in Day, s in Student)
(
let {
%groups in day
array[int] of var opt Group: gid = [g | g in assignment[s] where group_day[g] == d];
%groups starts in day
array[int] of var opt Time: gsid = [group_start[g] | g in gid];
%groups ends in day
array[int] of var opt Time: geid = [group_end[g] | g in gid];
%groups durations in day
array[int] of var opt Time: gdid = [group_duration[g] | g in gid];
var opt Time: min_start = min(gsid);
var opt Time: max_end = max(geid);
var opt Time: sum_dur = sum(gdid);
var opt int: time = ((max_end - min_start) - sum_dur);
} in
wasted_time_units[d,s] = deopt(time)
);
我一直试图通过从模型中删除 opt
数据类型,通过取消选择整个 gid
来让它工作,但这引发了 model inconsistency detected
错误。修复和取消 gid
数组有效,但 assignment
是一个变量,因此会产生无效输出。最后我到达了上面显示的模型,它通过了类型检查,但现在我收到了一个神秘的错误:
Error: Unknown character in line no. 1914
Error: Unknown character in line no. 1914
Error: Unknown character in line no. 1914
Error: syntax error, unexpected '(', expecting FZ_ID in line no. 1914
下面我附上了 FlatZinc 输出(行号在方括号中):
[1913] constraint int_lin_eq([1,1,1,-1],[X_INTRODUCED_894_,X_INTRODUCED_908_,X_INTRODUCED_922_,X_INTRODUCED_955_],0):: defines_var(X_INTRODUCED_955_);
[1914] constraint '-'(X_INTRODUCED_954_,X_INTRODUCED_952_,X_INTRODUCED_956_):: defines_var(X_INTRODUCED_956_);
[1915] constraint '-'(X_INTRODUCED_956_,X_INTRODUCED_955_,X_INTRODUCED_957_):: defines_var(X_INTRODUCED_957_);
[1916] constraint int_ne_reif(X_INTRODUCED_963_,0,X_INTRODUCED_962_):: defines_var(X_INTRODUCED_962_);
错误是什么意思,我该如何避免?似乎 minizinc 正在生成无效的 FZ 代码。
问题已通过修补 minizinc 解决。
问题已在此处处理: https://github.com/MiniZinc/libminizinc/issues/588
编译开发分支后,问题消失!