Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Option for efficient determination of non-operational status #602

Merged
merged 124 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 108 commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
485faf4
:sparkles: function to determine efficiently if the layout is non-ope…
Drewniok Dec 3, 2024
86a7160
:memo: Update pyfiction docstrings
actions-user Dec 3, 2024
0f7b9c7
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Dec 3, 2024
165235b
:memo: updated changelog.rst
Drewniok Dec 3, 2024
de0f75a
Merge remote-tracking branch 'origin/efficient_non_operational' into …
Drewniok Dec 3, 2024
1ebf2b8
:art: small fix.
Drewniok Dec 3, 2024
bd1b542
:memo: Update pyfiction docstrings
actions-user Dec 3, 2024
0a9af77
:art: small fix.
Drewniok Dec 3, 2024
892dd65
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Dec 3, 2024
eb4c8e0
:memo: small fix.
Drewniok Dec 3, 2024
1beeb4f
:memo: small fix.
Drewniok Dec 3, 2024
eccff22
:alembic: small change.
Drewniok Dec 3, 2024
f6f6890
:memo: small fix.
Drewniok Dec 3, 2024
ff8c77c
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Dec 3, 2024
b6e35cc
:art: small fix.
Drewniok Dec 3, 2024
e3c8c9d
Merge remote-tracking branch 'origin/efficient_non_operational' into …
Drewniok Dec 3, 2024
75f8ee3
:memo: add docu.
Drewniok Dec 3, 2024
f773f6b
:art: small fix.
Drewniok Dec 4, 2024
e0073e3
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Dec 4, 2024
7657be1
:art: small fix.
Drewniok Dec 4, 2024
8e3086f
:white_check_mark: small update.
Drewniok Dec 4, 2024
ef18ba3
Merge branch 'main' into efficient_non_operational
Drewniok Dec 4, 2024
529779a
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Dec 4, 2024
b12adb1
:memo: Update pyfiction docstrings
actions-user Dec 4, 2024
fe762f1
Merge branch 'main' into efficient_non_operational
Drewniok Dec 5, 2024
c6d03ab
:art: implement Marcel's comments and restructure code
Drewniok Dec 9, 2024
14a03eb
Merge branch 'main' into efficient_non_operational
Drewniok Dec 9, 2024
6f4c8b2
:memo: Update pyfiction docstrings
actions-user Dec 9, 2024
83860ed
:memo: update docu.
Drewniok Dec 9, 2024
04ebca6
:snake: small fix.
Drewniok Dec 9, 2024
4a005a1
:memo: small fix.
Drewniok Dec 9, 2024
d69200b
:memo: small fix.
Drewniok Dec 9, 2024
b0bf8aa
:memo: small fix.
Drewniok Dec 9, 2024
59a0408
:white_check_mark: small fix.
Drewniok Dec 9, 2024
f129f1a
:white_check_mark: small fix.
Drewniok Dec 9, 2024
f52c71b
:snake: small fix.
Drewniok Dec 10, 2024
d69b44c
:art: small fix.
Drewniok Dec 10, 2024
0393b68
:white_check_mark: small fix.
Drewniok Dec 12, 2024
6ca325d
:sparkles: add feature to only use pruning strategies to approximate …
Drewniok Dec 12, 2024
f73903f
:memo: Update pyfiction docstrings
actions-user Dec 12, 2024
9d0b652
:art: add comment.
Drewniok Dec 12, 2024
1d6bf82
Merge remote-tracking branch 'origin/efficient_non_operational' into …
Drewniok Dec 12, 2024
0136d07
:white_check_mark: add more tests.
Drewniok Dec 12, 2024
df1a309
:art: small restructuring.
Drewniok Dec 12, 2024
bdf5c3d
Merge branch 'main' into efficient_non_operational
Drewniok Dec 12, 2024
9477cf8
:memo: Update pyfiction docstrings
actions-user Dec 12, 2024
a261491
:memo: Update pyfiction docstrings
actions-user Dec 12, 2024
71afeb3
:art: small fix.
Drewniok Dec 13, 2024
9c5917c
:art: small restructure.
Drewniok Dec 13, 2024
f171723
:art: restructure.
Drewniok Dec 13, 2024
8233e0a
:memo: Update pyfiction docstrings
actions-user Dec 13, 2024
59f8773
:art: small fix.
Drewniok Dec 13, 2024
83857da
:art: small fix.
Drewniok Dec 13, 2024
d5a8152
:white_check_mark: revert changes.
Drewniok Dec 13, 2024
c88b397
:white_check_mark: add further test to cover special case.
Drewniok Dec 15, 2024
35439a9
:art: small updates.
Drewniok Dec 15, 2024
4c4e739
:memo: Update pyfiction docstrings
actions-user Dec 15, 2024
ba75cb1
:children_crossing: add experiment.
Drewniok Dec 15, 2024
c74e7ba
:art: small fix.
Drewniok Dec 15, 2024
410fe16
:bug: fixed wrong cell type.
Drewniok Dec 16, 2024
a33ebd0
:bug: fixed wrong truth table for wire and inv.
Drewniok Dec 16, 2024
93d8d15
:art: several fixes.
Drewniok Dec 16, 2024
e8e813c
:bug: fixed wrong cell type.
Drewniok Dec 16, 2024
07d6805
:bug: fix while loop.
Drewniok Dec 16, 2024
ed9c0b2
:children_crossing: update experiment.
Drewniok Dec 16, 2024
bd88760
:art: fix quickexact after implementing clone function for cds.
Drewniok Dec 16, 2024
ff0d4a0
:memo: Update pyfiction docstrings
actions-user Dec 16, 2024
7245945
:art: revert changes to avoid runtime change of QE.
Drewniok Dec 16, 2024
b2fabc8
:memo: Update pyfiction docstrings
actions-user Dec 16, 2024
5681d6f
:memo: minor changes.
Drewniok Dec 16, 2024
95ed6b1
:memo: Update pyfiction docstrings
actions-user Dec 16, 2024
1eabd0a
:zap: update benchmark results.
Drewniok Dec 16, 2024
891cead
Merge remote-tracking branch 'origin/efficient_non_operational' into …
Drewniok Dec 16, 2024
22c264f
:white_check_mark: change outdated test.
Drewniok Dec 17, 2024
fdaf574
:bug: fix wrong setting in unit test. Windows CI should be fixed now.
Drewniok Dec 17, 2024
cd8e85b
:art: update is_operational_impl constructor to control initializatio…
Drewniok Dec 17, 2024
c5bd304
:memo: Update pyfiction docstrings
actions-user Dec 17, 2024
b9f4816
:white_check_mark: small update of the test.
Drewniok Dec 17, 2024
f7085e2
Merge remote-tracking branch 'origin/efficient_non_operational' into …
Drewniok Dec 17, 2024
35fed45
Merge branch 'cda-tum:main' into main
Drewniok Dec 26, 2024
e4fd7b8
:art: implement Marcel's feedback.
Drewniok Dec 29, 2024
0cd0f67
Merge branch 'main' into efficient_non_operational
Drewniok Dec 29, 2024
adb9e68
:memo: Update pyfiction docstrings
actions-user Dec 29, 2024
a65b398
:white_check_mark: small change.
Drewniok Dec 29, 2024
93fab96
:memo: small fix/update.
Drewniok Dec 29, 2024
85e241b
:alembic: update experiment.
Drewniok Dec 29, 2024
e4dbf76
:art: add static_cast.
Drewniok Jan 2, 2025
cd026b2
:art: add assert.
Drewniok Jan 2, 2025
8da6ec4
:art: increase consistency.
Drewniok Jan 2, 2025
b4ad010
:memo: Update pyfiction docstrings
actions-user Jan 2, 2025
a8b60a9
:memo: small fix.
Drewniok Jan 2, 2025
dc419e3
:memo: Update pyfiction docstrings
actions-user Jan 2, 2025
bc905b7
Merge branch 'cda-tum:main' into main
Drewniok Jan 2, 2025
f58576d
:alembic: add pruning runtime.
Drewniok Jan 3, 2025
9801fca
:white_check_mark: add a small comment.
Drewniok Jan 3, 2025
1c0df27
Merge branch 'main' into efficient_non_operational
Drewniok Jan 4, 2025
bd960b9
:alembic: update experiment after change.
Drewniok Jan 4, 2025
90aa7dd
:white_check_mark: small bug fix.
Drewniok Jan 5, 2025
8543fa7
Merge branch 'main' into efficient_non_operational
Drewniok Jan 6, 2025
d05e1db
:alembic: small rephrasing.
Drewniok Jan 6, 2025
a4558a0
Merge remote-tracking branch 'origin/efficient_non_operational' into …
Drewniok Jan 6, 2025
e3b7acf
:alembic: small rephrasing.
Drewniok Jan 6, 2025
f188a69
Merge branch 'cda-tum:main' into main
Drewniok Jan 7, 2025
ea5a911
Merge branch 'main' into efficient_non_operational
marcelwa Jan 7, 2025
65ec0a5
Merge branch 'cda-tum:main' into main
Drewniok Jan 8, 2025
24c2421
Merge branch 'cda-tum:main' into main
Drewniok Jan 9, 2025
4113659
:memo: Update pyfiction docstrings
actions-user Jan 9, 2025
7eb8039
:art: implement Marcel's feedback.
Drewniok Jan 9, 2025
8d9aff1
:memo: Update pyfiction docstrings
actions-user Jan 9, 2025
7fabad9
:art: use the previous version for the evaluate_output function.
Drewniok Jan 9, 2025
cdb9516
:memo: Update pyfiction docstrings
actions-user Jan 9, 2025
8edc444
Merge branch 'main' into efficient_non_operational
Drewniok Jan 9, 2025
26c90ba
:art: remove unused header.
Drewniok Jan 10, 2025
65cc66e
Merge branch 'main' into efficient_non_operational
Drewniok Jan 11, 2025
72e08f4
Merge branch 'cda-tum:main' into main
Drewniok Jan 11, 2025
dfb71fb
Merge branch 'cda-tum:main' into main
Drewniok Jan 12, 2025
f1bb62c
Merge branch 'main' into efficient_non_operational
Drewniok Jan 13, 2025
d5c5ff5
Merge branch 'cda-tum:main' into main
Drewniok Jan 13, 2025
9d45592
Merge branch 'cda-tum:main' into main
Drewniok Jan 13, 2025
2e15b4a
:twisted_rightwards_arrows: merge.
Drewniok Jan 13, 2025
193b9b0
:art: solve missing renaming.
Drewniok Jan 13, 2025
d5ff595
:memo: Update pyfiction docstrings
actions-user Jan 13, 2025
8880a94
:white_check_mark: test same test.
Drewniok Jan 13, 2025
837b8ee
:bug: fix bugs that occurred during merging.
Drewniok Jan 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
#include "pyfiction/documentation.hpp"
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
#include "pyfiction/types.hpp"

