Commit 34e4c67f authored by Jason Rhinelander's avatar Jason Rhinelander

Add missing default constructors to Firm/FirmNoProd

parent e743f3ce
......@@ -15,7 +15,9 @@ void bind_firm(py::module &m) {
.def("release", &Firm::Reservation::release, "Aborts a firm-level reservation; no transfer takes place, and the firm reserved assets and/or production are updated")
firm.def("can_supply", &Firm::canSupply, "bundle"_a, "Returns True if the firm can supply the given bundle; the default implementation simply returns True if can_supply_any() >= 1.0")
.def("can_supply", &Firm::canSupply, "bundle"_a, "Returns True if the firm can supply the given bundle; the default implementation simply returns True if can_supply_any() >= 1.0")
.def("can_supply_any", &Firm::canSupplyAny, "bundle"_a, "Returns a floating point value indicating the fraction of the requested bundle that the firm is able to supply. The default considers both the firm's on-hand assets and the result of the _can_produce_any method. Returns a value >= 1 if the firm can supply the entire bundle. Subclasses may return a value of 1.0 even if larger multiples can be supplied")
.def("supplies", &Firm::supplies, "bundle"_a, "This is essentially the same as calling `can_supply_any() > 0`, but is more efficient when the precise supply multiple is not needed")
.def("reserve", &Firm::reserve, "reserve"_a, "Reserves the given quantities to be later transferred from the firm (or to the firm, for negative quantities) by a call of transfer() on the returned object, or aborted by a call of release(). If the firm can supply some or all of the bundle from its on-hand assets, it is removed and placed in a special reserved assets bundle; the remainder is reserved by an internal call to the firm's _produce method.")
......@@ -38,6 +40,7 @@ void bind_firm(py::module &m) {
py::class_<FirmNoProd, SharedMember<FirmNoProd>, PyFirmNoProd<>> firm_noprod(m, "FirmNoProd", firm);
.def("ensure_next", &FirmNoProd::ensureNext, "bundle"_a, "Can be called during an inter-period optimization stage to ensure that (at least) the requested bundle will be available in the subsequent period. This calls _product_next with any quantity that isn't satisfiable from the firm's current assets()")
.def("_produce_next", &FirmNoProd::produceNext, "bundle"_a, "Called internally by ensure_next with the amount that needs to be produced and added to assets() to satisfy the required bundle amount. This abstract method must be provided by a subclass.")
......@@ -12,7 +12,7 @@ template <class Base = Firm>
class PyFirm : public PyAgent<Base> {
// Inherit constructors
using Firm::Firm;
using PyAgent<Base>::PyAgent;
// Virtual functions (these must have the same name, since they are overrides):
virtual bool canSupply(const Bundle &b) const override { PYBIND11_OVERLOAD_NAME(bool, Firm, "can_supply", canSupply, b); }
......@@ -45,6 +45,7 @@ public:
template <class Base = FirmNoProd>
class PyFirmNoProd : public PyFirm<Base> {
using PyFirm<Base>::PyFirm;
virtual void produceNext(const Bundle &b) override { PYBIND11_OVERLOAD_PURE_NAME(void, Firm, "_produce_next", produceNext, b); }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment