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

⚗️ Added a runtime script for three state simulation and apply small changes. #520

Merged
merged 39 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
facb9c5
:art: make it easier to create layouts with positive sides.
Drewniok Sep 3, 2024
7ebdfcc
:alembic: add experiment script.
Drewniok Sep 3, 2024
5a937d4
:memo: Update pyfiction docstrings
actions-user Sep 3, 2024
c8f4968
:art: small changes.
Drewniok Sep 3, 2024
04cbaa5
Merge remote-tracking branch 'origin/experiment_for_three_state_simul…
Drewniok Sep 3, 2024
bb723eb
:memo: Update pyfiction docstrings
actions-user Sep 3, 2024
2faea27
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Sep 3, 2024
a03a196
:rotating_light: implement clang-tidy warnings.
Drewniok Sep 3, 2024
f000244
Merge branch 'main' into experiment_for_three_state_simulation
Drewniok Sep 3, 2024
1fface6
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Sep 3, 2024
01bae3a
:art: small fix.
Drewniok Sep 3, 2024
993a545
Merge remote-tracking branch 'origin/experiment_for_three_state_simul…
Drewniok Sep 3, 2024
a2f897e
:memo: Update pyfiction docstrings
actions-user Sep 3, 2024
bd5ca78
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Sep 3, 2024
81d1dbd
:art: small fix to avoid window compile issue.
Drewniok Sep 4, 2024
17a7330
:art: small fix.
Drewniok Sep 4, 2024
73e29df
:art: small fix.
Drewniok Sep 4, 2024
415c9ea
:art: small fix.
Drewniok Sep 5, 2024
f53d3de
Merge branch 'main' into experiment_for_three_state_simulation
Drewniok Sep 6, 2024
6893c2b
:art: move files.
Drewniok Sep 8, 2024
a87543c
:twisted_rightwards_arrows: merge.
Drewniok Sep 8, 2024
f716b78
:art: simplify params.
Drewniok Sep 8, 2024
1f99c79
:memo: Update pyfiction docstrings
actions-user Sep 8, 2024
43ac0bb
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Sep 8, 2024
2ef53e6
:snake: small fix.
Drewniok Sep 9, 2024
7aedb4d
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Sep 9, 2024
d6d1cd8
:art: small fix in the experiment script.
Drewniok Sep 9, 2024
b4db8b2
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Sep 9, 2024
6c78be9
:white_check_mark: add more test cases and small fixes.
Drewniok Sep 9, 2024
8aa6f50
:art: implement Marcels feedback.
Drewniok Sep 12, 2024
095cf53
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Sep 12, 2024
427c5c0
:memo: Update pyfiction docstrings
actions-user Sep 12, 2024
eac49ae
:memo: small fix.
Drewniok Sep 12, 2024
cbccaa8
:art: small fix.
Drewniok Sep 13, 2024
198412c
Merge branch 'main' into experiment_for_three_state_simulation
Drewniok Sep 13, 2024
9f4f7ef
:art: small update.
Drewniok Sep 13, 2024
7143f0a
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Sep 13, 2024
2b0f53f
Merge branch 'main' into experiment_for_three_state_simulation
Drewniok Sep 16, 2024
b3c057a
:white_check_mark: add additional test.
Drewniok Sep 16, 2024
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 @@ -50,18 +50,16 @@ inline void design_sidb_gates(pybind11::module& m)
py::class_<fiction::design_sidb_gates_params<fiction::offset::ucoord_t>>(m, "design_sidb_gates_params",
DOC(fiction_design_sidb_gates_params))
.def(py::init<>())
.def_readwrite("simulation_parameters",
&fiction::design_sidb_gates_params<fiction::offset::ucoord_t>::simulation_parameters,
DOC(fiction_design_sidb_gates_params))
.def_readwrite("operational_params",
&fiction::design_sidb_gates_params<fiction::offset::ucoord_t>::operational_params,
DOC(fiction_design_sidb_gates_params_operational_params))
.def_readwrite("design_mode", &fiction::design_sidb_gates_params<fiction::offset::ucoord_t>::design_mode,
DOC(fiction_design_sidb_gates_params_design_mode))
.def_readwrite("canvas", &fiction::design_sidb_gates_params<fiction::offset::ucoord_t>::canvas,
DOC(fiction_design_sidb_gates_params_canvas))
.def_readwrite("number_of_sidbs",
&fiction::design_sidb_gates_params<fiction::offset::ucoord_t>::number_of_sidbs,
DOC(fiction_design_sidb_gates_params_number_of_sidbs))
.def_readwrite("sim_engine", &fiction::design_sidb_gates_params<fiction::offset::ucoord_t>::sim_engine,
DOC(fiction_design_sidb_gates_params_sim_engine));
DOC(fiction_design_sidb_gates_params_number_of_sidbs));

