libminizinc icon indicating copy to clipboard operation
libminizinc copied to clipboard

Unexpected Absent Literal - Works in 2.8.7 (Windows) -> Not on 2.9.0

Open lloy0076 opened this issue 10 months ago • 5 comments

Flattening ...
	CompilePass: Flatten with 'C:\Program Files\MiniZinc\share\minizinc\cp-sat' library ...
MiniZinc has encountered an internal error. This is a bug.
Please file a bug report using the MiniZinc bug tracker.
The internal error message was: 
"unexpected absent literal"
Process finished with non-zero exit code 1.
Finished in 381msec.

I am literally doing precisely what it asks me to.

Given the completely unhelpful error I cannot tell what is wrong at all.

lloy0076 avatar Feb 11 '25 12:02 lloy0076

https://github.com/MiniZinc/libminizinc/blob/4828881fdad5c5972826616d13836be3a1d1d558/lib/eval_par.cpp#L308

This seems to be the only time the code complains about "unexpected absent literal".

lloy0076 avatar Feb 11 '25 17:02 lloy0076

% var int: total_preference = sum(s in student_set where assignment[s] > 0 /\ assignment[s] != num_projects) (
   let {
     var int: p = assignment[s];
     var opt int: score = someStudents[s].prefs[p].2; % THIS LINE CAUSES THE ERROR
   } in
        weightedScores[s, p]
 );

This is a row from someStudents. The prefs would be the prefs. It was the above that is causing the error.

ignore the fact that score is not used, by the way; that is a bug that I've only just seen

(id: 257, name: "5_Ron 5_Russel", current: <>, prefs: [(42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (18, 1, 50, 259), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (24, 4, 68, 257), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (32, 2, 90, 260), (33, 3, 93, 258), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>), (42, 5, <>, <>)])

lloy0076 avatar Feb 11 '25 17:02 lloy0076

Hmm.

var int: total_preference = sum(s in student_set where assignment[s] > 0 /\ assignment[s] != num_projects) (
  let {
    var int: p = assignment[s];
    PreferencesArray: a = someStudents[s].prefs;
    var opt int: score = someStudents[fix(s)].prefs[p].2
  } in
       weightedScores[s, p]
);

I think it's throwing the error because p is not fixed. If I do fix(p) I will get a "unexpected absent literal" error. This makes sense but I thought the newer compiler's picked up unfixed or broken arrays? Maybe they don't.

lloy0076 avatar Feb 11 '25 18:02 lloy0076

Hi, thanks for the bug report.

If you can't attach you're whole model/data here publicly, could you send your model and a data file where this happens to jason [at] minizinc.dev?

We'll have a look in the future at making that internal error report a location when possible to make it easier to narrow down a minimal reproduction or workaround.

cyderize avatar Feb 13 '25 00:02 cyderize

I am working on making a reproduction; sorry for the delay.

lloy0076 avatar Feb 18 '25 17:02 lloy0076