{"id":208240,"date":"2014-01-06T13:52:07","date_gmt":"2014-01-06T09:52:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=208240"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=208240","title":{"rendered":"<span class=\"post_title\">\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habr.habrastorage.org\/post_images\/ce8\/2f1\/f60\/ce82f1f60ca48fa0d02314bad9fa3e8c.jpg\" alt=\"image\"\/><\/div>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0412\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u0440\u0435\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A7%D1%91%D1%80%D0%BD%D1%8B%D0%B9_%D1%8F%D1%89%D0%B8%D0%BA\">\u0447\u0451\u0440\u043d\u043e\u0433\u043e \u044f\u0449\u0438\u043a\u0430<\/a>. \u041f\u043e\u0434 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e \u0442\u0430\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0434\u043d\u043e. \u041f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"python\">def customlogic(params):     return params[0] and params[1] and not params[5] and params[11] or params[2] and not params[3] or params[0] and params[5] and not params[6] or params[7] and not params[8] <\/code><\/pre>\n<p>  \u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0438\u0437 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0438\u0440\u0430.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041f\u043e \u043c\u043e\u0435\u043c\u0443 \u043c\u043d\u0435\u043d\u0438\u044e, \u0434\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u043d\u0435\u0439\u0440\u043e\u0444\u0438\u0437\u0438\u043e\u043b\u043e\u0433\u0438\u0435\u0439 \u0438 \u043a\u0430\u043a \u0412\u044b \u043c\u043e\u0433\u043b\u0438 \u0443\u0436\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f \u044f \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u044f\u043b\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u043e\u0439 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9D%D0%B5%D0%B9%D1%80%D0%BE%D0%BD\">\u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u0438 \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043a\u043b\u0435\u0442\u043e\u043a. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430\u043a\u043e\u0434\u0438\u0442\u044c \u043f\u0440\u0438\u0448\u043b\u043e \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u0431 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%94%D0%B5%D0%BD%D0%B4%D1%80%D0%B8%D1%82\">\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435<\/a> \u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%94%D0%B5%D0%BD%D0%B4%D1%80%D0%B8%D1%82%D0%BD%D0%B0%D1%8F_%D0%BF%D0%BB%D0%B0%D1%81%D1%82%D0%B8%D1%87%D0%BD%D0%BE%D1%81%D1%82%D1%8C\">\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438<\/a> \u0434\u0435\u043d\u0434\u0440\u0438\u0442\u043e\u0432. \u0425\u043e\u0442\u044c \u0431\u041e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u044f \u043d\u0435 \u0443\u0441\u0432\u043e\u0438\u043b, \u043d\u043e \u043f\u0440\u043e\u0432\u0451\u043b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438.  <\/p>\n<ul>\n<li>\u0414\u0435\u043d\u0434\u0440\u0438\u0442\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e AND, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043e\u0442 \u0432\u0435\u0442\u0432\u0435\u0439 \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f, \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043e\u0442 \u043e\u0434\u043d\u043e\u0439 \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0432\u0435\u0442\u0432\u0435\u0439, \u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u043d\u0435 \u0434\u043e\u0439\u0434\u0451\u0442 \u0434\u043e \u0441\u043e\u043c\u044b. <\/li>\n<li>C\u043e\u043c\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 OR, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044f \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u0441\u0438\u0433\u043d\u0430\u043b.<\/li>\n<li>\u0418\u043d\u0433\u0438\u0431\u0438\u0442\u043e\u0440\u043d\u044b\u0435(\u0442\u043e\u0440\u043c\u043e\u0437\u044f\u0449\u0438\u0435) \u0441\u0432\u044f\u0437\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u043c NOT. \u041f\u0440\u0430\u0432\u0434\u0430 \u0435\u0441\u0442\u044c \u0431\u0430\u0433, \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u0438\u043a\u0438: NOT False = False, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043e\u0442 \u0442\u043e\u0440\u043c\u043e\u0437\u044f\u0449\u0435\u0439 \u0441\u0432\u044f\u0437\u0438 \u0441\u0430\u043c\u043e \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u0427\u0442\u043e \u0441\u0443\u0436\u0430\u0435\u0442 \u043a\u0440\u0443\u0433 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0434\u043e \u0442\u0435\u0445 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438 \u0432\u0441\u0435\u0445 \u043d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445(False) \u043d\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 True. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0439 \u043d\u0435\u0439\u0440\u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u0438\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0442\u0440\u0438\u0446\u0430\u043d\u0438\u0435, \u043d\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u0441\u0434\u0435\u043b\u0430\u0442\u044c XOR. \u0422\u0430\u043a\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0445\u043e\u0442\u044c \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u00ab\u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c\u00bb, \u043d\u043e \u043d\u0435\u0441\u0451\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0433\u043e\u0434\u044b. \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u044d\u043d\u0435\u0440\u0433\u043e\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c, \u0432\u0435\u0434\u044c \u0435\u0441\u043b\u0438 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435\u0439\u0440\u043e\u043d \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u044b\u043c \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0434\u0435\u043d\u0434\u0440\u0438\u0442\u044b \u043d\u0435 \u0430\u043a\u0442\u0438\u0432\u043d\u044b \u2014 \u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u044d\u043d\u0435\u0440\u0433\u0438\u044e \u0432\u043f\u0443\u0441\u0442\u0443\u044e. \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0435\u0441\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043d\u0435\u0439\u0440\u043e\u043d\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a\u0438 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0431\u0435\u0437 \u0441\u0442\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0434\u0435\u043d\u0434\u0440\u0438\u0442\u043e\u0432. \u0413\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u043c\u043e\u0436\u043d\u043e \u0441\u0438\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c AND NOT, \u043d\u043e OR NOT \u043d\u0435\u043b\u044c\u0437\u044f<\/li>\n<\/ul>\n<p>  \u0414\u0443\u043c\u0430\u044e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0438\u0440\u0438\u043a\u0438, \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0434\u0435\u043b\u0443.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import random class LogicReconstructer:     groups=[]     threshold = 0.99     maxmem = 10     numparams = 0      def __init__(self,numparams,threshold = 0.99, totalmem = 10):         self.numparams=numparams         self.threshold=threshold         self.maxmem=totalmem      def getactive(self,params):         if len(params)!=self.numparams:             raise Exception(&quot;LogicReconstructer: numparams mismatch&quot;)          active=[]         for x in range(self.numparams):             if params[x]:                 active.append(x)         return  active      def extractgroups(self,params,result):         active=self.getactive(params)         exist = False         ignore = False          if result and active:             ind=0             while ind&lt;len(self.groups):                  if len(active)&gt;len(self.groups[ind][0]) and self.issublist(self.groups[ind][0],active):                     ignore=True                     break                  elif len(active)==len(self.groups[ind][0]) and self.issublist(active,self.groups[ind][0]):                     exist=True                     break                  elif len(active)&lt;len(self.groups[ind][0]) and self.issublist(active,self.groups[ind][0]):                     del self.groups[ind]                     ind-=1                  ind+=1              if not exist and not ignore:                 self.groups.append([active,[0]*self.numparams,False])      def extractinhibitors(self,params,result):         active=self.getactive(params)          if result:             count=0             for _,grp in enumerate(self.groups):                 if self.issublist(grp[0],active):                     count+=1                     if count&gt;1:                         return          for _,grp in enumerate(self.groups):             if not grp[2] and self.issublist(grp[0],active):                  neg=[]                 negvalue=False                 for y in range(self.numparams):                     if grp[1][y]&lt;=-self.threshold:                         neg.append(y)                         negvalue|=params[y]                     elif grp[1][y]&gt;=self.threshold:                         grp[2]=True                  for y in range(self.numparams):                     if params[y]:                         if y in neg or not negvalue:                             grp[1][y] = self.counting(grp[1][y],self.maxmem,result)       def counting(self,prc,total,item):         result=prc-prc\/total         if not item:             result-=1\/total         else:             result+=1\/total         return result      def issublist(self,a,b):         for ind,item in enumerate(a):             if item not in b:                 return False         return True      def getsublist(self,a,b):         result=[]         for ind,item in enumerate(a):             if item in b:                 result.append(item)         return result      def simulate(self,params):         result=False         for ind,item in enumerate(self.groups):             if item[2]:                 locres=True                 for x in range(len(item[0])):                     locres&=params[item[0][x]]                 for x in range(len(item[1])):                     if item[1][x]&lt;=-self.threshold:                         locres=locres&~params[x]                 result|=locres         return result      def getlogicfunc(self,guess=False):         result=&quot;&quot;         for ind,item in enumerate(self.groups):             if item[2] or guess:                 locres=&quot;&quot;                 for x in range(len(item[0])):                     if x!=0:                         locres+=&quot; and &quot;                     locres+=str(item[0][x])                 for x in range(len(item[1])):                     if item[1][x]&lt;=-self.threshold:                         locres+=&quot; and not &quot;+str(x)                 if ind!=0:                     result+=&quot; or &quot;                 result+=locres         return result      def randparams(self):         result = []         for x in range(self.numparams):             result.append(random.choice([True, False]))         return result      def isready(self):         result=bool(self.groups)         for ind,item in enumerate(self.groups):             result&=item[2]         return result      def getlogicstuct(self):         result = []         for _,item in enumerate(self.groups):             grp=[]             if item[2]:                 for x in range(len(item[0])):                     grp.append([item[0][x],True])                 for x in range(len(item[1])):                     if item[1][x]&lt;=-self.threshold:                         grp.append([x,False])             if grp:                 result.append(grp)         return result      def simulatebystruct(self,params,grps):         for _,item in enumerate(grps):             locres=True             for _,param in enumerate(item):                 if param[1]:                     locres&=params[param[0]]                 else:                     locres&=~params[param[0]]                 if not locres:                     break             if locres:                 return True          return  False  def customlogic(params):     return params[0] and  params[1] and not params[5]and  params[11] or params[2] and not params[3]  \\                or params[0] and  params[5] and not params[6] or  params[7] and not params[8]  def newme():     numparams = 12     neuron=LogicReconstructer(numparams)     while not neuron.isready():         params=neuron.randparams()         funcresult=customlogic(params)         neuron.extractgroups(params,funcresult)         neuron.extractinhibitors(params,funcresult)      for x in range(1000):         params=neuron.randparams()         if neuron.simulate(params)!=customlogic(params):             print(&quot;Simulate is wrong.&quot;)             return      print(neuron.getlogicfunc())  if __name__ == &quot;__main__&quot;:     newme() <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418\u0442\u0430\u043a, \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043f\u0440\u0438\u0447\u0451\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445 \u043c\u043e\u0433\u0443\u0442 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u043a\u0430\u043a\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432\u0430\u0436\u043d\u044b. \u041b\u0443\u0447\u0448\u0435 \u043d\u0430\u0447\u0430\u0442\u044c \u0441\u043e \u0441\u0431\u043e\u0440\u0430 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f, \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u0435\u0441\u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 True, \u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u043c\u0435\u0440\u0430 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0431\u0430\u0437\u0443, \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043e\u0433\u043e\u0432\u043e\u0440\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <b>extractgroups<\/b>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043d\u0430\u0439\u0434\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c AND. \u042d\u0442\u043e\u0442 \u044d\u0442\u0430\u043f \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0441 \u043e\u0442\u0440\u0430\u0449\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u0435\u043d\u0434\u0440\u0438\u0442\u043e\u0432.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0436\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0441\u0438\u043d\u0430\u043f\u0441\u043e\u0432 \u0438 \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u043e\u0440\u043c\u043e\u0437\u044f\u0449\u0438\u0435 \u0441\u0432\u044f\u0437\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u0433\u0440\u0443\u043f\u043f\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u043d\u043e \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c\u0438 \u043e\u0442 \u0442\u043e\u0440\u043c\u043e\u0437\u044f\u0449\u0438\u0445 \u0441\u0432\u044f\u0437\u0435\u0439, \u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A2%D0%B5%D0%BE%D1%80%D0%B5%D0%BC%D0%B0_%D0%91%D0%B0%D0%B9%D0%B5%D1%81%D0%B0\">\u0442\u0435\u043e\u0440\u0435\u043c\u043e\u0439 \u0411\u0430\u0439\u0435\u0441\u0430<\/a>. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u0435\u0441\u043b\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430, \u0442\u043e \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0415\u0441\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0442.\u0435. \u043f\u0440\u0438 \u0435\u0433\u043e \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0431\u044b\u043b False, \u0442\u043e \u043e\u043d \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u0440\u043c\u043e\u0437\u044f\u0449\u0438\u043c(AND NOT). \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <b>extractinhibitors<\/b>.<\/p>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u043e\u0439 \u043a\u043e\u0433\u0434\u0430, \u0432\u0441\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u0441\u0435 \u0442\u043e\u0440\u043c\u043e\u0437\u044f\u0449\u0438\u0435 \u0441\u0432\u044f\u0437\u0438 \u0431\u044b\u043b\u0438 \u043d\u0430\u0439\u0434\u0435\u043d\u044b. \u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0411\u0430\u0439\u0435\u0441\u043e\u0432\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u0435\u0440\u0435\u0448\u0430\u0433\u043d\u0443\u043b\u0430 \u0447\u0435\u0440\u0435\u0437 <b>threshold<\/b>.<\/p>\n<p>  \u041d\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0442\u043e \u043a\u0430\u043a \u044d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"python\">params[0] and params[1] and not params[2] or params[3] and random.choice([True, False]) <\/code><\/pre>\n<p>  \u041c\u044b \u0437\u043d\u0430\u0435\u043c \u043f\u0440\u043e 4 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u043d\u043e \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043f\u044f\u0442\u044b\u0439. \u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u043b\u0438\u0448\u044c \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 3, \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0443\u043f\u0438\u0442 \u043f\u043e\u0440\u043e\u0433 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f(<b>threshold<\/b>). \u041d\u043e \u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0435\u0433\u043e \u0443\u0447\u043b\u0438, \u0442\u043e \u043e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u0441\u044f \u0431\u044b \u0432 \u043e\u0434\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u0441 3-\u0438\u043c. \u041a\u0430\u043a \u0412\u044b \u043f\u043e\u043d\u044f\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c OR. <\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0446\u0435\u043b\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b:  <\/p>\n<pre><code class=\"python\">params[0] and params[1] and not params[2] or random.choice([True, False]) and random.choice([True, False]) <\/code><\/pre>\n<p> \u0442\u043e \u0433\u0440\u0443\u043f\u043f\u044b(\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u0435 \u0437\u0430 \u0442\u0430\u0432\u0442\u043e\u043b\u043e\u0433\u0438\u044e) \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0441\u0442\u0430\u043d\u0435\u0442 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c, \u0447\u0442\u043e \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u043c.<\/p>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f \u0441 <b>customlogic<\/b>, \u0434\u0430\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u042f \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u043e\u0440\u043c\u043e\u0437\u044f\u0449\u0438\u0445 \u0441\u0432\u044f\u0437\u0435\u0439 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435, \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0411\u043e\u043d\u0443\u0441\u043d\u0430\u044f C++ \u043f\u0440\u043e\u0441\u0442\u044b\u043d\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/\/ neuro.cpp: \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u043e\u0447\u043a\u0443 \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \/\/  #include &quot;stdafx.h&quot; #include &lt;vector&gt; #include &lt;map&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt; #include &lt;iostream&gt;  using namespace std;  class Bool { public:  \tBool(): m_value(){} \tBool( bool value ) : m_value(value){}  \toperator bool() const { return m_value;}  \tbool* operator& () { return &m_value; } \tconst bool * const operator& () const { return &m_value; }  private:  \tbool m_value;  };  class neuron { public: \tdouble threshold; \tint synapticmem; \tint numparams; \tmap&lt;int,vector&lt;char&gt;&gt; groups; \tmap&lt;int,vector&lt;double&gt;&gt; bayesian; \tmap&lt;int,map&lt;char,bool&gt;&gt; grouplogic; \tint maxid;  \tneuron(int numparams, double threshold = 0.99, int synapticmem = 10) \t{ \t\tthis-&gt;numparams=numparams; \t\tthis-&gt;threshold=threshold; \t\tthis-&gt;synapticmem=synapticmem; \t\tmaxid=0; \t\tsrand ( time(NULL) ); \t} \t~neuron() \t{  \t} \t \tvector&lt;char&gt; getactive(vector&lt;Bool&gt;& params) \t{ \t\tif (params.size()!=numparams) \t\t\tthrow 1;\/\/ numparams mismatch \t\t \t\tvector&lt;char&gt; active; \t\tfor (int i=0;i&lt;this-&gt;numparams;i++) \t\t\tif (params[i]) \t\t\t\tactive.push_back((char)i);  \t\treturn active; \t}  \tvoid extractgroups(vector&lt;Bool&gt;& params, bool result) \t{ \t\tvector&lt;char&gt; active= this-&gt;getactive(params); \t\tbool ignore = false; \t\tbool exist = false; \t\t \t\tif (result && active.size()&gt;0) \t\t{ \t\t\tmap&lt;int,vector&lt;char&gt;&gt;::iterator i=this-&gt;groups.begin(); \t\t\twhile (i!=this-&gt;groups.end()) \t\t\t{ \t\t\t\tif (active.size()&gt;i-&gt;second.size()&&this-&gt;issublist(i-&gt;second,active)) \t\t\t\t\t{ \t\t\t\t\t\tignore=true; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\telse if (active.size()==i-&gt;second.size()&&this-&gt;issublist(active,i-&gt;second)) \t\t\t\t\t{ \t\t\t\t\t\texist=true; \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\telse if (active.size()&lt;i-&gt;second.size()&&this-&gt;issublist(active,i-&gt;second)) \t\t\t\t\t{ \t\t\t\t\t\tthis-&gt;bayesian.erase(i-&gt;first); \t\t\t\t\t\tthis-&gt;grouplogic.erase(i-&gt;first); \t\t\t\t\t\ti=this-&gt;groups.erase(i); \t\t\t\t\t} \t\t\t\t\telse \t\t\t\t\t\ti++; \t\t\t} \t\t\tif (!exist && !ignore) \t\t\t{ \t\t\t\tthis-&gt;groups[this-&gt;maxid]=active; \t\t\t\tthis-&gt;bayesian[this-&gt;maxid]=*new vector&lt;double&gt;(numparams,0); \t\t\t\tthis-&gt;maxid++; \t\t\t} \t\t} \t}  \ttemplate&lt; class T &gt; \tbool issublist(vector&lt;T&gt;& sublist, vector&lt;T&gt;& fulllist) \t{ \t\tfor (int i=0;i&lt;sublist.size();i++) \t\t{ \t\t\tbool match = false; \t\t\tfor (int n=0;n&lt;fulllist.size();n++) \t\t\t\tif (sublist[i]==fulllist[n]) \t\t\t\t{ \t\t\t\t\tmatch=true; \t\t\t\t\tbreak; \t\t\t\t} \t\t\tif (!match) \t\t\t\treturn false;\t \t\t} \t\treturn true; \t}  \ttemplate&lt;class InputIterator, class T&gt; \tInputIterator find (InputIterator first, InputIterator last, const T& val) \t{ \t\twhile (first!=last) { \t\t\tif (*first==val) return first; \t\t\t++first; \t\t} \t\treturn last; \t}  \tvoid extractinhibitors(vector&lt;Bool&gt;& params, bool result) \t{ \t\tvector&lt;char&gt; active= this-&gt;getactive(params);  \t\tif (result) \t\t{ \t\t\tbool count = false; \t\t\tfor (map&lt;int,vector&lt;char&gt;&gt;::iterator i=this-&gt;groups.begin();i!=this-&gt;groups.end();++i) \t\t\t\tif(this-&gt;issublist(i-&gt;second,active)) \t\t\t\t\tif (!count) \t\t\t\t\t\tcount=true; \t\t\t\t\telse \t\t\t\t\t\treturn; \t\t}  \t\tfor (map&lt;int,vector&lt;char&gt;&gt;::iterator i=this-&gt;groups.begin();i!=this-&gt;groups.end();++i) \t\t\tif (grouplogic.count(i-&gt;first)==0)   \t\t\t\tif (this-&gt;issublist(i-&gt;second,active)) \t\t\t\t{ \t\t\t\t\tvector&lt;char&gt; neg; \t\t\t\t\tbool negvalue = false; \t\t\t\t\tfor (int n=0;n&lt;this-&gt;numparams;n++) \t\t\t\t\t\tif (this-&gt;bayesian[i-&gt;first][n]&lt;=-1*this-&gt;threshold) \t\t\t\t\t\t{ \t\t\t\t\t\t\tneg.push_back((char)n); \t\t\t\t\t\t\tnegvalue|=params[n]; \t\t\t\t\t\t} \t\t\t\t\t\telse if (this-&gt;bayesian[i-&gt;first][n]&gt;=this-&gt;threshold) \t\t\t\t\t\t\tif (grouplogic.count(i-&gt;first)==0) \t\t\t\t\t\t\t\tthis-&gt;build_grouplogic(i-&gt;first); \t\t\t\t\t \t\t\t\t\tfor (int n=0;n&lt;this-&gt;numparams;n++) \t\t\t\t\t\tif (params[n]) \t\t\t\t\t\t\tif (!negvalue || this-&gt;find(neg.begin(), neg.end(), n) != neg.end())  \t\t\t\t\t\t\t\t\tthis-&gt;bayesian[i-&gt;first][n]=counting(this-&gt;bayesian[i-&gt;first][n],result); \t\t\t\t} \t}  \t double counting(double prc, bool result) \t { \t\t double oneless = prc - prc\/this-&gt;synapticmem; \t\t if (result) \t\t\t oneless+=1.0\/this-&gt;synapticmem; \t\t else \t\t\t oneless-=1.0\/this-&gt;synapticmem; \t\t return oneless; \t } \tvoid build_grouplogic(int indgroup) \t{ \t\tfor (int i=0;i&lt;this-&gt;groups[indgroup].size();i++) \t\t\t this-&gt;grouplogic[indgroup][(char)groups[indgroup][i]]=true; \t\t \t\tfor (int i=0;i&lt;numparams;i++) \t\t\tif (this-&gt;bayesian[indgroup][i]&lt;=-1*threshold) \t\t\t\tthis-&gt;grouplogic[indgroup][(char)i]=false; \t} \tbool isready() \t{ \t\tint count = 0; \t\tfor (map&lt;int,vector&lt;char&gt;&gt;::iterator i=this-&gt;groups.begin();i!=this-&gt;groups.end();++i)  \t\t\tif (grouplogic.count(i-&gt;first)!=0) \t\t\t\tcount++; \t\tif (count==groups.size()&&groups.size()&gt;0) \t\t\treturn true; \t\treturn false; \t} \tbool randomBool() { \t\treturn rand() % 2 == 1; \t} \tvoid randparams(vector&lt;Bool&gt;& params) \t{ \t\tfor (int i=0;i&lt;this-&gt;numparams;i++) \t\t\tparams[i]=this-&gt;randomBool(); \t} \tstring getfunction() \t{ \t\tstring result=&quot;&quot;; \t\tbool maincount=false; \t\tfor (map&lt;int,map&lt;char,bool&gt;&gt;::iterator i=this-&gt;grouplogic.begin();i!=this-&gt;grouplogic.end();++i) \t\t{\t \t\t\tif (maincount) \t\t\t\tresult+=&quot; or &quot;;  \t\t\tstring locres=&quot;&quot;; \t\t\tbool count = false; \t\t\tfor (map&lt;char,bool&gt;::reverse_iterator n=i-&gt;second.rbegin();n!=i-&gt;second.rend();++n) \t\t\t{ \t\t\t\tif (count) \t\t\t\t\tlocres+=&quot; and &quot;; \t\t\t\tif (!n-&gt;second) \t\t\t\t\tlocres+=&quot;not &quot;; \t\t\t\tlocres+=(char)(((int)'0')+(int)n-&gt;first); \t\t\t\tcount=true; \t\t\t} \t\t\tresult+=locres; \t\t\tmaincount=true; \t\t} \t\treturn result; \t}  \tbool simulate(vector&lt;Bool&gt;& params) \t{ \t\tbool result=false; \t\tfor (map&lt;int,map&lt;char,bool&gt;&gt;::iterator i=this-&gt;grouplogic.begin();i!=this-&gt;grouplogic.end();++i) \t\t{\t \t\t\tbool locres=true; \t\t\tbool count = false; \t\t\tfor (map&lt;char,bool&gt;::iterator n=i-&gt;second.begin();n!=i-&gt;second.end();++n) \t\t\t{ \t\t\t\tif (n-&gt;second) \t\t\t\t\tlocres&=params[(int)n-&gt;first]; \t\t\t\telse \t\t\t\t\tlocres&=!params[(int)n-&gt;first]; \t\t\t} \t\t\tresult|=locres; \t\t} \t\treturn result; \t}  };  bool customlogic(vector&lt;Bool&gt;& params) { \treturn params[0] && params[1] && !params[2] || params[3] && !params[1] || params[5] && !params[0] && params[1]; }  int _tmain(int argc, _TCHAR* argv[]) { \tint numparams = 6; \t \tclock_t start = clock() ; \t \tneuron* nine=new neuron(numparams); \twhile (!nine-&gt;isready()) \t{ \t\tvector&lt;Bool&gt; params(numparams, false); \t\tnine-&gt;randparams(params); \t\tbool result = customlogic(params); \t\tnine-&gt;extractgroups(params,result); \t\tnine-&gt;extractinhibitors(params,result); \t} \tclock_t end = clock(); \tdouble elapsed_time = (end-start)\/(double)CLOCKS_PER_SEC; \t \tfor (int i=0;i&lt;1000;i++) \t{\t \t\tvector&lt;Bool&gt; params(numparams, false); \t\tnine-&gt;randparams(params); \t\tif (nine-&gt;simulate(params)!=customlogic(params)) \t\t{ \t\t\tprintf(&quot;Simulate is wrong&quot;); \t\t\treturn 0; \t\t} \t}  \tprintf(&quot;%s\\n%.3f sec\\n&quot;,nine-&gt;getfunction().c_str(),elapsed_time);  \tgetchar(); \treturn 0; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442<\/h4>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u0447\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043b\u0438 \u043e\u043d \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0438\u0440\u0430? \u042f \u0440\u0435\u0448\u0438\u043b \u044d\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0437\u044f\u0442\u043e\u043c <a href=\"http:\/\/archive.ics.uci.edu\/ml\/datasets\/banknote+authentication\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a>. \u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u043b\u044c\u0448\u0438\u0432\u044b\u0435 \u0431\u0430\u043d\u043a\u043d\u043e\u0442\u044b \u043e\u0442 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u043f\u043e \u0447\u0435\u0442\u044b\u0440\u0451\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c. \u041d\u0430\u0434\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u044f \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u043f\u043e\u043d\u044f\u043b \u0447\u0442\u043e, \u043e\u043d\u0438 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442. \u0412\u043f\u0440\u043e\u0447\u0435\u043c \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0440\u0443\u043a\u0443 \u0447\u0438\u0441\u0442\u043e\u0442\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430, \u0432\u0435\u0434\u044c \u043e\u0431\u0443\u0447\u0430\u0442\u044c\u0441\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0430, \u0430 \u043d\u0435 \u044f.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u043e\u0442 \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def getbinary(num,max,min =0 ):     result=[]     binnums=int(math.ceil(math.log(abs(min-max),2)))     binstr=('{0:0'+str(binnums)+'b}').format(-min+num)     for _,item in enumerate(binstr):         if item=='1':             result.append(True)         else:             result.append(False)     return result  def banknotes():     file = open('C:\/bankdata.txt', 'r')# http:\/\/archive.ics.uci.edu\/ml\/datasets\/banknote+authentication     lines = file.readlines()     file.close()      data = []      for i in range(len(lines)):         data.append(lines[i].strip().split(&quot;,&quot;))     lines.clear()      numdata = []     paramsmax=[0,0,0,0]     paramsmin=[0,0,0,0]     for i in range(len(data)):         tmp=[]         for x in range(len(data[i])):             if x!=4:                 tmp.append(int(round(float(data[i][x]))))                 paramsmax[x]=max(paramsmax[x],int(round(float(data[i][x]))))                 paramsmin[x]=min(paramsmin[x],int(round(float(data[i][x]))))             else:                 if data[i][x]=='0':                     tmp.append(False)                 else:                     tmp.append(True)         numdata.append(tmp)     data.clear()       bindata=[]     for i in range(len(numdata)):         tmp=[]         for x in range(len(numdata[i])):             if x!=4:                 tmp.extend(getbinary(numdata[i][x],paramsmax[x],paramsmin[x]))             else:                 tmp.extend([numdata[i][x]])         bindata.append(tmp)     numdata.clear()      neuron = LogicReconstructer(len(bindata[0])-1,totalmem=7, threshold=0.98)      for _,item in enumerate(bindata):         neuron.extractgroups(item[:-1],item[-1:][0])      ready=False     while not neuron.isready():         rnd=random.randint(0,len(bindata)-1)         neuron.extractinhibitors(bindata[rnd][:-1],bindata[rnd][-1:][0])      logicstruct=neuron.getlogicstuct()     print(logicstruct)      falsepositive = 0     falsenegative = 0     for _,item in enumerate(bindata):        res = neuron.simulatebystruct(item[:-1],logicstruct)        if res!=item[-1:][0]:            if res:                falsepositive+=1            else:                falsenegative+=1     print(falsenegative\/len(bindata),falsepositive\/len(bindata)) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043e\u043a\u0440\u0443\u0433\u043b\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u0430 \u0434\u043e \u0446\u0435\u043b\u044b\u0445 \u0438 \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0432 \u0431\u0438\u043d\u0430\u0440\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <b>getbinary<\/b>. \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0443 \u043c\u0435\u043d\u044f \u0432\u044b\u0448\u043b\u0430 \u0432\u043e\u0442 \u0442\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 134-\u0451\u0445 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0433\u0440\u0443\u043f\u043f:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">logicstruct<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">    logicstr=&quot;[[[2, True], [3, True], [6, True], [7, True], [10, True], [11, True], [12, True], [13, True], [14, True], [16, True]], [[1, True], [3, True], [4, True], [8, True], [12, True], [15, True], [16, True], [17, True]], [[1, True], [3, True], [5, True], [10, True], [12, True], [14, True], [16, True], [6, False], [7, False], [8, False], [11, False]], [[1, True], [2, True], [5, True], [6, True], [7, True], [11, True], [13, True], [14, True], [16, True], [10, False]], [[1, True], [2, True], [5, True], [6, True], [11, True], [12, True], [13, True], [14, True], [16, True]], [[2, True], [3, True], [8, True], [9, True], [12, True], [15, True], [16, True]], [[1, True], [2, True], [3, True], [4, True], [8, True], [15, True], [17, True], [6, False], [7, False], [11, False]], [[1, True], [4, True], [7, True], [8, True], [11, True], [15, True], [2, False], [6, False]], [[1, True], [6, True], [10, True], [11, True], [12, True], [15, True], [16, True], [17, True]], [[0, True], [5, True], [6, True], [7, True], [8, True], [12, True], [14, True], [17, True], [10, False], [11, False], [13, False]], [[0, True], [4, True], [7, True], [15, True], [17, True], [6, False], [16, False]], [[1, True], [3, True], [5, True], [10, True], [12, True], [14, True], [17, True], [2, False], [6, False], [7, False]], [[0, True], [5, True], [6, True], [7, True], [12, True], [13, True], [14, True], [16, True], [2, False], [11, False]], [[0, True], [4, True], [7, True], [8, True], [16, True], [17, True], [6, False], [15, False]], [[1, True], [4, True], [8, True], [11, True], [13, True], [14, True], [2, False]], [[0, True], [4, True], [12, True], [14, True], [17, True], [6, False], [11, False], [13, False]], [[2, True], [3, True], [4, True], [8, True], [11, True], [15, True], [17, True], [1, False], [6, False], [7, False]], [[1, True], [3, True], [5, True], [6, True], [7, True], [11, True], [14, True], [2, False], [10, False], [12, False]], [[1, True], [2, True], [4, True], [12, True], [14, True], [11, False]], [[1, True], [6, True], [7, True], [8, True], [9, True], [14, True]], [[2, True], [5, True], [9, True], [14, True]], [[1, True], [4, True], [7, True], [11, True], [13, True], [14, True], [2, False], [3, False], [8, False], [12, False], [17, False]], [[1, True], [3, True], [5, True], [8, True], [10, True], [11, True], [14, True], [17, True], [6, False]], [[2, True], [3, True], [6, True], [7, True], [9, True], [13, True], [14, True]], [[1, True], [5, True], [6, True], [8, True], [11, True], [12, True], [13, True], [14, True], [16, True], [0, False], [7, False]], [[2, True], [3, True], [7, True], [9, True], [11, True], [14, True]], [[1, True], [5, True], [6, True], [7, True], [11, True], [12, True], [14, True], [16, True], [0, False], [8, False]], [[1, True], [3, True], [4, True], [8, True], [12, True], [13, True], [15, True], [16, True], [2, False], [5, False], [6, False], [11, False]], [[1, True], [6, True], [8, True], [10, True], [11, True], [12, True], [14, True]], [[1, True], [2, True], [4, True], [8, True], [13, True], [15, True], [16, True], [6, False]], [[1, True], [2, True], [5, True], [6, True], [10, True], [14, True], [16, True], [11, False], [13, False]], [[2, True], [3, True], [4, True], [7, True], [8, True], [11, True], [15, True], [1, False], [6, False], [17, False]], [[1, True], [6, True], [10, True], [11, True], [13, True], [15, True], [16, True], [17, True]], [[1, True], [2, True], [5, True], [7, True], [11, True], [12, True], [13, True], [14, True], [16, True]], [[2, True], [4, True], [6, True], [8, True], [11, True], [13, True], [16, True], [0, False], [15, False]], [[1, True], [5, True], [6, True], [7, True], [10, True], [14, True], [17, True], [2, False], [8, False], [11, False], [12, False]], [[1, True], [5, True], [10, True], [12, True], [13, True], [14, True], [16, True]], [[0, True], [4, True], [7, True], [15, True], [16, True], [6, False], [17, False]], [[1, True], [2, True], [3, True], [4, True], [7, True], [8, True], [16, True], [17, True], [6, False]], [[1, True], [2, True], [5, True], [6, True], [11, True], [14, True], [17, True], [10, False], [12, False]], [[1, True], [2, True], [4, True], [8, True], [12, True], [15, True], [16, True]], [[1, True], [4, True], [11, True], [13, True], [15, True], [16, True], [17, True], [5, False], [6, False], [7, False], [8, False]], [[2, True], [3, True], [5, True], [10, True], [11, True], [12, True], [13, True], [14, True]], [[2, True], [5, True], [8, True], [10, True], [11, True], [12, True], [13, True], [14, True]], [[1, True], [2, True], [5, True], [6, True], [7, True], [8, True], [11, True], [14, True], [3, False], [10, False], [12, False], [16, False], [17, False]], [[1, True], [7, True], [9, True], [13, True], [15, True], [16, True]], [[1, True], [2, True], [5, True], [10, True], [13, True], [14, True], [17, True], [3, False], [6, False], [11, False]], [[0, True], [5, True], [6, True], [7, True], [8, True], [11, True], [14, True], [17, True], [12, False], [16, False]], [[1, True], [3, True], [6, True], [7, True], [10, True], [11, True], [14, True], [5, False]], [[0, True], [5, True], [7, True], [8, True], [11, True], [12, True], [13, True], [14, True], [16, True], [2, False], [6, False]], [[2, True], [3, True], [4, True], [6, True], [11, True], [13, True], [16, True], [17, True], [1, False], [7, False], [8, False], [15, False]], [[1, True], [5, True], [6, True], [8, True], [10, True], [14, True], [17, True], [11, False]], [[1, True], [2, True], [5, True], [8, True], [10, True], [14, True], [17, True], [3, False], [6, False], [11, False]], [[2, True], [4, True], [6, True], [7, True], [11, True], [13, True], [15, True], [1, False], [16, False], [17, False]], [[1, True], [4, True], [11, True], [12, True], [14, True], [17, True], [2, False], [3, False], [13, False]], [[1, True], [2, True], [3, True], [5, True], [6, True], [7, True], [8, True], [12, True], [13, True], [14, True]], [[1, True], [2, True], [5, True], [6, True], [10, True], [12, True], [14, True], [17, True], [3, False], [7, False]], [[1, True], [6, True], [7, True], [9, True], [13, True], [14, True]], [[1, True], [9, True], [11, True], [12, True], [13, True], [15, True], [16, True], [17, True]], [[1, True], [7, True], [9, True], [12, True], [13, True], [14, True]], [[1, True], [2, True], [5, True], [10, True], [12, True], [14, True], [16, True]], [[3, True], [4, True], [6, True], [11, True], [12, True], [16, True], [0, False]], [[1, True], [8, True], [9, True], [12, True], [15, True], [16, True]], [[2, True], [4, True], [6, True], [7, True], [11, True], [13, True], [17, True], [15, False]], [[1, True], [2, True], [6, True], [7, True], [8, True], [10, True], [12, True], [14, True], [17, True]], [[2, True], [3, True], [4, True], [8, True], [11, True], [13, True], [14, True], [1, False], [12, False]], [[0, True], [4, True], [8, True], [13, True], [14, True], [2, False], [11, False], [12, False], [16, False], [17, False]], [[2, True], [3, True], [4, True], [8, True], [11, True], [15, True], [16, True], [1, False], [6, False], [7, False], [17, False]], [[2, True], [4, True], [8, True], [11, True], [12, True], [14, True], [0, False], [3, False]], [[1, True], [5, True], [6, True], [7, True], [11, True], [13, True], [14, True], [17, True], [0, False]], [[2, True], [3, True], [6, True], [8, True], [9, True], [13, True], [14, True]], [[1, True], [5, True], [6, True], [8, True], [10, True], [14, True], [16, True], [11, False]], [[1, True], [2, True], [6, True], [7, True], [10, True], [11, True], [14, True], [17, True]], [[1, True], [3, True], [6, True], [10, True], [11, True], [13, True], [14, True], [5, False]], [[1, True], [2, True], [3, True], [5, True], [7, True], [8, True], [11, True], [12, True], [14, True], [16, True]], [[2, True], [3, True], [4, True], [6, True], [11, True], [12, True], [15, True], [1, False], [7, False]], [[1, True], [2, True], [5, True], [10, True], [13, True], [14, True], [16, True], [6, False], [11, False]], [[1, True], [2, True], [3, True], [5, True], [6, True], [8, True], [11, True], [14, True], [16, True]], [[1, True], [2, True], [5, True], [6, True], [7, True], [8, True], [12, True], [13, True], [14, True], [17, True]], [[1, True], [3, True], [5, True], [6, True], [10, True], [13, True], [14, True], [17, True], [2, False], [11, False]], [[2, True], [3, True], [9, True], [11, True], [12, True], [13, True], [15, True], [16, True]], [[2, True], [3, True], [6, True], [7, True], [8, True], [9, True], [14, True], [17, True]], [[1, True], [8, True], [9, True], [11, True], [13, True], [14, True]], [[1, True], [2, True], [6, True], [7, True], [10, True], [11, True], [14, True], [16, True], [5, False], [13, False]], [[1, True], [3, True], [6, True], [10, True], [11, True], [12, True], [14, True], [17, True]], [[1, True], [2, True], [7, True], [8, True], [10, True], [11, True], [12, True], [13, True], [14, True]], [[0, True], [5, True], [6, True], [7, True], [11, True], [14, True], [16, True], [8, False], [12, False], [13, False]], [[1, True], [4, True], [7, True], [11, True], [15, True], [17, True], [2, False], [6, False]], [[0, True], [5, True], [7, True], [11, True], [12, True], [13, True], [14, True], [16, True], [17, True], [2, False], [6, False]], [[3, True], [4, True], [6, True], [7, True], [11, True], [13, True], [15, True], [0, False], [17, False]], [[1, True], [3, True], [5, True], [6, True], [11, True], [12, True], [13, True], [14, True], [16, True]], [[1, True], [3, True], [5, True], [10, True], [11, True], [13, True], [14, True], [17, True], [2, False], [6, False]], [[1, True], [6, True], [7, True], [10, True], [11, True], [12, True], [13, True], [14, True], [16, True]], [[1, True], [3, True], [4, True], [8, True], [12, True], [13, True], [15, True], [17, True], [2, False], [6, False], [7, False], [11, False]], [[4, True], [6, True], [8, True], [11, True], [12, True], [17, True], [0, False], [15, False]], [[1, True], [7, True], [8, True], [10, True], [11, True], [12, True], [15, True], [16, True], [17, True]], [[1, True], [5, True], [10, True], [12, True], [13, True], [14, True], [17, True]], [[1, True], [3, True], [6, True], [7, True], [8, True], [10, True], [12, True], [14, True]], [[0, True], [5, True], [6, True], [7, True], [12, True], [13, True], [14, True], [17, True], [3, False], [8, False], [11, False]], [[3, True], [4, True], [6, True], [7, True], [8, True], [11, True], [13, True], [16, True], [15, False]], [[2, True], [3, True], [4, True], [11, True], [12, True], [14, True], [0, False], [1, False], [8, False]], [[4, True], [6, True], [7, True], [8, True], [11, True], [13, True], [15, True], [1, False], [2, False], [3, False]], [[1, True], [2, True], [4, True], [11, True], [14, True], [3, False], [6, False], [10, False]], [[2, True], [3, True], [6, True], [7, True], [9, True], [12, True], [15, True], [16, True], [17, True]], [[1, True], [3, True], [4, True], [7, True], [11, True], [15, True], [16, True], [2, False], [6, False]], [[2, True], [3, True], [8, True], [9, True], [11, True], [13, True], [15, True], [16, True], [17, True]], [[2, True], [3, True], [6, True], [7, True], [10, True], [11, True], [12, True], [13, True], [14, True], [17, True]], [[1, True], [3, True], [4, True], [7, True], [12, True], [13, True], [15, True], [17, True], [6, False]], [[1, True], [4, True], [8, True], [11, True], [15, True], [16, True], [2, False], [13, False]], [[1, True], [6, True], [7, True], [8, True], [10, True], [12, True], [13, True], [14, True]], [[1, True], [2, True], [5, True], [7, True], [11, True], [12, True], [13, True], [14, True], [17, True]], [[2, True], [4, True], [6, True], [8, True], [11, True], [13, True], [17, True], [0, False], [15, False]], [[1, True], [2, True], [3, True], [5, True], [6, True], [7, True], [12, True], [13, True], [14, True], [17, True]], [[4, True], [5, True], [11, True], [13, True], [16, True], [1, False], [15, False]], [[1, True], [2, True], [4, True], [8, True], [12, True], [15, True], [17, True], [11, False]], [[2, True], [3, True], [4, True], [7, True], [11, True], [15, True], [17, True], [1, False], [6, False]], [[2, True], [4, True], [7, True], [11, True], [12, True], [14, True], [0, False], [3, False]], [[2, True], [3, True], [5, True], [6, True], [7, True], [11, True], [12, True], [14, True], [17, True], [0, False], [8, False], [16, False]], [[1, True], [3, True], [4, True], [11, True], [14, True], [2, False], [6, False], [16, False]], [[2, True], [3, True], [6, True], [7, True], [9, True], [13, True], [15, True], [16, True], [17, True]], [[2, True], [8, True], [9, True], [11, True], [14, True]], [[1, True], [2, True], [3, True], [4, True], [7, True], [15, True], [17, True], [6, False], [11, False]], [[1, True], [6, True], [7, True], [8, True], [10, True], [11, True], [14, True], [5, False]], [[1, True], [2, True], [3, True], [5, True], [6, True], [7, True], [12, True], [13, True], [14, True], [16, True]], [[1, True], [5, True], [6, True], [11, True], [12, True], [14, True], [17, True], [2, False]], [[2, True], [3, True], [4, True], [11, True], [13, True], [15, True], [16, True], [1, False]], [[2, True], [8, True], [9, True], [11, True], [12, True], [15, True], [16, True]], [[0, True], [5, True], [6, True], [7, True], [11, True], [13, True], [14, True], [17, True], [1, False], [2, False], [8, False], [12, False]], [[1, True], [2, True], [6, True], [10, True], [11, True], [12, True], [14, True], [17, True]], [[0, True], [4, True], [8, True], [13, True], [15, True], [17, True], [2, False], [3, False], [5, False], [6, False]], [[1, True], [3, True], [7, True], [8, True], [10, True], [11, True], [12, True], [14, True], [5, False], [6, False], [16, False]], [[1, True], [2, True], [3, True], [5, True], [8, True], [11, True], [12, True], [13, True], [14, True], [16, True]], [[1, True], [2, True], [3, True], [5, True], [6, True], [11, True], [13, True], [14, True], [16, True], [10, False]], [[1, True], [4, True], [8, True], [11, True], [15, True], [17, True], [2, False], [12, False]]]&quot;     logicstruct=literal_eval(logicstr) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0430\u0451\u0442 2.8% \u043b\u043e\u0436\u043d\u043e \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438 0.6% \u043b\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u042d\u0442\u0438 134 \u0433\u0440\u0443\u043f\u043f\u044b \u043e\u0431\u043e\u0431\u0449\u0438\u043b\u0438 \u043e\u043a\u043e\u043b\u043e 700 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432. \u0412\u0441\u0435\u0433\u043e \u0431\u044b\u043b\u043e 1372 \u0437\u0430\u043f\u0438\u0441\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u043c\u043e\u0436\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443. \u0422\u0430\u043a \u0436\u0435 \u043f\u0440\u043e\u0448\u0443 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u044f \u043d\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u043b \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u044e \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u0447\u043d\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0438 \u043a\u0440\u0438\u0442\u0438\u043a\u0430 \u0432 \u043f\u043b\u0430\u043d\u0435: \u00ab\u0414\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0441\u0451 \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u043b \u0438 \u043d\u0430 \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u043a\u0440\u043e\u0435\u0442\u0441\u044f\u00bb \u2014 \u0432\u043f\u043e\u043b\u043d\u0435 \u0443\u043c\u0435\u0441\u0442\u043d\u0430. <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habr.habrastorage.org\/post_images\/22e\/b06\/516\/22eb0651604967ac578c2893a1bf19b5.gif\" alt=\"image\"\/><\/div>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/208240\/\"> http:\/\/habrahabr.ru\/post\/208240\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habr.habrastorage.org\/post_images\/ce8\/2f1\/f60\/ce82f1f60ca48fa0d02314bad9fa3e8c.jpg\" alt=\"image\"\/><\/div>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0412\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u0440\u0435\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A7%D1%91%D1%80%D0%BD%D1%8B%D0%B9_%D1%8F%D1%89%D0%B8%D0%BA\">\u0447\u0451\u0440\u043d\u043e\u0433\u043e \u044f\u0449\u0438\u043a\u0430<\/a>. \u041f\u043e\u0434 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e \u0442\u0430\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0434\u043d\u043e. \u041f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"python\">def customlogic(params):     return params[0] and params[1] and not params[5] and params[11] or params[2] and not params[3] or params[0] and params[5] and not params[6] or params[7] and not params[8] <\/code><\/pre>\n<p>  \u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0438\u0437 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0438\u0440\u0430.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-208240","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/208240","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=208240"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/208240\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=208240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=208240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=208240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}