- 
                Notifications
    You must be signed in to change notification settings 
- Fork 81
Open
Description
Describe the bug
The function uniform_on_restart doesn't return the upper bound value in the runtime, which is expected to return a random number x between lower and upper (lower <= x <= upper, but the actual result is lower <= x < upper.
This is happened becasue Rnd _random input domain is [lower_bound, upper_bound) and + 1 to correct set to [lower_bound, upper_bound], and it is effect to uniform_on_restart constraints. Which can be found in this PR #207
To Reproduce
Run these MiniZinc model with -restart constant and -restart-scale 5
include "experimental/on_restart.mzn";
var 1..3: nbh_size ::output = uniform_on_restart(1..3);
---
nbh_size = 1;
% time elapsed: 67msec
----------
nbh_size = 2;
% time elapsed: 73msec
----------include "experimental/on_restart.mzn";
var 1..3: nbh_size ::output = uniform_on_restart(1, 3);
---
nbh_size = 1;
% time elapsed: 67msec
----------
nbh_size = 2;
% time elapsed: 73msec
----------The work around:
include "experimental/on_restart.mzn";
var 1..3: nbh_size ::output = uniform_on_restart(1, 4);
nbh_size3 = 2;
% time elapsed: 59msec
----------
nbh_size3 = 1;
% time elapsed: 65msec
----------
nbh_size3 = 3;
% time elapsed: 66msec
----------Gecode and Platform Configuration
Gecode 6.3.0 on MacOS Tahoe 26.0.1
Metadata
Metadata
Assignees
Labels
No labels