{"id":360206,"date":"2024-05-21T00:48:34","date_gmt":"2024-05-21T00:48:34","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=360206"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=360206","title":{"rendered":"<span>\u041a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0430<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041b\u0443\u0447\u0448\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0435 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u041d\u043e \u043a\u0430\u043a \u0431\u044b\u0442\u044c, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430, \u0430 \u043d\u0430 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u0444\u0438\u0437\u0438\u043a\u0438 \u043d\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438\/\u0436\u0435\u043b\u0430\u043d\u0438\u044f? \u042d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0438 \u0431\u0435\u0437\u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0432 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u043d\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u0418 \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0435 &#8212; \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u0423\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043f\u043e\u0443\u0434\u043e\u0431\u043d\u0435\u0435, \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u044c\u0442\u0435 \u0447\u0430\u0448\u043a\u0443 \u043b\u044e\u0431\u0438\u043c\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0442\u043a\u0430 \u0438 \u043f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u043c\u0438\u0440\u0435 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u043a\u0443\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c \u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0430\u0434\u0438\u0430\u0431\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439, \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0432\u0435\u0440\u0445\u043f\u0440\u043e\u0432\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u0445\u0435\u043c, \u0444\u043e\u0442\u043e\u043d\u043d\u044b\u0445 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0445. \u0420\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d\u044b \u043a\u0430\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043d\u043e\u0439 \u0431\u0430\u0437\u043e\u0439, \u0442\u0430\u043a \u0438 \u043f\u0435\u0440\u0435\u0447\u043d\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u041c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0432\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0438\u0445 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e, \u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u0434\u0435\u043d\u044c \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0443 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 &#8212; \u0430\u0434\u0438\u0430\u0431\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e.<\/p>\n<h2>\u0410\u0434\u0438\u0430\u0431\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0438\u0448\u0435\u043c \u0441\u0443\u0442\u044c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0432\u044f\u0437\u043d\u044b\u0439 \u0433\u0440\u0430\u0444, \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 2-\u0445 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 &#8212; 0 \u0438\u043b\u0438 1. \u042d\u043d\u0435\u0440\u0433\u0438\u044f \u0433\u0440\u0430\u0444\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0441\u0443\u043c\u043c\u0430 \u0432\u0435\u0441\u043e\u0432 \u0432\u0441\u0435\u0445 \u0440\u0435\u0431\u0435\u0440, \u043e\u0431\u0435 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 1. \u041f\u043e\u043c\u0438\u043c\u043e \u0432\u0435\u0441\u043e\u0432 \u0440\u0435\u0431\u0435\u0440, \u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u0435\u0441 \u0438 \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u0439 \u044d\u043d\u0435\u0440\u0433\u0438\u0438 \u0433\u0440\u0430\u0444\u0430, \u0435\u0441\u043b\u0438 \u0432\u0435\u0440\u0448\u0438\u043d\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 1.<\/p>\n<p>\u0410\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442.\u043d. \u0441\u043f\u0438\u043d\u043e\u0432\u044b\u0445 \u0441\u0442\u0435\u043a\u043e\u043b (spin glass) \u0432 \u0444\u043e\u0440\u043c\u0435 2-\u043c\u0435\u0440\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u0442\u043e\u043a, \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0434\u0438\u0430\u0431\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044f. \u041d\u0435 \u043f\u043e\u0433\u0440\u0443\u0436\u0430\u044f\u0441\u044c \u0432 \u0444\u0438\u0437\u0438\u043a\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0432 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u044d\u043d\u0435\u0440\u0433\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0442.\u0435. \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044d\u043d\u0435\u0440\u0433\u0438\u044f \u0433\u0440\u0430\u0444\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430.<\/p>\n<p>\u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0431\u0430\u0437\u0438\u0441\u0435 +1 \/ -1 (\u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430 \u043a\u0430\u043a \u043c\u043e\u0434\u0435\u043b\u044c \u0418\u0437\u0438\u043d\u0433\u0430), \u0432\u043c\u0435\u0441\u0442\u043e 0\/1, \u043d\u043e \u043e\u0431\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043e-\u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c\u044b\u043c\u0438 \u0438 \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442 \u0441\u0443\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/234\/0b0\/6a8\/2340b06a8933bfdda69cb4d4f69837ba.png\" alt=\"\u0410\u0434\u0438\u0430\u0431\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c(\u0433\u0440\u0430\u0444\u043e\u0432\u043e\u0435 \u0438 \u0441\u043f\u0438\u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435)\" title=\"\u0410\u0434\u0438\u0430\u0431\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c(\u0433\u0440\u0430\u0444\u043e\u0432\u043e\u0435 \u0438 \u0441\u043f\u0438\u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435)\" width=\"1816\" height=\"799\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/234\/0b0\/6a8\/2340b06a8933bfdda69cb4d4f69837ba.png\"\/><\/p>\n<div><figcaption>\u0410\u0434\u0438\u0430\u0431\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c<br \/>(\u0433\u0440\u0430\u0444\u043e\u0432\u043e\u0435 \u0438 \u0441\u043f\u0438\u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435)<\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0432\u044b\u0448\u0435 \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0432\u0438\u0434\u0435:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\underset{x}{\\mathrm{argmin}}(x^T\\cdot Q \\cdot x) \\\\ x = (x_1, x_2, ..., x_n), x_i \\in (0,1)\" alt=\"\\underset{x}{\\mathrm{argmin}}(x^T\\cdot Q \\cdot x) \\\\ x = (x_1, x_2, ..., x_n), x_i \\in (0,1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/747\/d9c\/36e\/747d9c36e99d65c9ad37b9b6eb4ba812.svg\" width=\"697\" height=\"66\"\/><\/p>\n<p>\u0412 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 \u0442\u0435\u043e\u0440\u0438\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0430\u044f \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0435\u0437 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 (\u0432 \u0430\u043d\u0433\u043b. QUBO) \u0438 \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0432\u0430\u0436\u043d\u044b\u043c\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u043c\u0438:<\/p>\n<ul>\n<li>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0441\u0443 NP-\u0441\u043b\u043e\u0436\u043d\u044b\u0445. \u0422.\u0435. \u0434\u043b\u044f \u043b\u044e\u0431\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0435\u0439 \u0432\u044b\u0448\u0435 25-100 \u043f\u043e\u0438\u0441\u043a \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0438\u043b\u044c\u043d\u044b\u043c \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432,<\/p>\n<\/li>\n<li>\n<p>\u041b\u044e\u0431\u0443\u044e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0443\u044e NP-\u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u0432\u0435\u0441\u0442\u0438 \u043a \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435,<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u0430 \u043a\u0430\u043a \u0441 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u043c, \u0442\u0430\u043a \u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u043c\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u043d\u0430\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0430 \u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044f\u0445 \u0442\u043e\u0436\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0441\u0443 NP-\u0441\u043b\u043e\u0436\u043d\u044b\u0445, \u0442\u043e \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 (\u0438\u043b\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439). \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0434\u043e-\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443.<\/p>\n<h2>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044f\u0445 \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0439 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u0430\u043d\u043a\u043e\u0432, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u0441\u0440\u043e\u043a\u043e\u0432, \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0448\u0442\u0440\u0430\u0444\u043e\u0432 \u0437\u0430 \u0438\u0445 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0441 \u043e\u0434\u043d\u0438\u043c \u0441\u0442\u0430\u043d\u043a\u043e\u043c, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 \u0438 \u0436\u0435\u0441\u0442\u043a\u0438\u043c\u0438 \u0441\u0440\u043e\u043a\u0430\u043c\u0438 \u0438\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0441\u0440\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043a\u043e\u043c\u043f\u0435\u043d\u0441\u0430\u0446\u0438\u044e, \u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0435\u0441\u043b\u0438 \u0441\u0440\u043e\u043a \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p><strong>\u041e\u0431\u043e\u0431\u0449\u0438\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f:<br \/><\/strong><br \/>(1) \u0414\u0430\u043d\u043e <strong><em>n \u0437\u0430\u0434\u0430\u0447<\/em><\/strong> \u0438 <strong><em>1 \u0441\u0442\u0430\u043d\u043e\u043a<\/em><\/strong>,<br \/>(2) \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e:<br \/>    &#8212; \u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (<strong><em>t<sub>i<\/sub><\/em><\/strong>),<br \/>    &#8212; \u0421\u0440\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (<strong><em>d<sub>i<\/sub><\/em><\/strong>),<br \/>    &#8212; \u041f\u0440\u0435\u043c\u0438\u044f (<strong><em>p<sub>i<\/sub><\/em><\/strong>).<br \/>(3) \u0415\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0432 \u0441\u0440\u043e\u043a (\u0442.\u0435. <strong><em>tstart<sub>i<\/sub><\/em><\/strong> + <strong><em>t<sub>i<\/sub><\/em><\/strong> &lt;= <strong><em>d<sub>i<\/sub><\/em><\/strong>), \u0442\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u043c\u0438\u044f <strong><em>p<sub>i<\/sub><\/em><\/strong>,<br \/>(4) \u0417\u0430\u0434\u0430\u0447\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e,<br \/>(5) \u0417\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p><strong>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<br \/><\/strong><br \/>(6) \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 (<strong><em>tstart<sub>1<\/sub><\/em><\/strong><em>, <\/em><strong><em>tstart<sub>2<\/sub><\/em><\/strong><em>, &#8230;, <\/em><strong><em>tstart<sub>n<\/sub><\/em><\/strong>) \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0443\u044e \u043f\u0440\u0435\u043c\u0438\u044e <strong><em>P<\/em><\/strong> = sum(<strong><em>p<sub>i<\/sub><\/em><\/strong>), \u0434\u043b\u044f \u0432\u0441\u0435\u0445 <strong><em>i<\/em><\/strong> \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 <strong><em>tstart<sub>i<\/sub><\/em><\/strong> + <strong><em>t<sub>i<\/sub><\/em><\/strong> &lt;= <strong><em>d<sub>i<\/sub><\/em><\/strong>.<\/p>\n<p>\u0412\u0441\u0435 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"python\"># \u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 times = [2, 2, 1, 1] # \u0421\u0440\u043e\u043a\u0438 deadlines = [3, 4, 4, 3] # \u041f\u0440\u0435\u043c\u0438\u0438 profits = [23, 20, 37, 36]<\/code><\/pre>\n<h2>\u041e\u0431\u0449\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <strong><em>Q<\/em><\/strong> \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b x<sup>T<\/sup> * Q * x \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u043b \u0441\u0432\u043e\u0435\u0433\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u043e\u0441\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u0439 \u043f\u0440\u0435\u043c\u0438\u0438 <strong><em>P<\/em><\/strong>.<\/p>\n<p>\u0412\u0432\u0435\u0434\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441 <strong><em>k<sub>i,t<\/sub><\/em><\/strong> , \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 <em>i<\/em>-\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0439 \u0432 <em>t<\/em>-\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"k_{i,t} = i \\cdot T_{max} + t\" alt=\"k_{i,t} = i \\cdot T_{max} + t\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/59b\/5dc\/a9e\/59b5dca9ee85404e69621ce5232d6ae8.svg\" width=\"144\" height=\"22\"\/><\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 <strong><em>x<\/em><\/strong> \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u043a\u0430\u043a:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"x_{k_{i,t}} =     \\begin{cases}       1 &amp; \\text{\u0435\u0441\u043b\u0438 $i$-\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u0432 $t$-\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438}\\\\       0 &amp; \\text{\u0438\u043d\u0430\u0447\u0435}     \\end{cases} \" alt=\"x_{k_{i,t}} =     \\begin{cases}       1 &amp; \\text{\u0435\u0441\u043b\u0438 $i$-\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u0432 $t$-\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438}\\\\       0 &amp; \\text{\u0438\u043d\u0430\u0447\u0435}     \\end{cases} \" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/704\/393\/d54\/704393d54d2703ca76c7a983c9c625f7.svg\" width=\"522\" height=\"62\"\/><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b Q \u043a\u0430\u043a \u0441\u0443\u043c\u043c\u0443 \u0448\u0442\u0440\u0430\u0444\u043e\u0432 \u0438 \u043f\u0440\u0435\u043c\u0438\u0439:<\/p>\n<p>(\u0430) \u0428\u0442\u0440\u0430\u0444\u043d\u0430\u044f \u0434\u043e\u0431\u0430\u0432\u043a\u0430 \u0437\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"Q[k_{i,t_1}, k_{i,t_2}] = P_1, \\\\ t_2 \\neq t_1 \" alt=\"Q[k_{i,t_1}, k_{i,t_2}] = P_1, \\\\ t_2 \\neq t_1 \" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/115\/0d3\/c33\/1150d3c336800f87557cff940c67aed0.svg\" width=\"697\" height=\"50\"\/><\/p>\n<p>(\u0431) \u0428\u0442\u0440\u0430\u0444\u043d\u0430\u044f \u0434\u043e\u0431\u0430\u0432\u043a\u0430 \u0437\u0430 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"Q[k_{i,t_1},k_{j,t_2}] = P_3 \\\\ t_1 \\leq t_2 \\leq t_1 + t_i\" alt=\"Q[k_{i,t_1},k_{j,t_2}] = P_3 \\\\ t_1 \\leq t_2 \\leq t_1 + t_i\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/46b\/b31\/0b6\/46bb310b6e537c316ca70d4e57e14be5.svg\" width=\"697\" height=\"47\"\/><\/p>\n<p>(\u0432) \u041f\u0440\u0435\u043c\u0438\u044f \u0437\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u043a\u0440\u0430\u0439\u043d\u0435\u0433\u043e \u0441\u0440\u043e\u043a\u0430:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"Q[k_{i,t},k_{i,t}] = -p_i\\\\ t + t_i\\leq d_i\" alt=\"Q[k_{i,t},k_{i,t}] = -p_i\\\\ t + t_i\\leq d_i\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/749\/408\/931\/749408931b8b1b0db5055284da5ea76d.svg\" width=\"697\" height=\"48\"\/><\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0440\u0435\u043c\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0440\u0435\u0448\u0430\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430.<\/p>\n<p>\u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 <strong><em>Q<\/em><\/strong> \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434 (\u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0447\u0430\u0441\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438):<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/504\/c55\/36c\/504c5536ce847c9b558b7cc95aeb40e6.png\" alt=\"\u0424\u043e\u0440\u043c\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u044b Q\" title=\"\u0424\u043e\u0440\u043c\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u044b Q\" width=\"1767\" height=\"1072\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/504\/c55\/36c\/504c5536ce847c9b558b7cc95aeb40e6.png\"\/><\/p>\n<div><figcaption>\u0424\u043e\u0440\u043c\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u044b Q<\/figcaption><\/div>\n<\/figure>\n<h2>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0430<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u043b\u043e\u0436\u0438\u0442\u044c \u0441\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u043a\u043e\u0434.<\/p>\n<p>\u0412\u0432\u0435\u0434\u0435\u043c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432.<\/p>\n<pre><code class=\"python\">def decode_index(i, max_time):   job_id = i \/\/ max_time   start_time = i - job_id * max_time   return job_id, start_time  def encode_index(job_id, start_time, max_time):   return job_id * max_time + start_time<\/code><\/pre>\n<p>\u0418 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 QUBO:<\/p>\n<pre><code class=\"python\">def make_qubo(times, deadlines, profits):   max_time = np.max(deadlines)   num_jobs = len(times)    size = max_time * num_jobs   Q = np.zeros((size, size))    P = 1000   for job_id in range(num_jobs):     for start_time in range(max_time):       time = times[job_id]       deadline = deadlines[job_id]       i = encode_index(job_id, start_time, max_time)        # Apply profit, if completed before deadline       if start_time + time &lt;= deadline: Q[i, i] = -1.0 * profits[job_id]        # Should start each job only once       # Otherwise, apply penalty P       for t in range(max_time):         if start_time != t:           j = encode_index(job_id, t, max_time)           Q[i][j] = P           Q[j][i] = P        # Should start one job after another       # Otherwise, apply penalty P       for job_id_2 in range(num_jobs):         if job_id_2 != job_id:           time = times[job_id]           for t in range(start_time, min(start_time + time, max_time)):             j = encode_index(job_id_2, t, max_time)             Q[i][j] = P             Q[j][i] = P   return Q<\/code><\/pre>\n<p>\u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 Q, \u043d\u0430\u0439\u0442\u0438 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447. \u041a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 \u043f\u0438\u0441\u0430\u043b\u0438, \u043f\u043e\u0438\u0441\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 QUBO \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 (\u043e \u043d\u0435\u043c \u043f\u043e\u0437\u0436\u0435), \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 (brute-force) \u0438 \u043f\u0443\u0442\u0435\u043c \u043b\u0438\u043d\u0435\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043b\u044e\u0431\u043e\u0433\u043e \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0433\u043e \u0441\u043e\u043b\u0432\u0435\u0440\u0430.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d \u0432\u0437\u0440\u044b\u0432\u043d\u044b\u043c \u0440\u043e\u0441\u0442\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0441\u0447\u0435\u0442 \u043c\u0430\u0442\u0440\u0438\u0446 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0435 25\u044525 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0438\u0442\u0435\u043b\u0435\u043d. \u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043b\u0438\u043d\u0435\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u043e 100\u0445100, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0443\u0431\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044f\u0445.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u044b Q \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043b\u0438\u043d\u0435\u0439\u043d\u043e \u043e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f n * T_max, \u0433\u0434\u0435 n &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0434\u0430\u0447, \u0430 T_max &#8212; \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u0440\u0430\u0439\u043d\u0438\u0439 \u0441\u0440\u043e\u043a, \u0442\u043e \u043d\u0430\u0448\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043f\u0440\u0438\u043c\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c 16 \u0445 16, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0440\u0435\u0448\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u043b\u044e\u0431\u044b\u043c \u0438\u0437 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<p>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430:<\/p>\n<pre><code class=\"python\">def solve_qubo(Q):     min_vec = [0] * len(Q)     min_energy = min_vec @ Q @ min_vec     for i in range(2**len(Q)):       x = list(map(int,('{0:0%db}'%(len(Q))).format(i)))       e = np.dot(x, np.dot(Q, x))       if e &lt; min_energy:         min_energy = e         min_vec = x     print(min_vec)     return min_vec, min_energy<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0448 \u0441\u043e\u043b\u0432\u0435\u0440 \u043e\u0442\u043e\u0431\u0440\u0430\u043b \u0437\u0430\u0434\u0430\u0447\u0438 0, 2 \u0438 3 (\u0437\u0430\u0434\u0430\u0447\u0430 1 \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0430 \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435, \u0442.\u043a. \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435). \u0422\u0430\u043a\u0430\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0434\u0430\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u0435\u043c\u0438\u044e 23 + 37 + 36 = 96. \u0415\u0441\u043b\u0438 \u0431\u044b \u0441\u043e\u043b\u0432\u0435\u0440 \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438 1-\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432\u043e\u0432\u0440\u0435\u043c\u044f (\u0441\u043e \u0441\u0440\u043e\u043a\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f 4), \u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0431\u044b \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u0441\u0440\u043e\u043a\u043e\u0432 \u0443 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0438 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u043f\u0440\u0435\u043c\u0438\u044f \u0441\u0442\u0430\u043b\u0430 \u0431\u044b \u043c\u0435\u043d\u044c\u0448\u0435.<\/p>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0441\u043e\u043b\u0432\u0435\u0440 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u0434\u0430\u0447, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f\u0445 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5a7\/64d\/a80\/5a764da80ef7e564ae8928379db36c52.png\" alt=\"\u0418\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435\" title=\"\u0418\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435\" width=\"1886\" height=\"908\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5a7\/64d\/a80\/5a764da80ef7e564ae8928379db36c52.png\"\/><\/p>\n<div><figcaption>\u0418\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/figcaption><\/div>\n<\/figure>\n<h2>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u043c \u0431\u044d\u043a\u0435\u043d\u0434\u0435<\/h2>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435. \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0435 \u0447\u0438\u043f\u044b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 \u0430\u0434\u0438\u0430\u0431\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0443 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041a\u0440\u0443\u043f\u043d\u0435\u0439\u0448\u0438\u0439(\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439) \u0432\u0435\u043d\u0434\u043e\u0440 \u0432 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u044d\u0442\u043e \u043a\u0430\u043d\u0430\u0434\u0441\u043a\u0430\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f D-Wave, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u0440\u0430\u043f\u043e\u0440\u0442\u0443\u0435\u0442 \u043e\u0431 \u0443\u0434\u0432\u043e\u0435\u043d\u0438\u0438 \u043a\u0443\u0431\u0438\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u0432\u043e\u0438\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u0435\u0439 (\u043f\u043e\u0447\u0442\u0438 \u0432 \u043d\u043e\u0433\u0443 \u0441 \u0437\u0430\u043a\u043e\u043d\u043e\u043c \u041c\u0443\u0440\u0430), \u043e\u0442\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0441\u0432\u043e\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b \u0432 \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u044b\u0445 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430\u0445 \u0432 \u043a\u0440\u0443\u043f\u043d\u044b\u0435 \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0441\u043a\u0438\u0435 \u0438 \u0435\u0432\u0440\u043e\u043f\u0435\u0439\u0441\u043a\u0438\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0446\u0435\u043d\u0442\u0440\u044b.<\/p>\n<p>\u0414\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u0437 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0447\u043d\u044f \u0441\u0442\u0440\u0430\u043d \u043d\u0430 \u043d\u0435\u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c <a href=\"https:\/\/cloud.dwavesys.com\/leap\/\" rel=\"noopener noreferrer nofollow\">D-Wave Leap<\/a>. \u0415\u0441\u043b\u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0438\u0445 \u043f\u043e\u0440\u0442\u0430\u043b\u0435 (\u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0438\u0437 \u0420\u0424 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430), \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u0432 \u043e\u0431\u044a\u0435\u043c\u0435 1-\u043e\u0439 \u043c\u0438\u043d\u0443\u0442\u044b \u0432 \u043c\u0435\u0441\u044f\u0446. \u041d\u0438\u0436\u0435 \u043c\u044b \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0431\u044d\u043a\u0435\u043d\u0434\u0443 D-Wave \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u043d\u0430\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<pre><code class=\"python\">from dwave.system.samplers import DWaveSampler from dwave.system.composites import EmbeddingComposite  def solve_qubo(Q, API_KEY):     q = {}     size = len(Q)     for i in range(size):         for j in range(size):             q[(i,j)] = Q[i][j]                  sampler = EmbeddingComposite(DWaveSampler(token=API_KEY]))     response = sampler.sample_qubo(q, num_reads=200)      min_energy = np.inf     min_spins = None     for sample, energy in response.data(['sample', 'energy']):          if energy &lt; min_energy:           min_spins = sample           min_energy = energy          return [min_spins[i] for i in range(len(min_spins))], min_energy<\/code><\/pre>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u043d\u0430 GitHub: <a href=\"https:\/\/github.com\/aboev\/quantum-job-scheduler\" rel=\"noopener noreferrer nofollow\">quantum-job-scheduler<\/a>.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043e\u0441\u0432\u0435\u0442\u0438\u043b\u0438 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u043c \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u043e\u0439 \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044e. \u041d\u0430\u0448\u0430 \u0446\u0435\u043b\u044c \u0431\u044b\u043b\u0430 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0445, \u043a\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c \u0441 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u043c\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u043f\u043e\u043c\u043e\u0447\u044c \u0432 \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u043d\u0438\u0438 \u043f\u043e\u0440\u043e\u0433\u0430 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043d\u043e\u0432\u0443\u044e \u0438 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u043e\u043c\u043e\u0433\u0430\u0442\u044c \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f\u043c \u0432 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 \u0434\u043b\u044f \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0437\u043d\u0430\u0447\u0438\u043c\u043e\u0441\u0442\u044c, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043e \u043d\u0438\u0445 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u0438\u043b\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445 \u0438 \u043c\u044b \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u0445 \u0432 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445!<\/p>\n<p>\u0412\u0441\u0435\u043c \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u043d\u0435\u0434\u0435\u043b\u0438 \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0440\u044b\u0432\u043e\u0432!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/774004\/\"> https:\/\/habr.com\/ru\/articles\/774004\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041b\u0443\u0447\u0448\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0435 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u041d\u043e \u043a\u0430\u043a \u0431\u044b\u0442\u044c, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430, \u0430 \u043d\u0430 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u0444\u0438\u0437\u0438\u043a\u0438 \u043d\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438\/\u0436\u0435\u043b\u0430\u043d\u0438\u044f? \u042d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0438 \u0431\u0435\u0437\u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0432 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0442\u043e\u0440\u043d\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u0418 \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0435 &#8212; \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u0423\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043f\u043e\u0443\u0434\u043e\u0431\u043d\u0435\u0435, \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u044c\u0442\u0435 \u0447\u0430\u0448\u043a\u0443 \u043b\u044e\u0431\u0438\u043c\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0442\u043a\u0430 \u0438 \u043f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u043c\u0438\u0440\u0435 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u043a\u0443\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c \u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0430\u0434\u0438\u0430\u0431\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439, \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0432\u0435\u0440\u0445\u043f\u0440\u043e\u0432\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u0445\u0435\u043c, \u0444\u043e\u0442\u043e\u043d\u043d\u044b\u0445 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0445. \u0420\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d\u044b \u043a\u0430\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043d\u043e\u0439 \u0431\u0430\u0437\u043e\u0439, \u0442\u0430\u043a \u0438 \u043f\u0435\u0440\u0435\u0447\u043d\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u041c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0432\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0438\u0445 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e, \u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u0434\u0435\u043d\u044c \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0443 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 &#8212; \u0430\u0434\u0438\u0430\u0431\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e.<\/p>\n<h2>\u0410\u0434\u0438\u0430\u0431\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0438\u0448\u0435\u043c \u0441\u0443\u0442\u044c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0432\u044f\u0437\u043d\u044b\u0439 \u0433\u0440\u0430\u0444, \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 2-\u0445 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 &#8212; 0 \u0438\u043b\u0438 1. \u042d\u043d\u0435\u0440\u0433\u0438\u044f \u0433\u0440\u0430\u0444\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0441\u0443\u043c\u043c\u0430 \u0432\u0435\u0441\u043e\u0432 \u0432\u0441\u0435\u0445 \u0440\u0435\u0431\u0435\u0440, \u043e\u0431\u0435 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 1. \u041f\u043e\u043c\u0438\u043c\u043e \u0432\u0435\u0441\u043e\u0432 \u0440\u0435\u0431\u0435\u0440, \u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u0435\u0441 \u0438 \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u0439 \u044d\u043d\u0435\u0440\u0433\u0438\u0438 \u0433\u0440\u0430\u0444\u0430, \u0435\u0441\u043b\u0438 \u0432\u0435\u0440\u0448\u0438\u043d\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 1.<\/p>\n<p>\u0410\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442.\u043d. \u0441\u043f\u0438\u043d\u043e\u0432\u044b\u0445 \u0441\u0442\u0435\u043a\u043e\u043b (spin glass) \u0432 \u0444\u043e\u0440\u043c\u0435 2-\u043c\u0435\u0440\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u0442\u043e\u043a, \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0434\u0438\u0430\u0431\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044f. \u041d\u0435 \u043f\u043e\u0433\u0440\u0443\u0436\u0430\u044f\u0441\u044c \u0432 \u0444\u0438\u0437\u0438\u043a\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0432 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u044d\u043d\u0435\u0440\u0433\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0442.\u0435. \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044d\u043d\u0435\u0440\u0433\u0438\u044f \u0433\u0440\u0430\u0444\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430.<\/p>\n<p>\u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0431\u0430\u0437\u0438\u0441\u0435 +1 \/ -1 (\u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430 \u043a\u0430\u043a \u043c\u043e\u0434\u0435\u043b\u044c \u0418\u0437\u0438\u043d\u0433\u0430), \u0432\u043c\u0435\u0441\u0442\u043e 0\/1, \u043d\u043e \u043e\u0431\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043e-\u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c\u044b\u043c\u0438 \u0438 \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442 \u0441\u0443\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0410\u0434\u0438\u0430\u0431\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c<br \/>(\u0433\u0440\u0430\u0444\u043e\u0432\u043e\u0435 \u0438 \u0441\u043f\u0438\u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435)<\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0432\u044b\u0448\u0435 \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0432\u0438\u0434\u0435:<\/p>\n<p>\u0412 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 \u0442\u0435\u043e\u0440\u0438\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0430\u044f \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0435\u0437 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 (\u0432 \u0430\u043d\u0433\u043b. QUBO) \u0438 \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0432\u0430\u0436\u043d\u044b\u043c\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u043c\u0438:<\/p>\n<ul>\n<li>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0441\u0443 NP-\u0441\u043b\u043e\u0436\u043d\u044b\u0445. \u0422.\u0435. \u0434\u043b\u044f \u043b\u044e\u0431\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0435\u0439 \u0432\u044b\u0448\u0435 25-100 \u043f\u043e\u0438\u0441\u043a \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0438\u043b\u044c\u043d\u044b\u043c \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432,<\/p>\n<\/li>\n<li>\n<p>\u041b\u044e\u0431\u0443\u044e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0443\u044e NP-\u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u0432\u0435\u0441\u0442\u0438 \u043a \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435,<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u0430 \u043a\u0430\u043a \u0441 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u043c, \u0442\u0430\u043a \u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u043c\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u043d\u0430\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0430 \u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044f\u0445 \u0442\u043e\u0436\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0441\u0443 NP-\u0441\u043b\u043e\u0436\u043d\u044b\u0445, \u0442\u043e \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 (\u0438\u043b\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439). \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0434\u043e-\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443.<\/p>\n<h2>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044f\u0445 \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0439 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u0430\u043d\u043a\u043e\u0432, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u0441\u0440\u043e\u043a\u043e\u0432, \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0448\u0442\u0440\u0430\u0444\u043e\u0432 \u0437\u0430 \u0438\u0445 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0441 \u043e\u0434\u043d\u0438\u043c \u0441\u0442\u0430\u043d\u043a\u043e\u043c, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 \u0438 \u0436\u0435\u0441\u0442\u043a\u0438\u043c\u0438 \u0441\u0440\u043e\u043a\u0430\u043c\u0438 \u0438\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0441\u0440\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043a\u043e\u043c\u043f\u0435\u043d\u0441\u0430\u0446\u0438\u044e, \u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0435\u0441\u043b\u0438 \u0441\u0440\u043e\u043a \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p><strong>\u041e\u0431\u043e\u0431\u0449\u0438\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f:<br \/><\/strong><br \/>(1) \u0414\u0430\u043d\u043e <strong><em>n \u0437\u0430\u0434\u0430\u0447<\/em><\/strong> \u0438 <strong><em>1 \u0441\u0442\u0430\u043d\u043e\u043a<\/em><\/strong>,<br \/>(2) \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e:<br \/>    &#8212; \u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (<strong><em>t<sub>i<\/sub><\/em><\/strong>),<br \/>    &#8212; \u0421\u0440\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (<strong><em>d<sub>i<\/sub><\/em><\/strong>),<br \/>    &#8212; \u041f\u0440\u0435\u043c\u0438\u044f (<strong><em>p<sub>i<\/sub><\/em><\/strong>).<br \/>(3) \u0415\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0432 \u0441\u0440\u043e\u043a (\u0442.\u0435. <strong><em>tstart<sub>i<\/sub><\/em><\/strong> + <strong><em>t<sub>i<\/sub><\/em><\/strong> &lt;= <strong><em>d<sub>i<\/sub><\/em><\/strong>), \u0442\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u043c\u0438\u044f <strong><em>p<sub>i<\/sub><\/em><\/strong>,<br \/>(4) \u0417\u0430\u0434\u0430\u0447\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e,<br \/>(5) \u0417\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p><strong>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<br \/><\/strong><br \/>(6) \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 (<strong><em>tstart<sub>1<\/sub><\/em><\/strong><em>, <\/em><strong><em>tstart<sub>2<\/sub><\/em><\/strong><em>, &#8230;, <\/em><strong><em>tstart<sub>n<\/sub><\/em><\/strong>) \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0443\u044e \u043f\u0440\u0435\u043c\u0438\u044e <strong><em>P<\/em><\/strong> = sum(<strong><em>p<sub>i<\/sub><\/em><\/strong>), \u0434\u043b\u044f \u0432\u0441\u0435\u0445 <strong><em>i<\/em><\/strong> \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 <strong><em>tstart<sub>i<\/sub><\/em><\/strong> + <strong><em>t<sub>i<\/sub><\/em><\/strong> &lt;= <strong><em>d<sub>i<\/sub><\/em><\/strong>.<\/p>\n<p>\u0412\u0441\u0435 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"python\"># \u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 times = [2, 2, 1, 1] # \u0421\u0440\u043e\u043a\u0438 deadlines = [3, 4, 4, 3] # \u041f\u0440\u0435\u043c\u0438\u0438 profits = [23, 20, 37, 36]<\/code><\/pre>\n<h2>\u041e\u0431\u0449\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <strong><em>Q<\/em><\/strong> \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b x<sup>T<\/sup> * Q * x \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u043b \u0441\u0432\u043e\u0435\u0433\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u043e\u0441\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u0439 \u043f\u0440\u0435\u043c\u0438\u0438 <strong><em>P<\/em><\/strong>.<\/p>\n<p>\u0412\u0432\u0435\u0434\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441 <strong><em>k<sub>i,t<\/sub><\/em><\/strong> , \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 <em>i<\/em>-\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0439 \u0432 <em>t<\/em>-\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438:<\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 <strong><em>x<\/em><\/strong> \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u043a\u0430\u043a:<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b Q \u043a\u0430\u043a \u0441\u0443\u043c\u043c\u0443 \u0448\u0442\u0440\u0430\u0444\u043e\u0432 \u0438 \u043f\u0440\u0435\u043c\u0438\u0439:<\/p>\n<p>(\u0430) \u0428\u0442\u0440\u0430\u0444\u043d\u0430\u044f \u0434\u043e\u0431\u0430\u0432\u043a\u0430 \u0437\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<p>(\u0431) \u0428\u0442\u0440\u0430\u0444\u043d\u0430\u044f \u0434\u043e\u0431\u0430\u0432\u043a\u0430 \u0437\u0430 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447:<\/p>\n<p>(\u0432) \u041f\u0440\u0435\u043c\u0438\u044f \u0437\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u043a\u0440\u0430\u0439\u043d\u0435\u0433\u043e \u0441\u0440\u043e\u043a\u0430:<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0440\u0435\u043c\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0440\u0435\u0448\u0430\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430.<\/p>\n<p>\u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 <strong><em>Q<\/em><\/strong> \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434 (\u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0447\u0430\u0441\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438):<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0424\u043e\u0440\u043c\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u044b Q<\/figcaption><\/div>\n<\/figure>\n<h2>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0430<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u043b\u043e\u0436\u0438\u0442\u044c \u0441\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u043a\u043e\u0434.<\/p>\n<p>\u0412\u0432\u0435\u0434\u0435\u043c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432.<\/p>\n<pre><code class=\"python\">def decode_index(i, max_time):   job_id = i \/\/ max_time   start_time = i - job_id * max_time   return job_id, start_time  def encode_index(job_id, start_time, max_time):   return job_id * max_time + start_time<\/code><\/pre>\n<p>\u0418 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 QUBO:<\/p>\n<pre><code class=\"python\">def make_qubo(times, deadlines, profits):   max_time = np.max(deadlines)   num_jobs = len(times)    size = max_time * num_jobs   Q = np.zeros((size, size))    P = 1000   for job_id in range(num_jobs):     for start_time in range(max_time):       time = times[job_id]       deadline = deadlines[job_id]       i = encode_index(job_id, start_time, max_time)        # Apply profit, if completed before deadline       if start_time + time &lt;= deadline: Q[i, i] = -1.0 * profits[job_id]        # Should start each job only once       # Otherwise, apply penalty P       for t in range(max_time):         if start_time != t:           j = encode_index(job_id, t, max_time)           Q[i][j] = P           Q[j][i] = P        # Should start one job after another       # Otherwise, apply penalty P       for job_id_2 in range(num_jobs):         if job_id_2 != job_id:           time = times[job_id]           for t in range(start_time, min(start_time + time, max_time)):             j = encode_index(job_id_2, t, max_time)             Q[i][j] = P             Q[j][i] = P   return Q<\/code><\/pre>\n<p>\u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 Q, \u043d\u0430\u0439\u0442\u0438 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447. \u041a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 \u043f\u0438\u0441\u0430\u043b\u0438, \u043f\u043e\u0438\u0441\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 QUBO \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 (\u043e \u043d\u0435\u043c \u043f\u043e\u0437\u0436\u0435), \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 (brute-force) \u0438 \u043f\u0443\u0442\u0435\u043c \u043b\u0438\u043d\u0435\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043b\u044e\u0431\u043e\u0433\u043e \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0433\u043e \u0441\u043e\u043b\u0432\u0435\u0440\u0430.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d \u0432\u0437\u0440\u044b\u0432\u043d\u044b\u043c \u0440\u043e\u0441\u0442\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0441\u0447\u0435\u0442 \u043c\u0430\u0442\u0440\u0438\u0446 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0435 25\u044525 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0438\u0442\u0435\u043b\u0435\u043d. \u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043b\u0438\u043d\u0435\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u043e 100\u0445100, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0443\u0431\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044f\u0445.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u044b Q \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043b\u0438\u043d\u0435\u0439\u043d\u043e \u043e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f n * T_max, \u0433\u0434\u0435 n &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0434\u0430\u0447, \u0430 T_max &#8212; \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u0440\u0430\u0439\u043d\u0438\u0439 \u0441\u0440\u043e\u043a, \u0442\u043e \u043d\u0430\u0448\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043f\u0440\u0438\u043c\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c 16 \u0445 16, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0440\u0435\u0448\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u043b\u044e\u0431\u044b\u043c \u0438\u0437 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<p>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430:<\/p>\n<pre><code class=\"python\">def solve_qubo(Q):     min_vec = [0] * len(Q)     min_energy = min_vec @ Q @ min_vec     for i in range(2**len(Q)):       x = list(map(int,('{0:0%db}'%(len(Q))).format(i)))       e = np.dot(x, np.dot(Q, x))       if e &lt; min_energy:         min_energy = e         min_vec = x     print(min_vec)     return min_vec, min_energy<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0448 \u0441\u043e\u043b\u0432\u0435\u0440 \u043e\u0442\u043e\u0431\u0440\u0430\u043b \u0437\u0430\u0434\u0430\u0447\u0438 0, 2 \u0438 3 (\u0437\u0430\u0434\u0430\u0447\u0430 1 \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0430 \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435, \u0442.\u043a. \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435). \u0422\u0430\u043a\u0430\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0434\u0430\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u0435\u043c\u0438\u044e 23 + 37 + 36 = 96. \u0415\u0441\u043b\u0438 \u0431\u044b \u0441\u043e\u043b\u0432\u0435\u0440 \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438 1-\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432\u043e\u0432\u0440\u0435\u043c\u044f (\u0441\u043e \u0441\u0440\u043e\u043a\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f 4), \u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0431\u044b \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u0441\u0440\u043e\u043a\u043e\u0432 \u0443 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0438 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u043f\u0440\u0435\u043c\u0438\u044f \u0441\u0442\u0430\u043b\u0430 \u0431\u044b \u043c\u0435\u043d\u044c\u0448\u0435.<\/p>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0441\u043e\u043b\u0432\u0435\u0440 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u0434\u0430\u0447, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f\u0445 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0418\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/figcaption><\/div>\n<\/figure>\n<h2>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u043c \u0431\u044d\u043a\u0435\u043d\u0434\u0435<\/h2>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435. \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0435 \u0447\u0438\u043f\u044b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 \u0430\u0434\u0438\u0430\u0431\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0443 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041a\u0440\u0443\u043f\u043d\u0435\u0439\u0448\u0438\u0439(\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439) \u0432\u0435\u043d\u0434\u043e\u0440 \u0432 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u044d\u0442\u043e \u043a\u0430\u043d\u0430\u0434\u0441\u043a\u0430\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f D-Wave, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u0440\u0430\u043f\u043e\u0440\u0442\u0443\u0435\u0442 \u043e\u0431 \u0443\u0434\u0432\u043e\u0435\u043d\u0438\u0438 \u043a\u0443\u0431\u0438\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u0432\u043e\u0438\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u0435\u0439 (\u043f\u043e\u0447\u0442\u0438 \u0432 \u043d\u043e\u0433\u0443 \u0441 \u0437\u0430\u043a\u043e\u043d\u043e\u043c \u041c\u0443\u0440\u0430), \u043e\u0442\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0441\u0432\u043e\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b \u0432 \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u044b\u0445 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430\u0445 \u0432 \u043a\u0440\u0443\u043f\u043d\u044b\u0435 \u0430\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0441\u043a\u0438\u0435 \u0438 \u0435\u0432\u0440\u043e\u043f\u0435\u0439\u0441\u043a\u0438\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0446\u0435\u043d\u0442\u0440\u044b.<\/p>\n<p>\u0414\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u0437 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0447\u043d\u044f \u0441\u0442\u0440\u0430\u043d \u043d\u0430 \u043d\u0435\u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c <a href=\"https:\/\/cloud.dwavesys.com\/leap\/\" rel=\"noopener noreferrer nofollow\">D-Wave Leap<\/a>. \u0415\u0441\u043b\u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0438\u0445 \u043f\u043e\u0440\u0442\u0430\u043b\u0435 (\u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0438\u0437 \u0420\u0424 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430), \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u0432 \u043e\u0431\u044a\u0435\u043c\u0435 1-\u043e\u0439 \u043c\u0438\u043d\u0443\u0442\u044b \u0432 \u043c\u0435\u0441\u044f\u0446. \u041d\u0438\u0436\u0435 \u043c\u044b \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0431\u044d\u043a\u0435\u043d\u0434\u0443 D-Wave \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u043d\u0430\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<pre><code class=\"python\">from dwave.system.samplers import DWaveSampler from dwave.system.composites import EmbeddingComposite  def solve_qubo(Q, API_KEY):     q = {}     size = len(Q)     for i in range(size):         for j in range(size):             q[(i,j)] = Q[i][j]                  sampler = EmbeddingComposite(DWaveSampler(token=API_KEY]))     response = sampler.sample_qubo(q, num_reads=200)      min_energy = np.inf     min_spins = None     for sample, energy in response.data(['sample', 'energy']):          if energy &lt; min_energy:           min_spins = sample           min_energy = energy          return [min_spins[i] for i in range(len(min_spins))], min_energy<\/code><\/pre>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u043d\u0430 GitHub: <a href=\"https:\/\/github.com\/aboev\/quantum-job-scheduler\" rel=\"noopener noreferrer nofollow\">quantum-job-scheduler<\/a>.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043e\u0441\u0432\u0435\u0442\u0438\u043b\u0438<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-360206","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/360206","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=360206"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/360206\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=360206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=360206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=360206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}