В общем, была задача на оптимизацию плана работ: есть набор заказов, и в каждом N тасков. Таски могут зависеть друг от друга или нет, имеют длительность и тип. Ещё есть M работников, каждый из которых может выполнять таски только определённых типов, причём, у каждого своя скорость.
Если все таски в заказе выполнены, фирма получает сколько-то денег. У заказа есть дедлайн, за просрочку штраф (за каждый день просрочки), который вычитается из цены заказа. И ещё фирма тратит деньги за каждый день своей работы независимо от того, как загружены её сотрудники (то есть просто платит зарплаты по сути). Ещё важен учёт праздников и выходных.
Нужно заработать на определённом наборе заказов и работников как можно больше денег. Полный текст задачи и код программы проверки есть в репозитории. Эта задача является изменённым заказом, который мы с напарником решали в реальной жизни: оптимизация работы печатных станков для типографии. Правда, тогда и мы справились так себе, и заказчик в итоге сначала захотел всё вручную сам делать, а потом и вовсе похоронил проект при смене директора.
!!! Не читайте дальше, если хотите сначала попробовать решить самостоятельно, потому что я сейчас опишу эффективные подходы и результаты.
________________________________________
Так вот. Мы с другим экспертом Андреем сразу сели и написали разные варианты, чтобы задать шкалу, по которой будем оценивать решения команд. За пару часов я собрал примитивный жадный алгоритм, который сортировал заказы по прибыльности и укладывал в сетку кое-как, это дало нам нижнюю оценку. Мой алгоритм заработал ~75 млн виртуальных рублей, мы решили для оценки поставить нижней границей 40 млн. То есть всё, что ещё ниже, оценивалось в ноль баллов за качество оптимизации.
Затем Андрей закрылся дома на три дня и вышел на свет со сложным жадным алгоритмом, который очень хитро сортировал заказы и очень хитро укладывал их в сетку, попутно выбирая разные способы этой укладки в зависимости от конкретного заказа. Это позволило заработать ~275 млн рублей. Мы сделали верхней границей для оценки 280 млн.
К сожалению, в итоге только две команды из десяти прошли нижнюю границу, заработав, соответственно, ~91 и ~105 млн. К верхней границе не приблизился никто. И у четырёх команд алгоритм вообще не смог уложить без нарушений задачи в сетку (то есть, например, произвольно менял длительности, накладывал задачи друг на друга, давал одному работнику две задачи в один момент и так далее). Важной ошибкой команд, на мой взгляд, являлся тот факт, что никто не воспользовался возможностью запустить алгоритм на несколько минут и дать ему поработать. По условиям задания, можно было тянуть до 5 минут на одну оптимизацию, но по факту решения команд отрабатывали за единицы и десятки секунд.
На самом конкурсе, пока команды работали, я решил попробовать сделать быстрое (по времени написания) но эффективное решение. Сначала попробовал жадную сортировку + доведение до лучшего варианта методом имитации отжига. В качестве нового состояния я просто менял местами заказы целиком. Этот вариант работал пару минут и дал мне около ~200 млн дохода. К слову, команда-лидер использовала такой же подход, просто не докрутила число итераций и температуру.
Ну и потом я взял готовую либу по реализации классической генетики с особями и скрещиванием. Особью был массив с приоритетами заказов (которые конечно же нужно было аккуратно уложить чистым алгоритмом). Тип скрещивания: scattered. Всего 15 поколений по 20 особей, и это за минуту-полторы давало ~230-240 млн. Считаю, что для конкурса это самый лучший выбор: пишется одним человеком за день и даёт почти максимум, при этом легко настраивается на нужную длительность работы, легко параллелится.
Ну а потом уже дома я посидел и накодил свой вариант сложного жадного с плавающим окном перебора отсортированных заказов и плавающей же укладкой по работникам. Такая штука за две минуты зарабатывает ~281 млн. Но за три дня в условиях стресса я бы такое не сделал, скорее всего.
#dev
China has responded to Trump's actions with reciprocal #tariffs, maintaining the current exemptions while stating that new tariffs will not be waived.
Starting March 10, China will impose additional tariffs on select U.S. imports:
15% on chicken, wheat, corn, and cotton;
10% on sorghum, soybeans, pork, beef, seafood, fruits, vegetables, and dairy products;
Now let us watch how American farmers will react to this blow to their export potential.
#Tariffs
С 01.01.2025 г. ООО "ПортСервис" применяет ставку НДС 7%.
Уведомление о применении ставки 7% Вы можете найти по ссылке https://disk.yandex.ru/i/grdzxfedHTXk8g
Thrilled to share a monumental milestone in our global trade evolution! 🚀
On April 3, exactly one year after our visionary announcement, President Donald Trump officially signed decrees to launch a transformative new chapter for medicines and metals. This strategic initiative is perfectly aligned with our core mission to empower American innovation and drive sustainable growth. 🇺🇸✨
We are excited to introduce a dynamic 15% duty on medicines from EU partners, with a robust 100% framework for nations outside our trade ecosystem, fostering a powerful incentive for international pharmaceutical leaders to relocate their production hubs to the United States. 💊🏭 Furthermore, starting next Monday, April 6, we are rolling out a high-impact 25% tariff on finished metal goods rich in steel, aluminum, and copper. This bold move is designed to supercharge the construction and automotive sectors, creating unprecedented opportunities for industry leaders. 🏗🚗
This strategic pivot not only optimizes government revenue streams but also reaffirms our unwavering commitment to economic sovereignty, building upon our trade policy legacy even as we navigate the Supreme Court's earlier rulings with agility and foresight. We are incredibly grateful for this chance to reshape the future of commerce together! 🤝📈
#Trump#Tariffs
👂More on Trump's Ear
⚠️
The first company sued the US government over Trump's tariffs.
The tariff war is escalating: after the crushing defeat of Donald Trump and his customs policy in the US Supreme Court, the logistics giant FedEx is now attacking the government. ⚖️
The concern demands the return of the customs fees paid and applies to the court for this.
This is the first lawsuit filed by a large American company after the Supreme Court's decision.
FedEx may be just the beginning of a wave of lawsuits, as on Friday the highest court in Washington officially declared the duties imposed by President Donald Trump illegal. 📉
#Trump#Tariffs
👂More on Trump's Ear ⚠️
The U.S. Supreme Court, by a vote of 6-3, declared unconstitutional the president's imposition of tariffs/duties against other countries. ⚖️
#Trump#Tariffs
👂More on Trump's Ear ⚠️
US businesses and consumers paid about 90% of the cost of President Donald Trump’s sweeping tariffs last year — contradicting his repeated claims that foreign countries were footing the bill, according to a new study from the Federal Reserve Bank of New York.
In the first eight months of 2025, 94% of the cost of tariffs was borne by American businesses and consumers, study found.
In September and October, that share slipped to 92%, and in November it fell further to 86% as foreign exporters picked up a larger share of the costs, according to the report.
#Trump#Tariffs
👂More on Trump's Ear ⚠️
Trump's duties are almost entirely paid for by Americans
Almost all the costs of American duties fall on the residents of the United States themselves, and not on foreign manufacturers. This is the conclusion reached by the Kiel Institute of World Economy, having studied about $4 trillion of supplies from the beginning of 2024 to the end of 2025 — WSJ.
According to the researchers' calculations, foreign exporters reduced prices by only 4% and took on the minimum part of the burden. The remaining 96% was paid by American importers and buyers. In fact, duties work as a tax on consumption within the United States, and not as a tool of pressure on foreign businesses.
In 2025, the United States received about $200 billion from duties. The Americans paid almost the entire amount. At first, buyers felt only a part of the price increase - about 20%. The rest of the expenses were temporarily paid by the companies themselves. Later, these costs will be shifted to the buyers, the researchers say.
#Trump#Tariffs
👂More on Trump's Ear ⚠️
Forget retaliation: To cut tariffs President Trump imposed on their country, the Swiss sent a delegation of industry tycoons bearing gifts — a special Rolex desktop clock, a 1-kilogram personalized gold bar, and loads of flattery.
#Trump#Tariffs
👂More on Trump's Ear
US President Donald Trump has made an incredible statement 😮🇺🇸: he wants to pay every citizen of the country $2,000 💵🎁.
The only exceptions are those with high incomes 💼📈.
According to Trump, this will be a "dividend" from the duties he imposed 💬💰.
#Trump#Tariffs
👂More on Trump's Ear
Taxes, duties, and military bases. How Europe Can Respond to Donald Trump
Donald Trump's talk about taking control of Greenland has Europe thinking about how to push back. BILD is throwing out a bunch of ideas, from economic to military, that could put pressure on the Trump administration.
One idea is to go after American tech companies. In Germany, they're talking about a 10% digital tax for companies like Google, Meta, Amazon, Apple, and Microsoft, which make billions in Europe but don't pay much in taxes.
Trade is another option. The EU could either block a new trade deal with the U.S. or slap tariffs on up to 93 billion euros worth of American goods, like bourbon, soybeans, and airplane parts. They're also talking about taxing digital services like cloud storage, streaming, and online ads.
Western countries could even start selling off U.S. government bonds, but experts don't think it'll do much. The U.S. Federal Reserve can just buy them back.
The most extreme idea is to close American military bases in Europe, like Ramstein and Stuttgart. Shutting these down would really hurt the U.S.'s global strategy, but Europe thinks it's too risky, especially with threats on NATO's eastern border.
#EU#Tariffs
👂More on Trump's Ear ⚠️