[gecode-users] Freeze with MSVC 2015 optimized build

Filip Konvička filip.konvicka at logis.cz
Thu Sep 3 10:49:54 CEST 2015


Hi,

I'm having issues with the trunk version of Gecode compiled with MSVC 
2015 RTM. The "Release" build seems to get stuck on the attached simple 
test case. The "Debug" version of the same (configured with 
--enable-debug), as well as the official 4.4.0 distribution compiled 
with MSVC 2013 x64 seem to work without issue.

In the test case source code there is a constant "8686.9666660000003". 
Changing it to "8686" seems to fix the problem - but even "8686.9" makes 
dfs freeze.  It also seems that it is the branching strategy 
'FLOAT_VAL_SPLIT_MAX' that is causing problems.

I have built Gecode using my usual setup (the environment is set up for 
the "xp" compiler toolset) - in the 2015 x64 command prompt I run:

set "INCLUDE=%ProgramFiles(x86)%\Microsoft 
SDKs\Windows\7.1A\Include;%INCLUDE%"
set "PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;%PATH%"
set "LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib\x64;%LIB%"
set "CL=/D_USING_V110_SDK71_"
set "LINK=/SUBSYSTEM:CONSOLE,5.02"
C:\cygwin\cygwin
cd /cygdrive/c/build/gecode
./configure --disable-examples --disable-qt --disable-gist 
--disable-flatzinc --prefix=`pwd`/x64rel
make -j7 install

As you may notice I'm building without Gist so I could not easily check 
the progress of the search; as far as I could tell from the callstack 
there seems to be some kind of loop but I'm not sure how tight it is. 
I'm now trying to get Qt and build with it but so far I'm struggling 
with that (is there a howto on building with Qt on Windows?)

Thanks for any hints,
Filip

-------------- next part --------------
#pragma warning(push)
#pragma warning(disable : 4251 4355 4800)
#include <gecode/driver.hh>
#include <gecode/int.hh>
#include <gecode/minimodel.hh>
#pragma warning(pop)

//#include <gecode/gist.hh>

using namespace Gecode;

struct LayoutCalculator2 : public Space {
  double min_edge_width;
  double fit_to_width;

  IntVar      total_width;
  IntVar      scroll_area;

  IntVarArray start_times;
  IntVarArray widths;
  FloatVar    scaler;

  /// Constructor for cloning \a s
  LayoutCalculator2(bool share, LayoutCalculator2& s)
    : Space(share,s)
    , min_edge_width(s.min_edge_width)
    , fit_to_width(s.fit_to_width)
  {
    total_width.update(*this, share, s.total_width);
    scroll_area.update(*this, share, s.scroll_area);
    start_times.update(*this, share, s.start_times);
    widths.update(*this, share, s.widths);
    scaler.update(*this, share, s.scaler);
  }

  /// Copy during cloning
  virtual Space*
    copy(bool share) {
      return new LayoutCalculator2(share,*this);
  }

  /// Actual model
  LayoutCalculator2(double min_edge_width, double fit_to_width)
    : min_edge_width(min_edge_width)
    , fit_to_width(fit_to_width)
  {
    const int num_nodes = 2;
    total_width = IntVar(*this, 0, Gecode::Int::Limits::max);
    scroll_area = IntVar(*this, 0, Gecode::Int::Limits::max);
    start_times = IntVarArray(*this, num_nodes, 0, Gecode::Int::Limits::max);
    widths = IntVarArray(*this, num_nodes, 0, Gecode::Int::Limits::max);
    scaler = FloatVar(*this, 0, Gecode::Float::Limits::max);

    {
      FloatVar fl_width(*this, 0, Gecode::Float::Limits::max);
      rel(*this, max(FloatVal(228.),
                     8686.9666660000003
                     * scaler) <= fl_width);
      IntVar int_width(*this, 0, Gecode::Int::Limits::max);
      channel(*this, fl_width, int_width);
      rel(*this, int_width <= widths[0]);
    }
    {
      FloatVar fl_width(*this, 0, Gecode::Float::Limits::max);
      rel(*this, max(FloatVal(265.), 1. * scaler) <= fl_width);
      IntVar int_width(*this, 0, Gecode::Int::Limits::max);
      channel(*this, fl_width, int_width);
      rel(*this, int_width <= widths[0]);
      rel(*this, start_times[0] + widths[0] + (int)min_edge_width <= start_times[1]);
      rel(*this, start_times[1] + widths[1] <= total_width);
    }

    rel(*this, max(0, total_width - (int)fit_to_width) == scroll_area);

    // Minimize scroll area
    branch(*this, scroll_area, INT_VAL_MIN());
    // Maximize scaler
    //branch(*this, scaler, FLOAT_VAL_SPLIT_MAX());
    branch(*this, scaler, FLOAT_VAL_SPLIT_MAX());
    /*
    // Minimize total width (just assign)
    branch(*this, total_width, INT_VAL_MIN());
    // Maximize all start times (push right)
    branch(*this, start_times, INT_VAR_MAX_MIN(), INT_VAL_MAX());
    // Minimize widths
    branch(*this, widths, INT_VAR_MAX_MIN(), INT_VAL_SPLIT_MIN());
    */
  }
};


int main()
{
  LayoutCalculator2 init(50, 893);
  Gecode::Search::TimeStop t(1000);
  Gecode::Search::Options o;
  o.stop = &t;
  Gecode::dfs(&init, o);
  //Gist::dfs(&init);
  return 0;
}



More information about the users mailing list