Skip to content

Instantly share code, notes, and snippets.

@ajw287
ajw287 / KiCAD_CopperSpiral_v4.py
Created September 29, 2023 08:50 — forked from observative/KiCAD_CopperSpiral_v4.py
v4 with spin direction and increasing amount of segments per turn for smoother result in outer circles
import sys, os
import shutil
import math
import itertools
from copy import deepcopy
# 0 1 2 3 4 5 6
LIST_elmt = [" ("," (start ",") (end ",") "," (layer ",") ","))"]
#LIST_elmt = [" (gr_line (start 131.571908 182.314571) (end 112.874456 120.68499) (angle 90) (layer Dwgs.User) (width 0.1))"]
#LIST_elmt = [" (segment (start 118.7 106.7) (end 119.4 106.7) (width 0.25) (layer B.Cu) (net 0))"]
@ajw287
ajw287 / KiCAD_CopperSpiral_v2.py
Created September 29, 2023 08:46 — forked from JoanTheSpark/KiCAD_CopperSpiral_v2.py
v2 with spin direction and increasing amount of segments per turn for smoother result in outer circles
import sys, os
import shutil
import math
import itertools
from copy import deepcopy
# 0 1 2 3 4 5 6
LIST_elmt = [" ("," (start ",") (end ",") "," (layer ",") ","))"]
#LIST_elmt = [" (gr_line (start 131.571908 182.314571) (end 112.874456 120.68499) (angle 90) (layer Dwgs.User) (width 0.1))"]
#LIST_elmt = [" (segment (start 118.7 106.7) (end 119.4 106.7) (width 0.25) (layer B.Cu) (net 0))"]
@ajw287
ajw287 / test1.cpp
Created June 15, 2019 15:00
Ex.1 - Minimal nsga2 bfe example
#include <iostream>
#include <pagmo/pagmo.hpp>
#include <pagmo/population.hpp>
// Basic working nsga2 with bfe
//
// compiles wiht : g++ -O2 -DNDEBUG -std=c++11 -pthread -lpagmo -L /home/andrew/.local/lib/ -I /home/andrew/.local/include/ test1.cpp
//
#include <pagmo/algorithms/nsga2.hpp>
@ajw287
ajw287 / test2.cpp
Last active June 22, 2019 20:06
Ex. 2 - check results of nsga2 with bfe
#include <iostream>
#include <pagmo/pagmo.hpp>
#include <pagmo/population.hpp>
// Test nsga2 vs nsga2 w/ bfe
//
// compiles wiht : g++ -O2 -DNDEBUG -std=c++11 -pthread -lpagmo -L /home/andrew/.local/lib/ -I /home/andrew/.local/include/ test2.cpp
//
#include <pagmo/algorithms/nsga2.hpp>
@ajw287
ajw287 / test3.py
Last active June 23, 2019 16:28
Ex. 3 - python3 bfe
import pygmo as pg
import numpy as np
import time
import math
class linear_function:
# very simple perturbed straight line MO problem
# perturbed with this random array generated from
# np.random.uniform(low=0, high=0.6,size=100)
rng_list = [0.14783856, 0.1116113 , 0.41368846, 0.25410871, 0.53133425,
@ajw287
ajw287 / getting_started_mo.cpp
Created December 9, 2018 21:10
Basic Pagmo example
#include <iostream>
#include "./include/pagmo/algorithm.hpp"
//#include "./include/pagmo/algorithms/sade.hpp"
#include "./include/pagmo/algorithms/nsga2.hpp"
#include "./include/pagmo/archipelago.hpp"
#include "./include/pagmo/population.hpp"
#include "./include/pagmo/problem.hpp"
#include "./include/pagmo/types.hpp"
//#include "./include/pagmo/problems/schwefel.hpp"