1. 04 Mar, 2014 5 commits
    • Jason Rhinelander's avatar
      Removed -Werror, added -DERIS_TESTS · cc2c8cb9
      Jason Rhinelander authored
    • Jason Rhinelander's avatar
      Make Simulation() constructor protected · 880951f7
      Jason Rhinelander authored
      Simulation *must* be accessed via Eris<Simulation> because we need
      Eris<Simulation> to hold the first shared_ptr to the Simulation
      (shared_from_self only works propertly if there is at least one
      shared_ptr active).
    • Jason Rhinelander's avatar
      Make rwLock_ bool a const ref · 3f19ba8f
      Jason Rhinelander authored
    • Jason Rhinelander's avatar
      Member readLock/writeLock code reduction · 3234d56c
      Jason Rhinelander authored
      Added rwLock_ helper method, reducing the bulk of readLock/writeLock
      code from 4 to 2 methods.
    • Jason Rhinelander's avatar
      Locking fixes for non-simulation members · 72f5c71f
      Jason Rhinelander authored
      Market reservations were causing weird errors in test code: whenever an
      exception got thrown that resulted in a Reservation and market being
      destroyed, a no_simulation_error() got triggered because the
      reservation was trying to cancel itself, which led to something trying
      to get a writeLock(), which in turn called maxThreads() which needs a
      simulation().  Even without maxThreads() there's a problem, though,
      because sharedSelf() won't work without a simulation, either.
      Fixed this by making the locking code not try to lock when the caller
      is not in a simulation.  This probably won't cause issues because it
      seems only likely to happen when the caller is being destroyed or about
      to be destroyed.
      A related change: got rid of the zero-argument writeLock() and
      readLock() methods from Member.cpp: they can be handled just as well
      with the varargs version in Member.hpp, resulting in less code
      duplication.  (There were three versions each of writeLock and
      readLock(), now down to two).
  2. 03 Mar, 2014 8 commits
  3. 21 Feb, 2014 1 commit
  4. 20 Feb, 2014 10 commits
    • Jason Rhinelander's avatar
      QMarket optimization overhaul; Stepper oscillation · 51816949
      Jason Rhinelander authored
      - pricing retries now has a "first" tries and a regular retries.  The
        first one typically needs more iterations because the initial value
        is arbitrary, while later ones have a decent first guess in the
        previous period's value.
      - Removed obsolete 'optimizer' variable (made obsolete when
        optimization moved into QMarket itself in the eris optimizer design
      - The Stepper used for adjusting the price is now public, so that its
        properties can be changed by the QMarket creator.
      - The default Stepper now has a minimum step size of 1/65536.  The
        previous minimum of machine epsilon was rediculously small (and
        required a lot of steps to get away from).
      - Stepper now has a variable for checking whether the steps are
        oscillating back and forth at the minimum step size.
      - QMarket uses oscillation detecting to detect that the price is close
        enough to the optimum and thus more price adjustments aren't needed.
      - Various previously-const public attributes of Stepper are now
        non-const so that Stepper users can change the Stepper behaviour.
        This makes Stepper-using classes (like QMarket) easier: they can just
        expose the Stepper instead of needing to pass through a bunch of
        construction-time Stepper parameters.
    • Jason Rhinelander's avatar
      Don't bother with superclass just to reset assets · 2b536871
      Jason Rhinelander authored
      Just reset assets ourselves.  Calling FirmNoProd's method to do that is
      sort of pointless, since it's unlikely FirmNoProd is every going to do
      anything else.
    • Jason Rhinelander's avatar
    • Jason Rhinelander's avatar
      Comments: added search helpers for macro methods · 82151330
      Jason Rhinelander authored
      agent(), agents(), good(), goods(), etc. along with insert* and remove*
      are macro-generated, and so searching for 'insertAgent(' returned
      nothing: fixed that (sort of) by adding the names of the macro-generated
      functions to a comment.
    • Jason Rhinelander's avatar
      Simulation no longer #includes Member.hpp · ede946b6
      Jason Rhinelander authored
      It seems the Simulation<->Member header codependency doesn't exist
      anymore, so we can get rid of the nasty include-halfway-down-the-file
      mess.  I'm not sure when this went away, but just using
      forward-declarations of Member/Agent/Good/Market is enough for
      Simulation now.
    • Jason Rhinelander's avatar
      Forward-declare Simulation · e58bc618
      Jason Rhinelander authored
      SharedMember doesn't #include Simulation, but references it (declaring
      it a friend of SharedMember).  Thus attempting to #include SharedMember
      without Simulation being included elsewhere would be an error.  This
      fixes that.
    • Jason Rhinelander's avatar
      Member.simulation() now throws when not in a sim. · c3918891
      Jason Rhinelander authored
      Previously simulation() returned a null shared_ptr when the member
      didn't belong to a simulation.  The new behaviour throws an exception.
      To check whether the member has a simulation, one can now call the new
      hasSimulation() method.
    • Jason Rhinelander's avatar
      Market: added public, read-only firms() method · f5b5e0ab
      Jason Rhinelander authored
      This allows outside members to observe the firms belonging to a market.
    • Jason Rhinelander's avatar
      Added DEBUG, DEBUGF, and DEBUGVAR macros · c128b8aa
      Jason Rhinelander authored
      These live in eris/debug.hpp, which is included by eris/Simulation.hpp.
      When compiled with -DERIS_DEBUG, these produce output (prefixed by
      filename/line number/function).
      DEBUG spits out anything that can be left shifted onto std::cerr
      (DEBUG(a << b) becomes std::cerr << a << b)
      DEBUGF is a wrapper around fprintf(stderr, ...)
      DEBUGVAR(whatever) gives a (prefixed) message of "whatever = ...".
      (Note that whatever need not be a variable, despite the macro name:
      DEBUGVAR(the_answer()) would yield an output line containing
      "the_answer() = 42"
      -DERIS_DEBUG is now added to compilation flags automatically when doing
      a debug build.
    • Jason Rhinelander's avatar
      Added weak dependencies. · 38f31266
      Jason Rhinelander authored
      Weak dependencies work like hard dependencies, except that instead of
      triggering simulation removal when a dependency is removed it triggers
      a (new) member.weakDepRemoved(removed_id) call.  This is particularly
      useful for Markets, which have a list of firms, as the firms should be
      removed from any Market it belongs to when being removed.  Handling
      this elsewhere was pointlessly tedious: Market now declares a weak dep
      on the firm when adding a firm, and removes the firm its list of firms
      if the firm gets removed from the simulation.
  5. 12 Feb, 2014 4 commits
    • Jason Rhinelander's avatar
      Added generic Factory interface. · 26afe45a
      Jason Rhinelander authored
      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
      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.
    • Jason Rhinelander's avatar
      Improved comments · b57cfbf7
      Jason Rhinelander authored
    • Jason Rhinelander's avatar
    • Jason Rhinelander's avatar
      Use proper cmake flag setting; add debug flags · 944649ea
      Jason Rhinelander authored
      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.
  6. 11 Feb, 2014 9 commits
  7. 03 Feb, 2014 3 commits
    • Jason Rhinelander's avatar
      Fixed negativity error exceptions from MUPD change · e0292d32
      Jason Rhinelander authored
      Cancelling a reservation (which new MUPD code does sometimes) was not
      quite working because the tolerance was too low and thus negativity
      errors would result.  This was supposed to be handled in the Firm
      already--and indeed it was within transfer(), which used transferApprox
      with its own epsilon, but release() wasn't passing epsilon and was
      getting Bundle's default (1e-13) instead of the desired 1e-10.
    • Jason Rhinelander's avatar
      InterStepper: when jumping, reduce step size · 7c4bf230
      Jason Rhinelander authored
      Typically a jump happens because the last step was too big and overshot
      whatever we were aiming for, so reduce step size when jumping to
      hopefully get back on track.
    • Jason Rhinelander's avatar
      QFStepper steps every 3 periods · f8c07c33
      Jason Rhinelander authored
      Every period was pretty messy--every 3 seems to do better