В общем, была задача на оптимизацию плана работ: есть набор заказов, и в каждом N тасков. Таски могут зависеть друг от друга или нет, имеют длительность и тип. Ещё есть M работников, каждый из которых может выполнять таски только определённых типов, причём, у каждого своя скорость.
Если все таски в заказе выполнены, фирма получает сколько-то денег. У заказа есть дедлайн, за просрочку штраф (за каждый день просрочки), который вычитается из цены заказа. И ещё фирма тратит деньги за каждый день своей работы независимо от того, как загружены её сотрудники (то есть просто платит зарплаты по сути). Ещё важен учёт праздников и выходных.
Нужно заработать на определённом наборе заказов и работников как можно больше денег. Полный текст задачи и код программы проверки есть в репозитории. Эта задача является изменённым заказом, который мы с напарником решали в реальной жизни: оптимизация работы печатных станков для типографии. Правда, тогда и мы справились так себе, и заказчик в итоге сначала захотел всё вручную сам делать, а потом и вовсе похоронил проект при смене директора.
!!! Не читайте дальше, если хотите сначала попробовать решить самостоятельно, потому что я сейчас опишу эффективные подходы и результаты.
________________________________________
Так вот. Мы с другим экспертом Андреем сразу сели и написали разные варианты, чтобы задать шкалу, по которой будем оценивать решения команд. За пару часов я собрал примитивный жадный алгоритм, который сортировал заказы по прибыльности и укладывал в сетку кое-как, это дало нам нижнюю оценку. Мой алгоритм заработал ~75 млн виртуальных рублей, мы решили для оценки поставить нижней границей 40 млн. То есть всё, что ещё ниже, оценивалось в ноль баллов за качество оптимизации.
Затем Андрей закрылся дома на три дня и вышел на свет со сложным жадным алгоритмом, который очень хитро сортировал заказы и очень хитро укладывал их в сетку, попутно выбирая разные способы этой укладки в зависимости от конкретного заказа. Это позволило заработать ~275 млн рублей. Мы сделали верхней границей для оценки 280 млн.
К сожалению, в итоге только две команды из десяти прошли нижнюю границу, заработав, соответственно, ~91 и ~105 млн. К верхней границе не приблизился никто. И у четырёх команд алгоритм вообще не смог уложить без нарушений задачи в сетку (то есть, например, произвольно менял длительности, накладывал задачи друг на друга, давал одному работнику две задачи в один момент и так далее). Важной ошибкой команд, на мой взгляд, являлся тот факт, что никто не воспользовался возможностью запустить алгоритм на несколько минут и дать ему поработать. По условиям задания, можно было тянуть до 5 минут на одну оптимизацию, но по факту решения команд отрабатывали за единицы и десятки секунд.
На самом конкурсе, пока команды работали, я решил попробовать сделать быстрое (по времени написания) но эффективное решение. Сначала попробовал жадную сортировку + доведение до лучшего варианта методом имитации отжига. В качестве нового состояния я просто менял местами заказы целиком. Этот вариант работал пару минут и дал мне около ~200 млн дохода. К слову, команда-лидер использовала такой же подход, просто не докрутила число итераций и температуру.
Ну и потом я взял готовую либу по реализации классической генетики с особями и скрещиванием. Особью был массив с приоритетами заказов (которые конечно же нужно было аккуратно уложить чистым алгоритмом). Тип скрещивания: scattered. Всего 15 поколений по 20 особей, и это за минуту-полторы давало ~230-240 млн. Считаю, что для конкурса это самый лучший выбор: пишется одним человеком за день и даёт почти максимум, при этом легко настраивается на нужную длительность работы, легко параллелится.
Ну а потом уже дома я посидел и накодил свой вариант сложного жадного с плавающим окном перебора отсортированных заказов и плавающей же укладкой по работникам. Такая штука за две минуты зарабатывает ~281 млн. Но за три дня в условиях стресса я бы такое не сделал, скорее всего.
#dev
🟢Dans l’est de la République démocratique du #Congo, la menace des ADF prend une nouvelle ampleur. Massacres, enlèvements et expansion géographique : le groupe armé intensifie ses attaques, faisant des civils les premières victimes.
🗣Les précisions avec Malaika Élysée.
RT en français • Osez questionner !
🟢En République démocratique du #Congo, le débat sur une réforme de la Constitution refait surface. Portée par la majorité au pouvoir, l’initiative se veut inclusive. Mais dans l’Est, en proie à une insécurité persistante, elle suscite scepticisme et incompréhension. Les précisions avec Malaika Élysée.
RT en français • Osez questionner !
#Congo🇨🇩 C’est avec une immense tristesse que j’ai appris le décès de mon grand frère Roland Gilbert Okito, fils du héros national congolais Emery Patrice Lumumba 🇨🇩.
Roland n’était pas seulement l’héritier d’un nom qui a marqué l’Histoire de l’Afrique et du monde. Il était un homme de cœur, de parole et de sagesse. J’ai eu l’honneur de le connaître personnellement, et depuis notre première rencontre au Venezuela, il n’a cessé de me témoigner une écoute sincère et de me prodiguer des conseils empreints de bienveillance et de lucidité.
Il portait l’héritage de Lumumba avec humilité, dignité et sens des responsabilités, toujours animé par l’amour du Congo et la quête de justice pour les peuples africains. Sa disparition est une perte immense, non seulement pour le Congo , sa famille et ses proches, mais aussi pour tous ceux qui croient encore aux valeurs de courage, de vérité et de souveraineté.
À sa famille, au peuple congolais et à tous ceux qu’il a inspirés, j’adresse mes condoléances les plus sincères.
EB
@egountchibehanzinTV
🔴SOS GOMA, #CONGO🇨🇩🙏🏾
Au nom de la LDNA, je tiens à exprimer notre vive condamnation des récentes attaques terroristes perpétrées par le groupe M23 contre les populations innocentes de la République Démocratique du Congo. Cette guerre de pillage et d’occupation, soutenue et orchestrée par le gouvernement rwandais dirigé par le criminel de guerre Paul Kagame, constitue une agression inacceptable contre la souveraineté et l'intégrité du Congo.
Nous dénonçons fermement la complicité des États-Unis 🇺🇸 et de l'Union européenne 🇪🇺 qui, par leur soutien financier et logistique, permettent à ce groupe armé de poursuivre son agenda destructeur, visant à piller les précieuses ressources naturelles du Congo.
Nous réitérons notre solidarité avec le peuple congolais en ces temps difficiles Il est temps que le gouvernement congolais, dirigé par Félix Tshisekedi, s’affirme et assume son rôle de chef des armées. Il est temps d’arrêter d’être une marionnette. Le peuple congolais a besoin d’un vrai leader à la tête du pays, pas d’une poule mouillée.
REJOIGNEZ LA RÉSISTANCE SUR TELEGRAM.
🔺Pour les numéros français : https://t.me/egountchibehanzinTV
🔻Pour les numéros internationaux : https://t.me/EgountchiBehanzinOfficiel
@egountchibehanzinTV
#Congo#transportes Huelga salvaje de camioneros de cobalto y cobre https://www.mining.com/web/breakthrough-in-wildcat-strike-sees-some-congo-copper-drivers-resume-work/
🇷🇺🇨🇬 La #Russie et le #Congo vont créer un centre commun d’épidémiologie et de prévention des infections
La République du Congo accueille mercredi 22 et jeudi 23 avril une conférence internationale sur les maladies infectieuses. Le Congo et la Russie ont signé, mardi 21 avril, un mémorandum d’intention en vue de la création d’un centre russo-congolais de recherche en épidémiologie et de prévention des maladies infectieuses. Les détails avec Jacques Amboka, notre envoyé spécial à Brazzaville.
RT en français • Osez questionner !
Congolese people are highly superstitious. They habitually exorcise the Devil from children. However, if a priest says he can't cast the evil out of the child, the kid will be kicked out of home.
Abandoned by their families, these unfortunates are forced to beg and steal on the streets. In our film, children recount how they were thrown out.
To learn why parents have their kids exorcised, and how these poor and abandoned children get by, watch our film, The Shegué, the Sorcerer and Che Guevara.
#video#Congo
Follow: https://t.me/rtdocumentary
'We’ll die if the pit closes. It’ll be death. How will I pay for food? Where will I go?'
Henrietta from Congo cleans poisonous cobalt. Its compounds are toxic, cause diseases but Henriette has nowhere else to work and needs to feed her 4 children. This cobalt quarry is a workplace for many people. Why are there so many desperate to work with harmful mineral?
Watch the clip to know. Find out even more more about cobalt quarry workers in our documentary ‘Cobalt Hell’.
#video#Congo
Follow: https://t.me/rtdocumentary
#video#Congo
The price Congolese workers have to pay for the rest of the world to enjoy smartphones — cobalt is essential for their production — is high. Miners in the Democratic Republic of the Congo, where the bulk of the world’s cobalt is found, are forced to extract and process the ore by hand, which causes serious health problems and environmental pollution.
Yet, none of the workers is ready to give up his job. Young Congolese men agree to this backbreaking work hoping to earn enough money for university. This way, they will have a slight chance of leaving this life and helping their families. Women who raise their children alone agree to work on cobalt processing though it might ruin their health. What’s more, the idea of closing the cobalt deposit site gives them shivers because they see no other way of earning a living.
We have already announced the upcoming premiere of our new documentary Cobalt Hell, and it’s finally arrived — tune for the premiere right now!
Follow: https://t.me/rtdocumentary
Raised by the Streets
#video#Congo
They are only 15-17 years old, but they steal, do drugs, and terrorise their neighbours. Youth gangs are running rampant in the Democratic Republic of Congo. The delinquents are called Kuluna.
Kuluna gangs exist in almost every Congolese city. Each group claims their own turf and fights other gangs for respect. They make money from racketeering, fencing stolen goods, and running small businesses. According to the Organized Crime and Corruption Reporting Project, Kuluna gangs are often affiliated with local police.
Follow: https://t.me/rtdocumentary
Witch kids of Congo
#video#Congo
There are thousands of homeless children on the streets of Kinshasa. Many were kicked out because their relatives believe they are sorcerers.
Kids may be branded sorcerers for crying or misbehaving. Children accused of witchcraft are sometimes beaten and forced to undergo exorcisms. Although belief in witchcraft is common in Africa, it’s often used as an excuse for families to get rid of inconvenient children. And, it’s become a lucrative business for preachers.
Check out the full story!
Follow: https://t.me/rtdocumentary
🇨🇬🇷🇺Denis Sassou Nguesso, président de la République du #Congo, est arrivé à Moscou pour s'entretenir avec Vladimir #Poutine le 29 avril.
RT en français • Osez questionner !