#include <fiction/algorithms/simulation/sidb/detect_bdl_wires.hpp>
#include <fiction/algorithms/simulation/sidb/is_operational.hpp>
Drewniok marked this conversation as resolved.
Show resolved Hide resolved

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include <optional>
#include <vector>

Drewniok marked this conversation as resolved.
Show resolved Hide resolved
namespace pyfiction
{
Expand All @@ -26,23 +28,59 @@ void is_operational(pybind11::module& m)
{
namespace py = pybind11;

m.def("is_operational", &fiction::is_operational<Lyt, py_tt>, py::arg("lyt"), py::arg("spec"),
py::arg("params") = fiction::is_operational_params{}, py::arg("input_bdl_wire") = std::nullopt,
py::arg("output_bdl_wire") = std::nullopt, DOC(fiction_is_operational));

m.def("operational_input_patterns", &fiction::operational_input_patterns<Lyt, py_tt>, py::arg("lyt"),
py::arg("spec"), py::arg("params") = fiction::is_operational_params{},
m.def("is_operational",
py::overload_cast<const Lyt&, const std::vector<py_tt>&, const fiction::is_operational_params&>(
&fiction::is_operational<Lyt, py_tt>),
py::arg("lyt"), py::arg("spec"), py::arg("params") = fiction::is_operational_params{},
DOC(fiction_is_operational));

m.def("is_operational",
py::overload_cast<const Lyt&, const std::vector<py_tt>&, const fiction::is_operational_params&,
const std::vector<fiction::bdl_wire<Lyt>>&, const std::vector<fiction::bdl_wire<Lyt>>&,
const std::optional<Lyt>&>(&fiction::is_operational<Lyt, py_tt>),
py::arg("lyt"), py::arg("spec"), py::arg("params"), py::arg("input_bdl_wire"), py::arg("output_bdl_wire"),
py::arg("canvas_lyt") = std::nullopt, DOC(fiction_is_operational_2));

m.def("operational_input_patterns",
py::overload_cast<const Lyt&, const std::vector<py_tt>&, const fiction::is_operational_params&>(
&fiction::operational_input_patterns<Lyt, py_tt>),
py::arg("lyt"), py::arg("spec"), py::arg("params") = fiction::is_operational_params{},
DOC(fiction_operational_input_patterns));

m.def("is_kink_induced_non_operational", &fiction::is_kink_induced_non_operational<Lyt, py_tt>, py::arg("lyt"),
py::arg("spec"), py::arg("params") = fiction::is_operational_params{},
py::arg("input_bdl_wire") = std::nullopt, py::arg("output_bdl_wire") = std::nullopt,
DOC(fiction_is_kink_induced_non_operational));
m.def("operational_input_patterns",
py::overload_cast<const Lyt&, const std::vector<py_tt>&, const fiction::is_operational_params&,
const std::vector<fiction::bdl_wire<Lyt>>&, const std::vector<fiction::bdl_wire<Lyt>>&,
const std::optional<Lyt>&>(&fiction::operational_input_patterns<Lyt, py_tt>),
py::arg("lyt"), py::arg("spec"), py::arg("params") = fiction::is_operational_params{},
py::arg("input_bdl_wire"), py::arg("output_bdl_wire"), py::arg("canvas_lyt") = std::nullopt,
DOC(fiction_operational_input_patterns_2));

m.def("kink_induced_non_operational_input_patterns",
&fiction::kink_induced_non_operational_input_patterns<Lyt, py_tt>, py::arg("lyt"), py::arg("spec"),
py::arg("params") = fiction::is_operational_params{},
py::overload_cast<const Lyt&, const std::vector<py_tt>&, const fiction::is_operational_params&>(
&fiction::kink_induced_non_operational_input_patterns<Lyt, py_tt>),
py::arg("lyt"), py::arg("spec"), py::arg("params") = fiction::is_operational_params{},
DOC(fiction_kink_induced_non_operational_input_patterns));

m.def(
"kink_induced_non_operational_input_patterns",
py::overload_cast<const Lyt&, const std::vector<py_tt>&, const fiction::is_operational_params&,
const std::vector<fiction::bdl_wire<Lyt>>&, const std::vector<fiction::bdl_wire<Lyt>>&,
const std::optional<Lyt>&>(&fiction::kink_induced_non_operational_input_patterns<Lyt, py_tt>),
py::arg("lyt"), py::arg("spec"), py::arg("params"), py::arg("input_bdl_wire"), py::arg("output_bdl_wire"),
py::arg("canvas_lyt") = std::nullopt, DOC(fiction_kink_induced_non_operational_input_patterns_2));

m.def("is_kink_induced_non_operational",
py::overload_cast<const Lyt&, const std::vector<py_tt>&, const fiction::is_operational_params&>(
&fiction::is_kink_induced_non_operational<Lyt, py_tt>),
py::arg("lyt"), py::arg("spec"), py::arg("params") = fiction::is_operational_params{},
DOC(fiction_is_kink_induced_non_operational));

m.def("is_kink_induced_non_operational",
py::overload_cast<const Lyt&, const std::vector<py_tt>&, const fiction::is_operational_params&,
const std::vector<fiction::bdl_wire<Lyt>>&, const std::vector<fiction::bdl_wire<Lyt>>&,
const std::optional<Lyt>&>(&fiction::is_kink_induced_non_operational<Lyt, py_tt>),
py::arg("lyt"), py::arg("spec"), py::arg("params"), py::arg("input_bdl_wire"), py::arg("output_bdl_wire"),
py::arg("canvas_lyt") = std::nullopt, DOC(fiction_is_kink_induced_non_operational_2));
}

} // namespace detail
Expand All @@ -56,11 +94,12 @@ inline void is_operational(pybind11::module& m)
.value("NON_OPERATIONAL", fiction::operational_status::NON_OPERATIONAL,
DOC(fiction_operational_status_NON_OPERATIONAL));

py::enum_<fiction::operational_condition>(m, "operational_condition", DOC(fiction_operational_condition))
.value("TOLERATE_KINKS", fiction::operational_condition::TOLERATE_KINKS,
DOC(fiction_operational_condition_TOLERATE_KINKS))
.value("REJECT_KINKS", fiction::operational_condition::REJECT_KINKS,
DOC(fiction_operational_condition_REJECT_KINKS));
py::enum_<fiction::is_operational_params::operational_condition>(
m, "operational_condition", DOC(fiction_is_operational_params_operational_condition))
.value("TOLERATE_KINKS", fiction::is_operational_params::operational_condition::TOLERATE_KINKS,
DOC(fiction_is_operational_params_operational_condition_TOLERATE_KINKS))
.value("REJECT_KINKS", fiction::is_operational_params::operational_condition::REJECT_KINKS,
DOC(fiction_is_operational_params_operational_condition_REJECT_KINKS));

py::class_<fiction::is_operational_params>(m, "is_operational_params", DOC(fiction_is_operational_params))
.def(py::init<>())
Expand All @@ -71,7 +110,10 @@ inline void is_operational(pybind11::module& m)
.def_readwrite("input_bdl_iterator_params", &fiction::is_operational_params::input_bdl_iterator_params,
DOC(fiction_is_operational_params_input_bdl_iterator_params))
.def_readwrite("op_condition", &fiction::is_operational_params::op_condition,
DOC(fiction_is_operational_params_op_condition));
DOC(fiction_is_operational_params_op_condition))
.def_readwrite("strategy_to_analyze_operational_status",
&fiction::is_operational_params::strategy_to_analyze_operational_status,
DOC(fiction_is_operational_params_strategy_to_analyze_operational_status));

