Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ foreach(i RANGE ${length})
set(CONFIG_OUT "${CONFIG_OUT}${line}")
endforeach()

file(WRITE ${GECODE_BINARY_DIR}/gecode/support/config.hpp
file(CONFIGURE OUTPUT "${GECODE_BINARY_DIR}/gecode/support/config.hpp" CONTENT
"/* gecode/support/config.hpp. Generated from config.hpp.in by configure. */
/* gecode/support/config.hpp.in. Generated from configure.ac by autoheader. */

Expand Down
30 changes: 30 additions & 0 deletions changelog.in
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,36 @@ Fix float power and nth-root tests with shared variables by
initializing their exponent fields and rejecting nth-root test
assignments whose source interval is not fully non-negative.

[ENTRY]
Module: flatzinc
What: bug
Rank: minor
Issue: 207
Thanks: Nathan Tran
[DESCRIPTION]
Include the upper endpoint when generating FlatZinc on_restart
uniform integer and float values.

[ENTRY]
Module: other
What: change
Rank: minor
Issue: 203
Thanks: Bruce Mitchener
[DESCRIPTION]
Avoid rewriting the generated CMake config.hpp file when its
contents have not changed.

[ENTRY]
Module: search
What: bug
Rank: minor
Issue: 150
Thanks: Stefan Brüns
[DESCRIPTION]
Send CPProfiler's DONE message before disconnecting from the
profiler socket.

[ENTRY]
Module: other
What: change
Expand Down
15 changes: 13 additions & 2 deletions gecode/flatzinc/flatzinc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
*
* Contributing authors:
* Gabriel Hjort Blindell <gabriel.hjort.blindell@gmail.com>
* Nathan Tran <kieron.qtran@gmail.com>
*
* Copyright:
* Guido Tack, 2007-2012
* Gabriel Hjort Blindell, 2012
* Nathan Tran, 2025
*
* This file is part of Gecode, the generic constraint
* development environment:
Expand Down Expand Up @@ -2040,7 +2042,13 @@ namespace Gecode { namespace FlatZinc {
// Assign uniform_int random values
for (size_t i = 0; i < restart_data().uniform_range_int.size(); ++i) {
const auto& range = restart_data().uniform_range_int[i];
const int rndVal = range.first + _random(static_cast<unsigned int>(range.second - range.first));
const unsigned long long int width =
static_cast<unsigned long long int>(
static_cast<long long int>(range.second) -
static_cast<long long int>(range.first)) + 1ULL;
const int rndVal =
static_cast<int>(static_cast<long long int>(range.first) +
static_cast<long long int>(_random(width)));
rel(*this, on_restart_iv[base + i], IRT_EQ, rndVal);
}
base += restart_data().uniform_range_int.size();
Expand Down Expand Up @@ -2164,7 +2172,10 @@ namespace Gecode { namespace FlatZinc {
for (size_t i = 0; i < restart_data().uniform_range_float.size(); ++i) {
const auto& range = restart_data().uniform_range_float[i];
/* rndVal will be an element of [range.first, range.second] */
const FloatVal rndVal = (static_cast<FloatVal>(_random(INT_MAX)) / INT_MAX)*(range.second - range.first) + range.first;
const FloatVal rndVal =
(static_cast<FloatVal>(_random(INT_MAX)) /
static_cast<FloatVal>(INT_MAX - 1)) *
(range.second - range.first) + range.first;
rel(*this, on_restart_fv[base + i], FRT_EQ, rndVal);
}
base += restart_data().uniform_range_float.size();
Expand Down
Loading
Loading