Skip to content

Latest commit

 

History

History
41 lines (36 loc) · 5.98 KB

README.md

File metadata and controls

41 lines (36 loc) · 5.98 KB

Approx

About

This project deals with approximations of arithmetic circuits using Cartesian Genetic Programming. We aim to reduce the complexity of a circuit while preserving certain allowed error rates. For circuit simulation we use the ArithsGen package. Optimizer accept specifically 8-bit multipliers.

Setup

Pull ArithsGen

git submodule init
git submodule update

Launch solver for u_arrmul8.cgp output with max allowed error 2%.

python3 main.py ariths-gen/generated_circuits/cgp_circuits/flat/u_arrmul8.cgp --error 2

Example

python .\main.py ariths-gen/generated_circuits/cgp_circuits/flat/u_arrmul8.cgp --error 2

Starting generation 1
Current gate count is 320
Errors: [mean] 0.000, [max] 0, [rel mean] 0.000
Starting generation 2
Current gate count is 306
Errors: [mean] 0.002, [max] 260, [rel mean] 2.128
...
Starting generation 18
Current gate count is 253
Errors: [mean] 0.018, [max] 3512, [rel mean] 22.048
Starting generation 19
Current gate count is 253
Errors: [mean] 0.018, [max] 3512, [rel mean] 22.048
Best found code is:
['{16,16,1,320,2,1,0}([18]2,10,2)([19]3,10,9)([20]4,10,2)([21]5,10,2)([22]6,10,2)([23]7,10,2)([24]8,10,2)([25]9,10,2)([26]2,11,2)([27]26,19,4)([28]26,19,2)([29]3,11,2)([30]29,20,4)([31]29,20,2)([32]30,28,4)([33]30,28,2)([34]31,33,3)([35]4,11,9)([36]35,21,4)([37]35,21,2)([38]36,34,4)([39]36,34,8)([40]37,39,3)([41]5,11,2)([42]41,22,4)([43]41,22,2)([44]42,40,4)([45]42,40,2)([46]43,45,3)([47]6,11,2)([48]47,23,4)([49]47,23,2)([50]48,46,4)([51]48,46,2)([52]49,51,3)([53]7,11,2)([54]53,24,4)([55]53,24,2)([56]54,52,4)([57]54,52,2)([58]55,57,3)([59]8,11,2)([60]59,25,4)([61]59,25,2)([62]60,58,4)([63]60,58,2)([64]61,63,9)([65]9,11,8)([66]65,64,4)([67]65,64,9)([68]2,12,2)([69]68,32,4)([70]68,32,2)([71]3,12,2)([72]71,38,4)([73]71,38,2)([74]72,70,4)([75]72,70,2)([76]73,75,3)([77]4,12,2)([78]77,44,4)([79]77,44,2)([80]78,76,4)([81]78,76,2)([82]79,81,3)([83]5,12,2)([84]83,50,9)([85]83,50,2)([86]84,82,4)([87]84,82,2)([88]85,87,3)([89]6,12,2)([90]89,56,4)([91]89,56,2)([92]90,88,4)([93]90,88,2)([94]91,93,3)([95]7,12,2)([96]95,62,4)([97]95,62,2)([98]96,94,4)([99]96,94,2)([100]97,99,3)([101]8,12,2)([102]101,66,4)([103]101,66,2)([104]102,100,4)([105]102,100,2)([106]103,105,3)([107]9,12,2)([108]107,67,4)([109]107,67,2)([110]108,106,9)([111]108,106,2)([112]109,111,3)([113]2,13,2)([114]113,74,4)([115]113,74,2)([116]3,13,2)([117]116,80,4)([118]116,80,2)([119]117,115,8)([120]117,115,2)([121]118,120,3)([122]4,13,2)([123]122,86,8)([124]122,86,2)([125]123,121,4)([126]123,121,2)([127]124,126,3)([128]5,13,2)([129]128,92,4)([130]128,92,2)([131]129,127,8)([132]129,127,8)([133]130,132,3)([134]6,13,2)([135]134,98,4)([136]134,98,2)([137]135,133,4)([138]135,133,2)([139]136,138,3)([140]7,13,2)([141]140,104,4)([142]140,104,2)([143]141,139,4)([144]141,139,9)([145]142,144,3)([146]8,13,2)([147]146,110,8)([148]146,110,2)([149]147,145,4)([150]147,145,2)([151]148,150,3)([152]9,13,2)([153]152,112,4)([154]152,112,2)([155]153,151,4)([156]153,151,2)([157]154,156,3)([158]2,14,2)([159]158,119,4)([160]158,119,2)([161]3,14,2)([162]161,125,4)([163]161,125,2)([164]162,160,4)([165]162,160,2)([166]163,165,3)([167]4,14,2)([168]167,131,4)([169]167,131,2)([170]168,166,4)([171]168,166,2)([172]169,171,3)([173]5,14,2)([174]173,137,4)([175]173,137,2)([176]174,172,4)([177]174,172,2)([178]175,177,3)([179]6,14,8)([180]179,143,4)([181]179,143,2)([182]180,178,4)([183]180,178,2)([184]181,183,3)([185]7,14,2)([186]185,149,4)([187]185,149,2)([188]186,184,4)([189]186,184,2)([190]187,189,3)([191]8,14,2)([192]191,155,4)([193]191,155,2)([194]192,190,4)([195]192,190,2)([196]193,195,3)([197]9,14,2)([198]197,157,4)([199]197,157,2)([200]198,196,4)([201]198,196,2)([202]199,201,3)([203]2,15,2)([204]203,164,4)([205]203,164,2)([206]3,15,2)([207]206,170,4)([208]206,170,2)([209]207,205,4)([210]207,205,2)([211]208,210,9)([212]4,15,2)([213]212,176,4)([214]212,176,2)([215]213,211,4)([216]213,211,2)([217]214,216,3)([218]5,15,2)([219]218,182,4)([220]218,182,2)([221]219,217,4)([222]219,217,2)([223]220,222,3)([224]6,15,2)([225]224,188,4)([226]224,188,2)([227]225,223,8)([228]225,223,2)([229]226,228,9)([230]7,15,2)([231]230,194,4)([232]230,194,2)([233]231,229,4)([234]231,229,2)([235]232,234,3)([236]8,15,2)([237]236,200,4)([238]236,200,2)([239]237,235,4)([240]237,235,2)([241]238,240,3)([242]9,15,2)([243]242,202,4)([244]242,202,2)([245]243,241,4)([246]243,241,2)([247]244,246,3)([248]2,16,2)([249]248,209,8)([250]248,209,2)([251]3,16,2)([252]251,215,9)([253]251,215,2)([254]252,250,4)([255]252,250,2)([256]253,255,3)([257]4,16,2)([258]257,221,9)([259]257,221,2)([260]258,256,4)([261]258,256,9)([262]259,261,3)([263]5,16,2)([264]263,227,4)([265]263,227,2)([266]264,262,4)([267]264,262,2)([268]265,267,9)([269]6,16,2)([270]269,233,4)([271]269,233,2)([272]270,268,4)([273]270,268,2)([274]271,273,3)([275]7,16,2)([276]275,239,4)([277]275,239,2)([278]276,274,4)([279]276,274,2)([280]277,279,3)([281]8,16,2)([282]281,245,4)([283]281,245,2)([284]282,280,4)([285]282,280,2)([286]283,285,3)([287]9,16,2)([288]287,247,4)([289]287,247,2)([290]288,286,4)([291]288,286,2)([292]289,291,3)([293]2,17,2)([294]293,254,4)([295]293,254,2)([296]3,17,2)([297]296,260,4)([298]296,260,2)([299]297,295,4)([300]297,295,2)([301]298,300,3)([302]4,17,2)([303]302,266,4)([304]302,266,2)([305]303,301,4)([306]303,301,2)([307]304,306,3)([308]5,17,8)([309]308,272,4)([310]308,272,2)([311]309,307,4)([312]309,307,2)([313]310,312,3)([314]6,17,2)([315]314,278,4)([316]314,278,2)([317]315,313,4)([318]315,313,2)([319]316,318,3)([320]7,17,2)([321]320,284,4)([322]320,284,2)([323]321,319,4)([324]321,319,2)([325]322,324,3)([326]8,17,2)([327]326,290,4)([328]326,290,2)([329]327,325,4)([330]327,325,2)([331]328,330,3)([332]9,17,2)([333]332,292,4)([334]332,292,2)([335]333,331,4)([336]333,331,2)([337]334,336,3)(18,27,69,114,159,204,249,294,299,305,311,317,323,329,335,337)']
with mean error 1.786% and fitness 253.
Circuit has been reduced to 79.1% of original circuit.

Experiments

For more experiments with different errors, please check EXPERIMENTS.md.