// NOTE be careful with the order of the following calls! Python will resolve the first matching overload!
detail::is_operational<py_sidb_100_lattice>(m);
Expand Down
44 changes: 22 additions & 22 deletions bindings/mnt/pyfiction/include/pyfiction/inout/read_sqd_layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,38 @@ namespace pyfiction
namespace detail
{

template <typename Lyt>
void read_sqd_layout(pybind11::module& m)
void read_sqd_layout_100(pybind11::module& m)
{
namespace py = pybind11;

py::register_exception<fiction::sqd_parsing_error>(m, "sqd_parsing_error", PyExc_RuntimeError);
py_sidb_100_lattice (*read_sqd_layout_function_pointer)(const std::string_view&, const std::string_view&) =
&fiction::read_sqd_layout<py_sidb_100_lattice>;

Lyt (*read_sqd_layout_function_pointer)(const std::string_view&, const std::string_view&) =
&fiction::read_sqd_layout<Lyt>;

if constexpr (fiction::is_sidb_lattice_100_v<Lyt>)
{
m.def("read_sqd_layout_100", read_sqd_layout_function_pointer, py::arg("filename"), py::arg("layout_name") = "",
DOC(fiction_read_sqd_layout_3));
}
else
{
m.def("read_sqd_layout_111", read_sqd_layout_function_pointer, py::arg("filename"), py::arg("layout_name") = "",
DOC(fiction_read_sqd_layout_3));
}
m.def("read_sqd_layout_100", read_sqd_layout_function_pointer, py::arg("filename"), py::arg("layout_name") = "",
DOC(fiction_read_sqd_layout_3));
}

} // namespace detail

inline void read_sqd_layout_100(pybind11::module& m)
void read_sqd_layout_111(pybind11::module& m)
{
detail::read_sqd_layout<py_sidb_100_lattice>(m);
namespace py = pybind11;

py_sidb_111_lattice (*read_sqd_layout_function_pointer)(const std::string_view&, const std::string_view&) =
&fiction::read_sqd_layout<py_sidb_111_lattice>;

m.def("read_sqd_layout_111", read_sqd_layout_function_pointer, py::arg("filename"), py::arg("layout_name") = "",
DOC(fiction_read_sqd_layout_3));
}

inline void read_sqd_layout_111(pybind11::module& m)
} // namespace detail

inline void read_sqd_layout(pybind11::module& m)
{
detail::read_sqd_layout<py_sidb_111_lattice>(m);
namespace py = pybind11;

py::register_exception<fiction::sqd_parsing_error>(m, "sqd_parsing_error", PyExc_RuntimeError);

detail::read_sqd_layout_100(m);
detail::read_sqd_layout_111(m);
}

} // namespace pyfiction
Expand Down
Loading
Loading