- 17 Sep, 2018 1 commit
-
-
Jason Rhinelander authored
-
- 29 Jun, 2018 1 commit
-
-
Jason Rhinelander authored
-
- 24 Nov, 2017 2 commits
-
-
Jason Rhinelander authored
This changes the `right` and `tolerance` argument into more complex objects that allow both a literal, or special objects returned by `search_right()`, `absolute_tolerance(.001)`, or `relative_tolerance(.1)`. This allows the much more descriptive syntax: constrained_maximum_search(f, 0, search_right(), relative_tolerance(.001)) This also reintroduces the ability to specify an absolute tolerance level, which was there once (as a separate argument) but got lost along the way. This commit also changes the `domain_t` argument to be no longer deduced. Previously it was deduced from `left`, which would have made the above example rather broken: `domain_t` would have been `int` (from the 0) rather than `double` (which would require 0.0). Overriding `domain_t` now requires an explicitly template parameter: constrained_maximum_search<float>(f, 0, search_right(), relative_tolerance(.001))
-
Jason Rhinelander authored
This allows readLock/writeLock to take any number of arguments, where each argument can be a container or a member. Previously you could pass a single container, or any number of members, but not combinations of both or multiple containers.
-
- 13 Nov, 2017 4 commits
-
-
Jason Rhinelander authored
This outputs something like `Member[n]` or `Firm[n]`, and can be overridden on a per-subclass basis. It also works for shared members and weak members.
-
Jason Rhinelander authored
No code changes: just removing extra class body indentation and comment rewrapping. Applies to: Member.hpp Good.hpp Market.hpp Firm.hpp There are still more left, but these in particular are changed in the subsequent commit.
-
Jason Rhinelander authored
Previously `eris::range(...)` only accepted a `std::pair` argument. This commit adds support for also accepting a code-wise pair (e.g. `eris::range(it1, it2)`).
-
Jason Rhinelander authored
- Specifying NaN for automatic `right` selection resulted in an infinite loop when `left` was 0. Changed to start searching at 1.0 when that occurs. - The `constrained_minimum_search` didn't implement automatic `right` selection; fixed. - Minor tweaks to calculation to avoid promotion to double; the main change was introducing a `half()` function to handle division by 2 without resorting to actual division for floating points while still working for non-floating point domain types. - Fixed a typo in the static_assert for a `bool` return type in `constrained_maximum_search`.
-
- 31 Oct, 2017 6 commits
-
-
Jason Rhinelander authored
`using namespace eris;` from within a namespace doesn't resolve the ambiguity for `time_t`/`id_t` -- they need an explicit symbol import, or full qualification.
-
Jason Rhinelander authored
-
Jason Rhinelander authored
The previous change to single_peak_search which deduced the domain type from the arguments was pretty undesirable: if you specified both left and right as integers, you'd get a search over the integer domain. This removes the type deduction, instead using an optional template parameter which defaults to double and isn't deduced, thus allowing custom types to be used, but falling back to double if not specified. This also fixes the test code to remove the tests that specified both relative and absolute tolerances (the latter was removed).
-
Jason Rhinelander authored
Using a `std::set` to sort is typically less efficient than building a vector then sorting it (once).
-
Jason Rhinelander authored
This lets external code use `eris::id_t` and `eris::time_t` which is far nicer than `eris::eris_id_t`. The existing `eris_id_t` and `eris_time_t` are kept as deprecated aliases for the new ones.
-
Jason Rhinelander authored
The operators weren't returning `*this`; this somehow magically worked properly under gcc; clang noticed and generated an illegal instruction.
-
- 28 Oct, 2017 2 commits
-
-
Jason Rhinelander authored
WeakMember<T> is a wrapper around `std::weak_ptr<T>`, with SharedMember<T> integration.
-
Jason Rhinelander authored
-
- 21 Aug, 2017 2 commits
-
-
Jason Rhinelander authored
This adds support for automatically finding `right` based on `left`: if `right` is given as NaN, a search starts at `2*left` (if `left` positive) or `-left` (if `left` negative) and continuously doubles the potential `right` value until a constraint-violating value is found; this then forms the RHS limit.
-
Jason Rhinelander authored
- std::pair was missing a load_from/store_to implementation - reimplemented std::pair support as std::tuple support, with std::pair being just a specialization of the tuple serializer. - De-protected load_from/store_to; they require friend classes all over the place because they aren't really "protected". - remove serializer.cpp in favour of just inlining its three small functions in the .hpp.
-
- 06 Aug, 2017 2 commits
-
-
Jason Rhinelander authored
This lets you numerically find the largest or smallest value satisfying some condition. For example, to determine the highest price that has at least `x` sales: auto quantity_demanded = [](double p) { return (int)(99 - 2*p); }; int x = 10; double min = 0.0, max = 100.0; auto r = eris::constrained_maximum_search( [&](double p) { return quantity_demanded(p) >= x; }, min, max, 0 /* maximum precision */); std::cout << std::setprecision(16) << "p = " << r.arg << "\n"; // p = 44.5 With less precision for `tol_rel` (e.g. the default, 1e-10) you'll generally get some number slightly smaller than 44.5.
-
Jason Rhinelander authored
This makes single_peak_search templated (so that it doesn't have to be implemented with double). It also updates the return type struct with templated types, a constructor, and an iterator counter.
-
- 22 Jun, 2017 1 commit
-
-
Jason Rhinelander authored
The first method MemberID arguments already accept shared members arguments.
-
- 21 Jun, 2017 1 commit
-
-
Jason Rhinelander authored
This significantly simplifies the member locking implementation since we no longer have to worry about tracking the number of active locks; instead read locks are shared locks and write locks are exclusive locks; the stl implementation can worry about the details beyond that. This also disallows recursive member locks; instead calling code has to manage itself to avoid double-locking a member. Note also that switching a write lock to a read lock is no longer guaranteed to be non-blocking as there is no way to downgrade an exclusive lock to a shared lock. boost::upgrade_mutex could allow this, but this importance of this is minor and it seems nicer to get rid of the boost dependency. It also changes the main Simulation run lock to be the same stl implementation; previously it was using the boost implementation. With that, the boost thread, date_time, and atomic library components are no longer required.
-
- 20 Jun, 2017 1 commit
-
-
Jason Rhinelander authored
Previously it was hard-coded to use `build`.
-
- 26 May, 2017 1 commit
-
-
Jason Rhinelander authored
Add a second parameter (priority) to the callback constructors and provide an override for the associated priority. This also simplifies the structure by moving the constructors and function/priority storage into a common base class. Everything also gets inlined as every method here is extremely simple.
-
- 24 May, 2017 1 commit
-
-
Jason Rhinelander authored
- and/or -> &&/|| - don't use 'using std::whatever' when 'whatever' is only used once or twice.
-
- 23 May, 2017 15 commits
-
-
Jason Rhinelander authored
- Suffix 'u' on numbers to avoid sign comparison warnings - id() == 0 no longer occurs when removed from a simulation
-
Jason Rhinelander authored
Replace `typename std::enable_if<...>::type` with `std::enable_if_t<...>` Replace various `typename = enable_if_t<...>` with `enable_if_t<..., int> = 0` which allows for better overloading.
-
Jason Rhinelander authored
Taking a MemberID allows SharedMember<T>s to be passed, which is no longer allowed now that the eris_id_t operator in SharedMember<T> is gone.
-
Jason Rhinelander authored
-
Jason Rhinelander authored
-
Jason Rhinelander authored
`a.transferTo(b)` is almost equivalent to `a.transfer(a, b)` except that `a` is also cleared (with just `transfer()`, `a` could end up with neglible amounts for negative quantities when `b` has nearly-identical positive quantities of the good).
-
Jason Rhinelander authored
Add a deprecated transferApprox() that forwards its arguments to transfer().
-
Jason Rhinelander authored
-
Jason Rhinelander authored
This makes it easier to write code that is conditionally fixed-size, such as std::pair<A, B> which is fixed iff both A and B are fixed, which is more easily determined via a constexpr than SFINAE on member existance.
-
Jason Rhinelander authored
This is technically more correct: C++ doesn't guarantee un-namespaced `size_t`
-
Jason Rhinelander authored
-
Jason Rhinelander authored
-
Jason Rhinelander authored
-
Jason Rhinelander authored
-
Jason Rhinelander authored
-