detail::design_sidb_gates<py_sidb_100_lattice>(m);
detail::design_sidb_gates<py_sidb_111_lattice>(m);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,15 @@ inline void random_sidb_layout_generator(pybind11::module& m)

py::enum_<typename fiction::generate_random_sidb_layout_params<fiction::offset::ucoord_t>::positive_charges>(
m, "positive_charges", DOC(fiction_generate_random_sidb_layout_params_positive_charges))
.value("ON", fiction::generate_random_sidb_layout_params<fiction::offset::ucoord_t>::positive_charges::ALLOWED)
.value("OFF",
fiction::generate_random_sidb_layout_params<fiction::offset::ucoord_t>::positive_charges::FORBIDDEN);
.value("ALLOWED",
fiction::generate_random_sidb_layout_params<fiction::offset::ucoord_t>::positive_charges::ALLOWED,
DOC(fiction_generate_random_sidb_layout_params_positive_charges_ALLOWED))
.value("FORBIDDEN",
fiction::generate_random_sidb_layout_params<fiction::offset::ucoord_t>::positive_charges::FORBIDDEN,
DOC(fiction_generate_random_sidb_layout_params_positive_charges_FORBIDDEN))
.value("MAY_OCCUR",
fiction::generate_random_sidb_layout_params<fiction::offset::ucoord_t>::positive_charges::MAY_OCCUR,
DOC(fiction_generate_random_sidb_layout_params_positive_charges_MAY_OCCUR));

