Commit 282ef476 authored by Jason Rhinelander's avatar Jason Rhinelander

Adapt upstream pybind11 changes

Change submodule to upstream pybind11 instead of my own repository;
all of my PRs except for the C++ implicit conversion is already
upstream.

Stop using deprecated py::base in favour of specifying base class in the
template args.

Remove unnecessary std::unique_ptr holder specifiers
parent 8df8c593
[submodule "pybind11"]
path = pybind11
url = https://github.com/jagerman/pybind11.git
url = https://github.com/pybind/pybind11.git
branch = master
Subproject commit 7251338d76bc7614ba9ca9f825e9ce38a5742a51
Subproject commit 103d78d368f6920226cecc065c87fa194cbbab5f
......@@ -4,7 +4,7 @@ namespace pyeris { namespace core {
void bind_firm(py::module &m) {
py::class_<Firm, SharedMember<Firm>, PyFirm<>> firm(m, "Firm", py::base<Agent>());
py::class_<Firm, PyFirm<>, Agent, SharedMember<Firm>> firm(m, "Firm");
py::class_<Firm::Reservation> reservation(firm, "Reservation");
reservation
......@@ -38,7 +38,7 @@ void bind_firm(py::module &m) {
.def_property("_excess_production", &PyFirm<>::_excess_production, &PyFirm<>::_set_excess_production)
;
py::class_<FirmNoProd, SharedMember<FirmNoProd>, PyFirmNoProd<>> firm_noprod(m, "FirmNoProd", firm);
py::class_<FirmNoProd, PyFirmNoProd<>, Firm, SharedMember<FirmNoProd>> firm_noprod(m, "FirmNoProd");
firm_noprod
.def(py::init<>())
.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()")
......
......@@ -4,7 +4,7 @@ namespace pyeris { namespace core {
void bind_market(py::module &m) {
py::class_<Market, SharedMember<Market>, PyMarket<>> market(m, "Market", py::base<Member>());
py::class_<Market, PyMarket<>, SharedMember<Market>, Member> market(m, "Market");
py::class_<Market::price_info> market_price(market, "PriceInfo");
market_price
......
#include "pyeris/learning/BayesianLinear.hpp"
#include <pybind11/eigen.h>
#include <pybind11/stl.h>
#include <pybind11/functional.h>
......@@ -9,7 +8,7 @@ using namespace eris::learning;
namespace pyeris { namespace learning {
void bind_BL(py::module &m) {
py::class_<BayesianLinear, std::unique_ptr<BayesianLinear>, PyBL<>> bl(m, "BayesianLinear");
py::class_<BayesianLinear, PyBL<>> bl(m, "BayesianLinear");
bl
.def(py::init<unsigned, MatrixXd, VectorXd>(),
......
#pragma once
#include <eris/learning/BayesianLinear.hpp>
#include "pyeris/common.hpp"
#include <eris/learning/BayesianLinear.hpp>
#include <pybind11/eigen.h>
using namespace Eigen;
using namespace eris::learning;
......
......@@ -7,7 +7,7 @@ namespace pyeris { namespace learning {
void bind_BLR(py::module &m) {
using BLR = BayesianLinearRestricted;
py::class_<BLR, std::unique_ptr<BLR>, PyBLR<>> blr(m, "BayesianLinearRestricted", py::base<BayesianLinear>());
py::class_<BLR, PyBLR<>, BayesianLinear> blr(m, "BayesianLinearRestricted");
// Don't both with RestrictionProxy: RestrictionIneqProxy can do everything it does.
py::class_<BLR::RestrictionIneqProxy> restr_ineq(m, "RestrictionIneqProxy");
......
......@@ -10,7 +10,7 @@ namespace pyeris { namespace position {
// still provide it, but the best a Python class can do is "have" a Positional object rather than
// "be" a Positional object.
void bind_positional(py::module &m) {
py::class_<PositionalBase, std::unique_ptr<PositionalBase>, PyPositional<>> positional(m, "Positional",
py::class_<PositionalBase, PyPositional<>> positional(m, "Positional",
"A positional instance wraps a Position and an optional bounding box. It includes various methods to adjust and move the position. Unlike the eris C++ interface, it is not currently possible to inherit from this and another base class.");
positional
.def(py::init<const Position &, const Position &, const Position &>(), "position"_a, "vertex1"_a, "vertex2"_a, "Constructs a Positional member bounding box defined by the two vertices")
......
......@@ -6,8 +6,8 @@ namespace pyeris { namespace position {
void bind_wrapped_positional(py::module &m) {
py::class_<WrappedPositionalBase, std::unique_ptr<WrappedPositionalBase>, PyWrappedPositional<>> wpositional(
m, "WrappedPositional", py::base<PositionalBase>(),
py::class_<WrappedPositionalBase, PyWrappedPositional<>, PositionalBase> wpositional(
m, "WrappedPositional",
"A WrappedPositional instance wraps a Position and an optional bounding box where some or all of the dimensions of the bounding box wrap. Crossing a wrapped boundary moves to the opposite boundary (with uncross boundary coordinates remaining the same). In one dimension, such a space resembles the circumference of a circle; in two dimensions, a torus (i.e. the surface of a donut); in two dimensions with only one dimension wrapping, the outer surface of a cylinder. The class includes various methods to adjust and move the position, taking the wrapping into account. Unlike the eris C++ interface, it is not currently possible to inherit from this and another base class.");
wpositional
.def(py::init<const Position &, const Position &, const Position &>(), "position"_a, "vertex1"_a, "vertex2"_a, "Constructs a WrappedPositional member with the bounding box defined by the two vertices. The bounding box is wrapped in every dimension (that is, moving beyond any boundary moves to a point inside the opposite boundary); in 1-dimension, this is the circumference of a circle; in 2-dimensions, a torus; in higher dimensions a hypertorus")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment