Mercury Bugs - mercury | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0000315 | mercury | Bug | public | 2014-01-31 14:01 | 2014-02-01 05:47 |
Reporter | lpimmes | ||||
---|---|---|---|---|---|
Assigned To | |||||
Priority | high | Severity | major | Reproducibility | always |
Status | new | Resolution | open | ||
Platform | OS | OSx | OS Version | 10.9.1 | |
Product Version | |||||
Target Version | Fixed in Version | ||||
Summary | 0000315: Software Error: detected need for minimal model in pred rodcut.r_n/3 | ||||
Description | In another program :- pragma memo(fib/3). works OK here, but mode is det. Trying memo on mode is multi. Comment out memo on two pred, output runs and is correct. Uncomment memo and we get Software Error: detected need for minimal model in pred rodcut.r_n/3 Not sure how to create det function, because I need to make decision for base and recursive cases, i.e., multiple output. rodcut will be very slow for larger values of N, which is why I want memoization. See listing attached file. Thanks. | ||||
Steps To Reproduce | Partial listing: ... % Implement rn, bottom of page 362 Dynamic programming, Cormen text. % Should be implementing 15.2 rn = max (p_i + r_n-i) % 1 <= i <= n, r0=0 %%%% Cannot use multi mode on functions, use pred, and declare main to be cc_multi. :- pred r_n(int, array(int), int). :- mode r_n(in, in, out) is multi. %:- pragma memo(r_n/3). r_n(1, P, Mx) :- Mx = getRevenue(1, P). r_n(N, P, Mx) :- r_nAux(getRevenue(N, P), 1, N-1, P, Mx). :- pred r_nAux(int, int, int, array(int), int). :- mode r_nAux(in, in, in, in, out) is multi. %:- pragma memo(r_nAux/5). r_nAux(Mx, LowIndx, HighIndx, P, Max) :- ( if LowIndx > HighIndx then Max = Mx else r_n(LowIndx, P, Lw), r_n(HighIndx, P, Hg), NewMax = int.max(Mx, Lw + Hg), r_nAux(NewMax, LowIndx + 1, HighIndx -1, P, Max) ). ... | ||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | rodcut.m (3,694) 2014-01-31 14:01 https://bugs.mercurylang.org/file_download.php?file_id=197&type=bug bug315.m (570) 2014-01-31 15:15 https://bugs.mercurylang.org/file_download.php?file_id=198&type=bug rodcut2.m (2,654) 2014-01-31 15:15 https://bugs.mercurylang.org/file_download.php?file_id=199&type=bug |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
Issue History | |||||
Date Modified | Username | Field | Change | ||
---|---|---|---|---|---|
2014-01-31 14:01 | lpimmes | New Issue | |||
2014-01-31 14:01 | lpimmes | File Added: rodcut.m | |||
2014-01-31 15:15 | zs | File Added: bug315.m | |||
2014-01-31 15:15 | zs | File Added: rodcut2.m | |||
2014-01-31 15:20 | zs | Note Added: 0000636 | |||
2014-02-01 05:47 | lpimmes | Note Added: 0000637 |