/**
* Parameters.
Expand All @@ -63,9 +69,6 @@ inline void random_sidb_layout_generator(pybind11::module& m)
.def_readwrite("positive_sidbs",
&fiction::generate_random_sidb_layout_params<fiction::offset::ucoord_t>::positive_sidbs,
DOC(fiction_generate_random_sidb_layout_params_positive_sidbs))
.def_readwrite("minimal_spacing",
&fiction::generate_random_sidb_layout_params<fiction::offset::ucoord_t>::minimal_spacing,
DOC(fiction_generate_random_sidb_layout_params_minimal_spacing))
.def_readwrite("maximal_attempts",
&fiction::generate_random_sidb_layout_params<fiction::offset::ucoord_t>::maximal_attempts,
DOC(fiction_generate_random_sidb_layout_params_maximal_attempts))
Expand All @@ -77,8 +80,8 @@ inline void random_sidb_layout_generator(pybind11::module& m)
&fiction::generate_random_sidb_layout_params<
fiction::offset::ucoord_t>::maximal_attempts_for_multiple_layouts,
DOC(fiction_generate_random_sidb_layout_params_maximal_attempts_for_multiple_layouts));
// NOTE be careful with the order of the following calls! Python will resolve the first matching overload!

// NOTE be careful with the order of the following calls! Python will resolve the first matching overload!
detail::random_layout_generator<py_sidb_100_lattice>(m);
detail::random_layout_generator<py_sidb_111_lattice>(m);
}
Expand Down
37 changes: 28 additions & 9 deletions bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,27 @@ Parameter ``params``:
A cell-level layout that implements `lyt`'s gate types with
building blocks defined in `GateLibrary`.)doc";

static const char *__doc_fiction_are_cell_layouts_identical =
R"doc(This function checks whether the given layouts `first_lyt` and
`second_lyt` are identical by comparing various properties such as the
number of cells, the types of cells, defects (if applicable), and
charge states (if applicable). The comparison is done in a detailed
manner depending on the specific layout type.

@Note The aspect ratios of the cell-level layouts are not compared.

Template parameter ``Lyt``:
The layout type. Must be a cell-level layout.

Parameter ``first_lyt``:
The first layout to compare.

Parameter ``second_lyt``:
The second layout to compare.

Returns:
`true` if the layouts are identical, `false` otherwise.)doc";

static const char *__doc_fiction_area =
R"doc(Computes the area of a given coordinate assuming its origin is (0, 0,
0). Calculates :math:`(|x| + 1) \cdot (|y| + 1)` by default. The
Expand Down Expand Up @@ -3495,11 +3516,7 @@ static const char *__doc_fiction_design_sidb_gates_params_design_sidb_gates_mode

static const char *__doc_fiction_design_sidb_gates_params_number_of_sidbs = R"doc(Number of SiDBs placed in the canvas to create a working gate.)doc";

static const char *__doc_fiction_design_sidb_gates_params_sim_engine =
R"doc(The simulation engine to be used for the operational domain
computation.)doc";

static const char *__doc_fiction_design_sidb_gates_params_simulation_parameters = R"doc(All Parameters for physical SiDB simulations.)doc";
static const char *__doc_fiction_design_sidb_gates_params_operational_params = R"doc(Parameters for the `is_operational` function.)doc";

static const char *__doc_fiction_design_sidb_gates_params_termination_cond =
R"doc(The design process is terminated after a valid SiDB gate design is
Expand Down Expand Up @@ -10784,10 +10801,6 @@ be difficult or even impossible to find several unique (given by
number_of_unique_generated_layouts) layouts. Therefore, this parameter
sets a limit for the maximum number of tries.)doc";

static const char *__doc_fiction_generate_random_sidb_layout_params_minimal_spacing =
R"doc(If positively charged SiDBs should be prevented, SiDBs are not placed
closer than this value (Euclidean distance of two cells).)doc";

static const char *__doc_fiction_generate_random_sidb_layout_params_number_of_sidbs = R"doc(Number of SiDBs that are placed on the layout.)doc";

static const char *__doc_fiction_generate_random_sidb_layout_params_number_of_unique_generated_layouts = R"doc(The desired number of unique layouts to be generated.)doc";
Expand All @@ -10804,10 +10817,16 @@ static const char *__doc_fiction_generate_random_sidb_layout_params_positive_cha
R"doc(Positive charges are not allowed to occur (i.e. SiDBs need to be
seperated by a few lattice points).)doc";

static const char *__doc_fiction_generate_random_sidb_layout_params_positive_charges_MAY_OCCUR =
R"doc(Positive charges can occur, which means that the
`can_positive_charges_occur` function returns `true`.)doc";

static const char *__doc_fiction_generate_random_sidb_layout_params_positive_sidbs =
R"doc(If positively charged SiDBs should be prevented, SiDBs are not placed
closer than the minimal_spacing.)doc";

static const char *__doc_fiction_generate_random_sidb_layout_params_sim_params = R"doc(Simulation parameters.)doc";

static const char *__doc_fiction_geometric_temperature_schedule =
R"doc(A logarithmically decreasing temperature schedule. The temperature is
altered by multiplying it with `0.99`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ def test_siqad_and_gate_skeleton_100(self):
layout.assign_cell_type((10, 19), sidb_technology.cell_type.NORMAL)

params = design_sidb_gates_params()
params.simulation_parameters.base = 2
params.simulation_parameters.mu_minus = -0.28
params.operational_params.simulation_parameters.base = 2
params.operational_params.simulation_parameters.mu_minus = -0.28
params.design_mode = design_sidb_gates_mode.EXHAUSTIVE
params.canvas = [(4, 8), (14, 11)]
params.number_of_sidbs = 1
params.sim_engine = sidb_simulation_engine.QUICKEXACT
params.operational_params.sim_engine = sidb_simulation_engine.QUICKEXACT

self.assertEqual(params.simulation_parameters.mu_minus, -0.28)
self.assertEqual(params.operational_params.simulation_parameters.mu_minus, -0.28)
self.assertEqual(params.number_of_sidbs, 1)
self.assertEqual(params.canvas[0], (4, 8, 0))
self.assertEqual(params.canvas[1], (14, 11))
Expand Down Expand Up @@ -72,14 +72,14 @@ def test_nor_gate_111(self):
layout.assign_cell_type((23, 59), sidb_technology.cell_type.NORMAL)

params = design_sidb_gates_params()
params.simulation_parameters.base = 2
params.simulation_parameters.mu_minus = -0.32
params.operational_params.simulation_parameters.base = 2
params.operational_params.simulation_parameters.mu_minus = -0.32
params.design_mode = design_sidb_gates_mode.EXHAUSTIVE
params.canvas = [(10, 22), (14, 34)]
params.number_of_sidbs = 3
params.sim_engine = sidb_simulation_engine.QUICKEXACT
params.operational_params.sim_engine = sidb_simulation_engine.QUICKEXACT

self.assertEqual(params.simulation_parameters.mu_minus, -0.32)
self.assertEqual(params.operational_params.simulation_parameters.mu_minus, -0.32)
self.assertEqual(params.number_of_sidbs, 3)
self.assertEqual(params.canvas[0], (10, 22, 0))
self.assertEqual(params.canvas[1], (14, 34))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ int main() // NOLINT
using cell_lyt = fiction::sidb_cell_clk_lyt_cube;

fiction::design_sidb_gates_params<fiction::cell<cell_lyt>> design_gate_params{};
design_gate_params.simulation_parameters = fiction::sidb_simulation_parameters{2, -0.32};
design_gate_params.operational_params.simulation_parameters = fiction::sidb_simulation_parameters{2, -0.32};
// needs to be changed if a different skeleton is used.
design_gate_params.canvas = {{24, 17}, {34, 28}};

design_gate_params.number_of_sidbs = 3;
design_gate_params.sim_engine = fiction::sidb_simulation_engine::QUICKEXACT;
design_gate_params.number_of_sidbs = 3;
design_gate_params.operational_params.sim_engine = fiction::sidb_simulation_engine::QUICKEXACT;
design_gate_params.termination_cond =
fiction::design_sidb_gates_params<fiction::cell<cell_lyt>>::termination_condition::AFTER_FIRST_SOLUTION;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <fiction/algorithms/simulation/sidb/random_sidb_layout_generator.hpp>
#include <fiction/io/write_sqd_layout.hpp>
#include <fiction/technology/cell_technologies.hpp>
#include <fiction/types.hpp>
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved

#include <fmt/format.h>
Expand Down Expand Up @@ -35,7 +36,7 @@ using namespace fiction;
* --SE_x <value> Sets the x coordinate of the south-east cell corner in SiQAD coordinates.
* --SE_y <value> Sets the y coordinate of the south-east cell corner in SiQAD coordinates.
* --positive_charges <type> Specifies whether positively charged SiDBs are allowed ("ALLOWED") or forbidden
* ("FORBIDDEN").
* ("FORBIDDEN") for default physical parameters.
* --lower <value> Sets the number of SiDBs for the first bunch of layouts.
* --upper <value> Sets the number of SiDBs for the last bunch of layouts.
* --num_layouts <value> Sets the number of layouts to generate for each SiDB count.
Expand Down Expand Up @@ -95,10 +96,23 @@ int main(int argc, const char* argv[]) // NOLINT
const int32_t se_y = std::stoi(options["--SE_y"]);
// specifies whether positively charged SiDBs are allowed ("ALLOWED") or forbidden ("FORBIDDEN")
const std::string charges_str = options["--positive_charges"];
// specifies whether positively charged SiDBs are allowed ("ALLOWED") or forbidden ("FORBIDDEN")
const generate_random_sidb_layout_params<offset::ucoord_t>::positive_charges charges =
(charges_str == "ALLOWED") ? generate_random_sidb_layout_params<offset::ucoord_t>::positive_charges::ALLOWED :
generate_random_sidb_layout_params<offset::ucoord_t>::positive_charges::FORBIDDEN;

// specifies whether positively charged SiDBs are allowed ("ALLOWED"), forbidden ("FORBIDDEN") or can occur
// ("MAY_OCCUR")
generate_random_sidb_layout_params<fiction::offset::ucoord_t>::positive_charges charges{};
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
if (charges_str == "ALLOWED")
{
charges = generate_random_sidb_layout_params<fiction::offset::ucoord_t>::positive_charges::ALLOWED;
}
else if (charges_str == "MAY_OCCUR")
{
charges = generate_random_sidb_layout_params<fiction::offset::ucoord_t>::positive_charges::MAY_OCCUR;
}
else
{
charges = generate_random_sidb_layout_params<fiction::offset::ucoord_t>::positive_charges::FORBIDDEN;
}

// sets the number of SiDBs for the first bunch of layouts
const uint64_t lower_limit = std::stoull(options["--lower"]);
// sets the number of SiDBs for the last bunch of layouts
Expand Down Expand Up @@ -164,9 +178,9 @@ int main(int argc, const char* argv[]) // NOLINT
std::cout << "Folder already exists.\n";
}

const generate_random_sidb_layout_params<offset::ucoord_t> params{
{{nw_x, nw_y}, {se_x, se_y}}, number_of_placed_sidbs, charges, 2,
static_cast<uint64_t>(10E6), number_of_layouts};
const generate_random_sidb_layout_params<fiction::offset::ucoord_t> params{
{{nw_x, nw_y}, {se_x, se_y}}, number_of_placed_sidbs, charges,
sidb_simulation_parameters{3, -0.32}, static_cast<uint64_t>(10E6), number_of_layouts};
const auto unique_lyts = generate_multiple_random_sidb_layouts(sidb_100_cell_clk_lyt{}, params);
for (auto i = 0u; i < unique_lyts.size(); i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
// Created by Jan Drewniok on 17.05.24.
//

#include "fiction/algorithms/iter/bdl_input_iterator.hpp"
#include "fiction/algorithms/simulation/sidb/exhaustive_ground_state_simulation.hpp"
#include "fiction/algorithms/simulation/sidb/quickexact.hpp"
#include "fiction/algorithms/simulation/sidb/quicksim.hpp"
#include "fiction/algorithms/simulation/sidb/sidb_simulation_parameters.hpp"
#include "fiction/algorithms/simulation/sidb/time_to_solution.hpp"
#include "fiction/io/read_sqd_layout.hpp"
#include "fiction/layouts/coordinates.hpp"
#include "fiction/types.hpp"
#include "fiction/utils/truth_table_utils.hpp"
#include "fiction_experiments.hpp"

#include <fiction/algorithms/iter/bdl_input_iterator.hpp>
#include <fiction/algorithms/simulation/sidb/exhaustive_ground_state_simulation.hpp>
#include <fiction/algorithms/simulation/sidb/quickexact.hpp>
#include <fiction/algorithms/simulation/sidb/quicksim.hpp>
#include <fiction/algorithms/simulation/sidb/sidb_simulation_parameters.hpp>
#include <fiction/algorithms/simulation/sidb/time_to_solution.hpp>
#include <fiction/io/read_sqd_layout.hpp>
#include <fiction/layouts/coordinates.hpp>
#include <fiction/types.hpp>
#include <fiction/utils/truth_table_utils.hpp>

#include <fmt/format.h>
#include <mockturtle/utils/stopwatch.hpp>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
//
// Created by Jan Drewniok on 02.09.24.
//

#include "fiction_experiments.hpp"

#include <fiction/algorithms/simulation/sidb/determine_groundstate_from_simulation_results.hpp>
#include <fiction/algorithms/simulation/sidb/exhaustive_ground_state_simulation.hpp>
#include <fiction/algorithms/simulation/sidb/quickexact.hpp>
#include <fiction/algorithms/simulation/sidb/random_sidb_layout_generator.hpp>
#include <fiction/algorithms/simulation/sidb/sidb_simulation_parameters.hpp>

#include <mockturtle/utils/stopwatch.hpp>

#include <cstdint>
#include <cstdlib>
#include <numeric>
#include <vector>

using namespace fiction;

// This script compares the simulation runtime of ExGS and QuickExact for randomly
// generated layouts that may contain positively charged SiDBs (`can_positive_charges_occur` returns `true`). The number
// of SiDBs in the layout varies from 5 to 20.

int main() // NOLINT
{
using Lyt = sidb_100_cell_clk_lyt;
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved

experiments::experiment<std::size_t, std::size_t, double, double, double> simulation_exp{
"Benchmark",
"Number SiDBs",
"#Instances",
"Exhaustive Runtime [s]",
"QuickExact Runtime [s]",
"Average #positive SiDBs of ground state"};

const sidb_simulation_parameters sim_params{3, -0.32};

const quickexact_params<cell<Lyt>> qe_params{sim_params,
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
quickexact_params<cell<Lyt>>::automatic_base_number_detection::OFF};

auto random_layouts_params = generate_random_sidb_layout_params<cell<Lyt>>{
{{0, 0}, {10, 10}},
0,
generate_random_sidb_layout_params<cell<Lyt>>::positive_charges::MAY_OCCUR,
sim_params,
static_cast<uint64_t>(10E6),
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
10};

for (auto num_sidbs = 5u; num_sidbs < 20; num_sidbs++)
{
random_layouts_params.number_of_sidbs = num_sidbs;

const auto random_layouts = generate_multiple_random_sidb_layouts(Lyt{}, random_layouts_params);

double runtime_exhaustive = 0;
double runtime_quickexact = 0;

std::vector<std::size_t> number_of_positive_sidbs_of_gs_per_layout{};
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
number_of_positive_sidbs_of_gs_per_layout.reserve(random_layouts_params.number_of_unique_generated_layouts);

for (const auto& layout : random_layouts)
{
const auto exhaustive_results_layout = exhaustive_ground_state_simulation(layout, sim_params);

const auto quickexact_results_layout = quickexact(layout, qe_params);

const auto gs = determine_groundstate_from_simulation_results(exhaustive_results_layout);

// determine the number of positive SiDBs in the ground state
number_of_positive_sidbs_of_gs_per_layout.push_back(gs.at(0).num_positive_sidbs());

runtime_exhaustive += mockturtle::to_seconds(exhaustive_results_layout.simulation_runtime);
runtime_quickexact += mockturtle::to_seconds(quickexact_results_layout.simulation_runtime);
}

const auto average_pos_sibs_of_gs =
static_cast<double>(std::accumulate(number_of_positive_sidbs_of_gs_per_layout.cbegin(),
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
number_of_positive_sidbs_of_gs_per_layout.cend(), 0u)) /
static_cast<double>(number_of_positive_sidbs_of_gs_per_layout.size());

simulation_exp(random_layouts_params.number_of_sidbs, random_layouts.size(), runtime_exhaustive,
runtime_quickexact, average_pos_sibs_of_gs);

simulation_exp.save();
simulation_exp.table();
}

return EXIT_SUCCESS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "fiction_experiments.hpp"

#include <fiction/algorithms/simulation/sidb/critical_temperature.hpp>
#include <fiction/algorithms/simulation/sidb/exhaustive_ground_state_simulation.hpp>
#include <fiction/algorithms/simulation/sidb/sidb_simulation_parameters.hpp>
#include <fiction/io/read_sqd_layout.hpp>
#include <fiction/types.hpp>
Expand Down
Loading
Loading