Skip to content

Commit

Permalink
✨ Added time_to_solution to pyfiction
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelwa committed Nov 21, 2023
1 parent 240bafc commit b9e9c5b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ namespace detail
template <typename Lyt>
void can_positive_charges_occur(pybind11::module& m)
{
namespace py = pybind11;
using namespace pybind11::literals;

m.def("can_positive_charges_occur", &fiction::can_positive_charges_occur<Lyt>, "lyt"_a, "sim_params"_a,
Expand All @@ -33,8 +32,6 @@ void can_positive_charges_occur(pybind11::module& m)

inline void can_positive_charges_occur(pybind11::module& m)
{
namespace py = pybind11;

// NOTE be careful with the order of the following calls! Python will resolve the first matching overload!

detail::can_positive_charges_occur<py_charge_distribution_surface>(m);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ void exhaustive_ground_state_simulation(pybind11::module& m)

m.def(
"exhaustive_ground_state_simulation",
[](const Lyt& layout,
[](const Lyt& lyt,
const fiction::sidb_simulation_parameters& params) -> fiction::sidb_simulation_result<py_cds_base>
{ return fiction::exhaustive_ground_state_simulation<py_cds_base>(layout, params); },
"layout"_a, "params"_a = fiction::sidb_simulation_parameters{},
DOC(fiction_exhaustive_ground_state_simulation));
{ return fiction::exhaustive_ground_state_simulation<py_cds_base>(lyt, params); },
"lyt"_a, "params"_a = fiction::sidb_simulation_parameters{}, DOC(fiction_exhaustive_ground_state_simulation));
}

} // namespace detail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ void time_to_solution(pybind11::module& m)
{
using namespace pybind11::literals;

m.def("sim_acc_tts", &fiction::sim_acc_tts<Lyt>, "lyt"_a, "quickim_params"_a,
"tts_params"_a = fiction::time_to_solution_params{}, "ps"_a = nullptr, DOC(fiction_sim_acc_tts));
m.def("sim_acc_tts", &fiction::time_to_solution<Lyt>, "lyt"_a, "quickim_params"_a,
"tts_params"_a = fiction::time_to_solution_params{}, "ps"_a = nullptr, DOC(fiction_time_to_solution));
}

} // namespace detail
Expand All @@ -35,7 +35,20 @@ inline void time_to_solution(pybind11::module& m)
namespace py = pybind11;

/**
* Time_To_Solution parameters.
* Parameters.
*/
py::class_<fiction::time_to_solution_params>(m, "time_to_solution_params", DOC(fiction_time_to_solution_params))
.def(py::init<>())
.def_readwrite("engine", &fiction::time_to_solution_params::engine, DOC(fiction_time_to_solution_params_engine))
.def_readwrite("repetitions", &fiction::time_to_solution_params::repetitions,
DOC(fiction_time_to_solution_params_repetitions))
.def_readwrite("confidence_level", &fiction::time_to_solution_params::confidence_level,
DOC(fiction_time_to_solution_params_confidence_level))

;

/**
* Statistics.
*/
py::class_<fiction::time_to_solution_stats>(m, "time_to_solution_stats", DOC(fiction_time_to_solution_stats))
.def(py::init<>())
Expand All @@ -46,8 +59,8 @@ inline void time_to_solution(pybind11::module& m)
DOC(fiction_time_to_solution_stats_mean_single_runtime))
.def_readwrite("single_runtime_exhaustive", &fiction::time_to_solution_stats::single_runtime_exhaustive,
DOC(fiction_time_to_solution_stats_single_runtime_exhaustive))
.def_readwrite("algorithm", &fiction::time_to_solution_stats::algorithm)
// , DOC(fiction_time_to_solution_stats_algorithm))")
.def_readwrite("algorithm", &fiction::time_to_solution_stats::algorithm,
DOC(fiction_time_to_solution_stats_algorithm))
.def("report", &fiction::time_to_solution_stats::report, DOC(fiction_time_to_solution_stats_report))

;
Expand Down
2 changes: 1 addition & 1 deletion bindings/pyfiction/pyfiction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "pyfiction/algorithms/simulation/sidb/sidb_simulation_engine.hpp"
#include "pyfiction/algorithms/simulation/sidb/sidb_simulation_parameters.hpp"
#include "pyfiction/algorithms/simulation/sidb/sidb_simulation_result.hpp"
// #include "pyfiction/algorithms/simulation/sidb/time_to_solution.hpp"
#include "pyfiction/algorithms/simulation/sidb/time_to_solution.hpp"
#include "pyfiction/algorithms/verification/design_rule_violations.hpp"
#include "pyfiction/algorithms/verification/equivalence_checking.hpp"
#include "pyfiction/inout/read_fgl_layout.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ struct time_to_solution_params

/**
* This struct stores the time-to-solution, the simulation accuracy and the average single simulation runtime of
* *QuickSim* quicksim, the single runtime of the exact simulator used, and the number of valid charge
* configurations found by the exact algorithm.
*
* *QuickSim*, the single runtime of the exact simulator used, and the number of valid charge configurations found by
* the exact algorithm.
*/
struct time_to_solution_stats
{
Expand Down

0 comments on commit b9e9c5b

Please sign in to comment.