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 26 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 @@ -42,11 +42,15 @@ inline void random_sidb_layout_generator(pybind11::module& m)
namespace py = pybind11;
using namespace pybind11::literals;

// todo update docu
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
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)
.value("FORBIDDEN",
fiction::generate_random_sidb_layout_params<fiction::offset::ucoord_t>::positive_charges::FORBIDDEN)
.value("CAN_OCCUR",
fiction::generate_random_sidb_layout_params<fiction::offset::ucoord_t>::positive_charges::CAN_OCCUR);

/**
* Parameters.
Expand All @@ -63,9 +67,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 Down
35 changes: 26 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,25 @@ 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_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.

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 +3514,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(Parameter 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 +10799,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 @@ -10800,6 +10811,10 @@ static const char *__doc_fiction_generate_random_sidb_layout_params_positive_cha
R"doc(Positive charges can occur (i.e. SiDBs can be placed right next to
each other).)doc";

static const char *__doc_fiction_generate_random_sidb_layout_params_positive_charges_CAN_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_charges_FORBIDDEN =
R"doc(Positive charges are not allowed to occur (i.e. SiDBs need to be
seperated by a few lattice points).)doc";
Expand All @@ -10808,6 +10823,8 @@ static const char *__doc_fiction_generate_random_sidb_layout_params_positive_sid
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 @@ -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
// ("CAN_OCCUR")
generate_random_sidb_layout_params<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
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
if (charges_str == "ALLOWED")
{
charges = generate_random_sidb_layout_params<offset::ucoord_t>::positive_charges::ALLOWED;
}
else if (charges_str == "CAN_OCCUR")
{
charges = generate_random_sidb_layout_params<offset::ucoord_t>::positive_charges::CAN_OCCUR;
}
else
{
charges = generate_random_sidb_layout_params<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 @@ -165,8 +179,8 @@ int main(int argc, const char* argv[]) // NOLINT
}

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};
{{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

This file was deleted.

Loading
Loading