В общем, была задача на оптимизацию плана работ: есть набор заказов, и в каждом N тасков. Таски могут зависеть друг от друга или нет, имеют длительность и тип. Ещё есть M работников, каждый из которых может выполнять таски только определённых типов, причём, у каждого своя скорость.
Если все таски в заказе выполнены, фирма получает сколько-то денег. У заказа есть дедлайн, за просрочку штраф (за каждый день просрочки), который вычитается из цены заказа. И ещё фирма тратит деньги за каждый день своей работы независимо от того, как загружены её сотрудники (то есть просто платит зарплаты по сути). Ещё важен учёт праздников и выходных.
Нужно заработать на определённом наборе заказов и работников как можно больше денег. Полный текст задачи и код программы проверки есть в репозитории. Эта задача является изменённым заказом, который мы с напарником решали в реальной жизни: оптимизация работы печатных станков для типографии. Правда, тогда и мы справились так себе, и заказчик в итоге сначала захотел всё вручную сам делать, а потом и вовсе похоронил проект при смене директора.
!!! Не читайте дальше, если хотите сначала попробовать решить самостоятельно, потому что я сейчас опишу эффективные подходы и результаты.
________________________________________
Так вот. Мы с другим экспертом Андреем сразу сели и написали разные варианты, чтобы задать шкалу, по которой будем оценивать решения команд. За пару часов я собрал примитивный жадный алгоритм, который сортировал заказы по прибыльности и укладывал в сетку кое-как, это дало нам нижнюю оценку. Мой алгоритм заработал ~75 млн виртуальных рублей, мы решили для оценки поставить нижней границей 40 млн. То есть всё, что ещё ниже, оценивалось в ноль баллов за качество оптимизации.
Затем Андрей закрылся дома на три дня и вышел на свет со сложным жадным алгоритмом, который очень хитро сортировал заказы и очень хитро укладывал их в сетку, попутно выбирая разные способы этой укладки в зависимости от конкретного заказа. Это позволило заработать ~275 млн рублей. Мы сделали верхней границей для оценки 280 млн.
К сожалению, в итоге только две команды из десяти прошли нижнюю границу, заработав, соответственно, ~91 и ~105 млн. К верхней границе не приблизился никто. И у четырёх команд алгоритм вообще не смог уложить без нарушений задачи в сетку (то есть, например, произвольно менял длительности, накладывал задачи друг на друга, давал одному работнику две задачи в один момент и так далее). Важной ошибкой команд, на мой взгляд, являлся тот факт, что никто не воспользовался возможностью запустить алгоритм на несколько минут и дать ему поработать. По условиям задания, можно было тянуть до 5 минут на одну оптимизацию, но по факту решения команд отрабатывали за единицы и десятки секунд.
На самом конкурсе, пока команды работали, я решил попробовать сделать быстрое (по времени написания) но эффективное решение. Сначала попробовал жадную сортировку + доведение до лучшего варианта методом имитации отжига. В качестве нового состояния я просто менял местами заказы целиком. Этот вариант работал пару минут и дал мне около ~200 млн дохода. К слову, команда-лидер использовала такой же подход, просто не докрутила число итераций и температуру.
Ну и потом я взял готовую либу по реализации классической генетики с особями и скрещиванием. Особью был массив с приоритетами заказов (которые конечно же нужно было аккуратно уложить чистым алгоритмом). Тип скрещивания: scattered. Всего 15 поколений по 20 особей, и это за минуту-полторы давало ~230-240 млн. Считаю, что для конкурса это самый лучший выбор: пишется одним человеком за день и даёт почти максимум, при этом легко настраивается на нужную длительность работы, легко параллелится.
Ну а потом уже дома я посидел и накодил свой вариант сложного жадного с плавающим окном перебора отсортированных заказов и плавающей же укладкой по работникам. Такая штука за две минуты зарабатывает ~281 млн. Но за три дня в условиях стресса я бы такое не сделал, скорее всего.
#dev
A federal judge late Sunday temporarily blocked the Trump administration from deploying any National Guard units to Oregon at all, after a legal whirlwind that began hours earlier when the president mobilized California troops for Portland after the same judge blocked him from using Oregon’s National Guard the day before.
During a hastily called evening telephone hearing, U.S. District Judge Karin Immergut granted a temporary restraining order sought by California and Oregon.
Immergut, who was appointed by President Donald Trump in his first term, seemed incredulous that the president moved to send National Guard troops to Oregon from neighboring California and then from Texas on Sunday, just hours after she had ruled the first time.
#Trump#Guard
👂More on Trump's Ear ⚠️
Up to 1,700 National Guardsmen are set to mobilize in 19 states in the coming weeks to assist the Department of Homeland Security with President Donald Trump’s nationwide crackdown on illegal immigration and crime, Pentagon officials confirmed to Fox News.
Documents obtained by Fox News show planning for activations in Alabama, Arkansas, Florida, Georgia, Idaho, Indiana, Iowa, Louisiana, Nebraska, Nevada, New Mexico, Ohio, South Carolina, South Dakota, Tennessee, Texas, Utah, Virginia and Wyoming – with status effective from August through mid-November. Texas is projected to host the most significant Guard presence.
The National Guard soldiers being mobilized will effectively serve as a support pillar to a sweeping federal interagency effort, while also serving as a visible deterrent force, a U.S. Defense official said. The service members supporting ICE will be performing case management, transportation, logistical support and clerical functions associated with the processing of illegal migrants at the facilities.
"The in-and-out processing may include personal data collection, fingerprinting, DNA swabbing and photographing of personnel in ICE custody," the official said.
#Trump#Guard#ICE
👂More on Trump's Ear ⚠️
🔥NEW RELEASE🔥
😁Master The Move: The Shoulder Crunch Series By John Danaher😁
➡️Learn The Shoulder Crunch System That John Danaher’s Elite Students Use To Break Through Modern No-Gi Guards & Control Opponents Like Never Before
➡️This position has become a staple in the arsenal of Danaher’s most successful students, including Gordon Ryan and Giancarlo Bodoni, for its ability to shut down modern pressure passing, neutralize resistance, and launch devastating attacks.
$197😍$19.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
🌈UFC Picks
👑MasterClass
✈️@bjjfanaticsinstructionals
#JohnDanaher#NewWave#NoGi#Guard
💁♀️Buy
💁♀️
😁2 on 1 by Nicholas Meregali😁
➡️The 2-on-1 guard is one of the most reliable and beginner-friendly guards in jiu-jitsu. You don’t need high skill, complex movements, or years of experience to make it work.
➡️Why? Because the moment you pull the opponent’s arm across your center line, you take away their athletic power. Their ability to pressure, explode, or pass your guard drops instantly. This creates a stable, safe guard that works against any belt, any size, and any level of opponent.
$197😍$19.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
👑MasterClass
✈️@bjjfanaticsinstructionals
#NicholasMeregali#Guard#Gi#NewWave
💁♀️Buy
💁♀️
😁The Best of Both Worlds by Magid Hage😁
➡️Learn pummeling drills you’ve never seen before that will help you gain an all-new perspective on obtaining both underhooks and overhooks.
➡️Upgrade classic passes like the knee cut with brutal controlling details that maximize the use of powerful underhooks.
$97😍$9.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
👑MasterClass
✈️@bjjfanaticsinstructionals
#MagidHage#Guard#NoGi#IBJJF
💁♀️Buy
💁♀️
🔥NEW RELEASE🔥
😁Octopus Guard 2.0 by Craig Jones😁
➡️In this updated course, Craig Jones refines the original framework with cleaner entries, stronger off-balancing, and smoother transitions to the back, legs, and top position
➡️Built specifically for modern no-gi grappling, this system thrives against aggressive passers who want to stay on their feet and smash forward.
$197😍$19.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
👑MasterClass
✈️@bjjfanaticsinstructionals
#CraigJones#Guard#NoGi#BTeam
💁♀️Buy
💁♀️
🔥NEW RELEASE🔥
😁Clamp Guard Engineering by Adam Wardzinski😁
➡️Adam Wardziński is widely regarded as the most dominant gi competitor in the world today, and his guard is the foundation of that success. Simple, ruthless, and almost impossible to pass, Adam’s system isn’t about flashy movements — it’s about total control.
➡️Used alongside his devastating hook sweeps and closed guard attacks, the clamp allows Adam to slow the game down, shut down passing pressure, and force opponents into predictable reactions — all while staying one step ahead.
$147😍$11.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
👑MasterClass
✈️@bjjfanaticsinstructionals
#AdamWardzinski#Guard#Gi#IBJJF
💁♀️Buy
💁♀️
🔥NEW RELEASE🔥
😁Jiu-Jitsu For Old Guys: Guard Retention By Bernardo Faria😁
➡️Unlock the secrets to maintaining a strong guard and thriving on the mats with Bernardo Faria’s proven methods. As a 5x Black Belt World Champion, Faria has crafted this instructional specifically for older grapplers looking to retain guard with minimal energy expenditure while focusing on the fundamentals.
➡️With his in-depth understanding of leverage, timing, and the small details that make a big difference, Faria's Guard Retention series is a game-changer for older practitioners looking to elevate their Jiu-Jitsu without burning out.
➡️Whether you're a seasoned practitioner or just getting started, you'll learn how to guard with confidence and mastery, adapting the principles of BJJ to your unique body and experience level.
$197😍$19.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
🌈UFC Picks
👑MasterClass
✈️@bjjfanaticsinstructionals
#BernardoFaria#BJJFanatics#Guard#Gi
💁♀️Buy
💁♀️
🔠🅰️🔠🔠2️⃣
Some cynics also note that the president’s pause will last throughout the trading week on global markets. With stock futures tumbling and oil prices soaring coming out of the weekend, was he simply seeking to stitch a cushion of market stability?
It wouldn’t be the first time that official statements seemed aimed at taming volatility. And it worked again: The Dow, the S&P 500 and the Nasdaq all rose over 1% Monday, while Brent crude, the global oil benchmark, fell 11%. US drivers will hope for a break at the gasoline pumps.
Trump may want to buy time for another reason: The US forces that might give him the option to invade Kharg Island — the epicenter of Iran’s oil industry and a vital economic hub — or to occupy islands and coastal regions in the Strait are not yet fully assembled.
One US Marine Expeditionary Unit that deployed from Japan may reach the region soon. But a second only set off from the West Coast last week.
It’s also worth remembering that Trump loves hyperbole. Experience suggests that his hyping of diplomatic progress and claims Iran “badly” wants a deal may be overstatements — even if deliberate deception is sometimes a tool statesmen use to create space for breakthroughs.
The president’s wild gyrations that had him talking about “winding down” the war one day and escalating it the next were incompatible with the traditions of stable war leadership.
But they were quintessential Trump. By Monday, it all looked like a ruse to allow him to argue his hard-man tactics had forged diplomatic progress.
This unpredictability and tendency to try to mitigate his self-created crises is familiar from Trump’s personal life and his business and political career, as well as his multiple scrapes with the justice system.
Each day often unfolds as a quest to remain standing by nightfall. With this technique, Trump delays reckonings and defers the worst consequences of his actions in an endless improvisational dance.
Yet there’s a sobering possibility that Trump’s erratic method may be tested beyond its limits in the Persian Gulf.
Iran might be outgunned by the US and Israeli assault and suffering extremely heavy losses to its naval, air and land-based assets during a war that has wiped out senior members of the Islamic clerical regime.
But as the conflict enters a fourth week, it’s also demonstrated its own leverage after effectively closing the Strait of Hormuz and holding the global economy — and Republican political hopes in November — hostage.
Logic suggests a regime that was already ultra-radical before the war is unlikely to be more open to Trump’s demands after the killing of its supreme leader and enduring an onslaught from US and Israeli missiles and jets.
Trump’s terms for ending the war — likely to include Iran renouncing its nuclear program and long-range ballistic missiles — may be deal-breakers. That’s because the last three weeks show exactly why a rogue regime might decide to pursue such insurance policies against future attacks by foreign powers.
Even if talks do open — and Pakistan has offered to hold them — it’s not clear who would be negotiating for Iran. A regime that has decentralized authority and lost key figures may struggle to make collective decisions.
And if, as some experts believe, the Islamic Revolutionary Guard Corps are now in full control, it might be even more hardline than before.
Moreover, in the past Washington has spoken to relatively moderate Iranian officials, only to find more radical figures set against compromise.
It also would not be surprising if Iran’s leaders interpret the president’s reversals, contradictions and emotional social media posts as signs that their strategy of imposing economic consequences on Trump is working.
#trump#frustrated#tehran#guard#corps#israel
📱American Оbserver - Stay up to date on all important events
🇺🇸
Trump Had Grown Frustrated With Tehran: the War Is Not Over
🔠🅰️🔠🔠1️⃣
Wars, unlike illegal tariffs, cannot be switched on and off to meet a president’s whims or to permanently shore up free-falling markets.
So the key question following President Donald Trump’s suspension of threatened strikes against Iran’s power plants is not whether he’s had another TACO (“Trump always chickens out”) moment.
It’s whether Trump can get out of his war on Iran, even if he wants to.
After days of oscillating rhetoric, Trump signaled a first potential de-escalation in the conflict Monday, when he cited 15 points of agreement in what he said were productive talks with Iran. Tehran said there’d been no dialogue.
The most hopeful spin on the latest developments is that US and Iran have both reached a point where the cost of climbing the escalation ladder would be so horrific that both need a way out. Such epiphanies can begin to end wars.
An oil tanker sits anchored as the traffic is down in the Strait of Hormuz in Muscat, Oman, on March 10.
Trump had dragged the enemies to the brink by threatening to bomb Iran’s power plants if it didn’t open the Strait of Hormuz, a chokepoint for oil exports. Tehran had promised to retaliate by torching vital infrastructure in US-allied Gulf states.
The conflagration could have set off a global recession and worsened dire humanitarian conditions for the very Iranian civilians Trump pledged to help.
But there are many reasons for skepticism that a breakthrough is imminent.
Days of erratic, contradictory rhetoric from Trump and the administration’s inability to cite a consistent rationale for the war or to plot an exit strategy mean that any single US statement lacks credibility.
The president’s habit of bombing during his own deadlines in Iran mean no one would be surprised if he broke his own five-day moratorium on striking the country’s power plants.
#trump#frustrated#tehran#guard#corps#israel
📱American Оbserver - Stay up to date on all important events
🇺🇸