Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with output of var-array for sol() call in MiniSearch #4

Open
Alexander-Schiendorfer opened this issue Jan 17, 2016 · 1 comment

Comments

@Alexander-Schiendorfer
Copy link

When running LNS, it seems that an array of var int isn't correctly sent to the output model.

This refers to the feature/minisearch branch at commit MiniZinc/libminizinc@18a7cb2

When trying to run the following minimal LNS,

include "minisearch.mzn";
array[1..2] of var 0..10: xs;
constraint xs[2] <= 8;

var 0..18: obj;

constraint obj = xs[1] + xs[2];

constraint xs[1] < xs[2];

output["XS = \(xs), obj = \(obj)"];

solve 

search lns_max(obj, xs, 5, 0.5) 
/\ if hasSol() then print() 
   else print("No solution found\n") 
   endif;

I get the error

MiniZinc: evaluation error: could not find solution for unknown identifier: X_INTRODUCED_0

where X_INTRODUCED_0 isxs[1], according to the compiled FlatZinc.

However, substituting the IntVar-Array by individual identifiers works:

include "minisearch.mzn";
var 0..10: x;
var 0..8: y; 
var 0..18: obj;

constraint obj = x + y;

constraint x < y;

output["x = \(x), y = \(y), obj = \(obj)"];

solve 

search lns_max(obj, [x,y], 5, 0.5) 
        /\ if hasSol() then print() 
           else print("No solution found\n") 
       endif;

The problem is not prevalent in commit 218a0cf .

I found that the error is output in line 2108 of builtins.cpp. I could not localize the bug further, though.

Cheers,
Alex

@Alexander-Schiendorfer
Copy link
Author

This should basically fix it :

MiniZinc/libminizinc#78

@Dekker1 Dekker1 transferred this issue from MiniZinc/libminizinc Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant