Use proper cmake flag setting; add debug flags

add_definitions() is only intended for -D... flags, not things like
-std=c++11 and -Wall: changed them to use CMAKE_CXX_FLAGS instead.

Added debug compilation, via cmake -DCMAKE_BUILD_TYPE=Debug.  Actually,
this was here already from cmake, but the above change (which adds -O3)
requires adding a -O0 for the debug build.
Fixed various warnings from new -Wextra flag.
Improved comments
Added generic Factory interface.

This is pretty simple, but quite useful: it lets you set up a "factory"
intended to create or destroy simulation members between periods.  For
example, having firms enter and exit the market depending on profit
conditions.

This class is really simple: it's just a wrapper around interOptimize
and interApply, mapping those into other method.  Still, it provides a
more intuitive "factory" interface.