gpt4 book ai didi

syntax-error - 如何索引ZIMPL中的子集集?

转载 作者:行者123 更新时间:2023-12-03 08:26:10 25 4
gpt4 key购买 nike

给定S作为一组子集,我想将其打印出来并建立索引:

set S[]:=subsets({1..5}, 3); 
do forall <i> in S do print S[i];

# Neither does the following work:

do print S;

我收到以下错误:
Reading debug.zpl
*** Error 142: Unknown index <> for symbol "S"
*** File: debug.zpl Line 2
*** do forall <i> in S do print S[i];
*** ^^^

如何索引子集集?

最佳答案

do forall <i> in indexset(S) do print S[i];

应该做。

关于syntax-error - 如何索引ZIMPL中的子集集?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55782264/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com