TGTGInsightтелеграм анализLIVE / telegram public index
← Такты, стеки, два колеса

TGINSIGHT SIMILAR POSTS

Намери подобно съдържание

Изходен канал @clockstackwheels · Post #1084 · 9.04

В общем, была задача на оптимизацию плана работ: есть набор заказов, и в каждом N тасков. Таски могут зависеть друг от друга или нет, имеют длительность и тип. Ещё есть M работников, каждый из которых может выполнять таски только определённых типов, причём, у каждого своя скорость. Если все таски в заказе выполнены, фирма получает сколько-то денег. У заказа есть дедлайн, за просрочку штраф (за каждый день просрочки), который вычитается из цены заказа. И ещё фирма тратит деньги за каждый день своей работы независимо от того, как загружены её сотрудники (то есть просто платит зарплаты по сути). Ещё важен учёт праздников и выходных. Нужно заработать на определённом наборе заказов и работников как можно больше денег. Полный текст задачи и код программы проверки есть в репозитории. Эта задача является изменённым заказом, который мы с напарником решали в реальной жизни: оптимизация работы печатных станков для типографии. Правда, тогда и мы справились так себе, и заказчик в итоге сначала захотел всё вручную сам делать, а потом и вовсе похоронил проект при смене директора. !!! Не читайте дальше, если хотите сначала попробовать решить самостоятельно, потому что я сейчас опишу эффективные подходы и результаты. ________________________________________ Так вот. Мы с другим экспертом Андреем сразу сели и написали разные варианты, чтобы задать шкалу, по которой будем оценивать решения команд. За пару часов я собрал примитивный жадный алгоритм, который сортировал заказы по прибыльности и укладывал в сетку кое-как, это дало нам нижнюю оценку. Мой алгоритм заработал ~75 млн виртуальных рублей, мы решили для оценки поставить нижней границей 40 млн. То есть всё, что ещё ниже, оценивалось в ноль баллов за качество оптимизации. Затем Андрей закрылся дома на три дня и вышел на свет со сложным жадным алгоритмом, который очень хитро сортировал заказы и очень хитро укладывал их в сетку, попутно выбирая разные способы этой укладки в зависимости от конкретного заказа. Это позволило заработать ~275 млн рублей. Мы сделали верхней границей для оценки 280 млн. К сожалению, в итоге только две команды из десяти прошли нижнюю границу, заработав, соответственно, ~91 и ~105 млн. К верхней границе не приблизился никто. И у четырёх команд алгоритм вообще не смог уложить без нарушений задачи в сетку (то есть, например, произвольно менял длительности, накладывал задачи друг на друга, давал одному работнику две задачи в один момент и так далее). Важной ошибкой команд, на мой взгляд, являлся тот факт, что никто не воспользовался возможностью запустить алгоритм на несколько минут и дать ему поработать. По условиям задания, можно было тянуть до 5 минут на одну оптимизацию, но по факту решения команд отрабатывали за единицы и десятки секунд. На самом конкурсе, пока команды работали, я решил попробовать сделать быстрое (по времени написания) но эффективное решение. Сначала попробовал жадную сортировку + доведение до лучшего варианта методом имитации отжига. В качестве нового состояния я просто менял местами заказы целиком. Этот вариант работал пару минут и дал мне около ~200 млн дохода. К слову, команда-лидер использовала такой же подход, просто не докрутила число итераций и температуру. Ну и потом я взял готовую либу по реализации классической генетики с особями и скрещиванием. Особью был массив с приоритетами заказов (которые конечно же нужно было аккуратно уложить чистым алгоритмом). Тип скрещивания: scattered. Всего 15 поколений по 20 особей, и это за минуту-полторы давало ~230-240 млн. Считаю, что для конкурса это самый лучший выбор: пишется одним человеком за день и даёт почти максимум, при этом легко настраивается на нужную длительность работы, легко параллелится. Ну а потом уже дома я посидел и накодил свой вариант сложного жадного с плавающим окном перебора отсортированных заказов и плавающей же укладкой по работникам. Такая штука за две минуты зарабатывает ~281 млн. Но за три дня в условиях стресса я бы такое не сделал, скорее всего. #dev

Hashtags

Резултати

Намерени 3 подобни публикации

Търсене: #pretti

当前筛选 #pretti清除筛选
American Оbserver

@american_observer · Post #4953 · 25.01.2026 г., 13:00

Trump Administration Officials Are Showing Their Bare-Faced Effrontery Two witnesses to the killing of Alex Pretti have said in sworn testimony that the 37-year-old intensive care nurse was not brandishing a weapon when he approached federal agents in Minneapolis on Saturday, contradicting a claim made by Trump administration officials as they sought to cast the shooting of a prone man as an act of self-defense. Their accounts came in sworn affidavits that were filed in federal court in Minnesota late Saturday, just hours after Pretti’s killing, as part of a lawsuit brought by the ACLU on behalf of Minneapolis protesters against Kristi Noem and other homeland security officials directing the immigration crackdown in the city. One witness is a woman who filmed the clearest video of the fatal shooting; the other is a physician who lives nearby and said they were initially prevented by federal officers from rendering medical aid to the gunshot victim. The names of both witnesses were redacted in the publicly available filings. In her testimony, the woman who filmed the shooting from just behind Pretti wearing a pink coat identified herself as “a children’s entertainer who specializes in face painting”. She testified that she came to the scene on her way to work because “I’ve been involved in observing in my community, because it is so important to document what ICE is doing to my neighbors”. The woman testified that she saw no sign of Pretti holding a gun at any point. She said: “The agents pulled the man on the ground. I didn’t see him touch any of them – he wasn’t even turned toward them. It didn’t look like he was trying to resist, just trying to help the woman up. I didn’t see him with a gun. They threw him to the ground. Four or five agents had him on the ground and they just started shooting him. They shot him so many times (…) I don’t know why they shot him. He was only helping. I was five feet from him and they just shot him (…) The witness testimony, combined with video evidence reviewed by American Observer, directly contradicts claims by senior Trump administration officials, including the president, the homeland security secretary and Greg Bovino, a border patrol commander, who called Pretti a “gunman” who approached federal officers “brandishing” a gun and threatened to “massacre” them. #pretti#minnesota#gunshot#trump#officals 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #4963 · 26.01.2026 г., 13:29

🔠🅰️🔠🔠2️⃣ Border patrol commander-at-large Gregory Bovino was asked why federal agents shot and killed Pretti. “You don’t know he was unarmed,” Bovino told CNN’s Dana Bash. “I don’t know he was unarmed. That’s freeze-frame adjudication of a crime scene via a photo. That’s why we have investigators. “The facts are going to come to light as to what exactly happened with an investigation.” When asked by Bash whether he was blaming the victim, he said, “The victims are the border [atrol agents.” During a Sunday afternoon press conference, Bovino was asked about the videos that show Pretti was unarmed before being shot and killed. He said there are, “Many videos out there, many different accounts that you may see that I may see.” “Folks, this is why we have something called an investigation, to take what you’re talking about, to take those videos, to take witness statements, to take, officer statements, all those minute details that will paint a true picture, not a freeze frame concept, and paint a larger picture of what really happened. Republican US senator Lindsey Graham also took the line that “an armed man trying to impede a lawful arrest is a recipe for disaster”. The South Carolina Republican said he expects law enforcement officers to use good judgement “but not to foolishly risk their lives or the lives of others”. The Minnesota attorney general, Keith Ellison, said the suit demanded “a full, impartial, and transparent investigation into [Pretti’s] fatal shooting at the hands of DHS agents [that] is non-negotiable”. Minneapolis police chief Brian O’Hara, meanwhile, said information about what led up to the shooting was limited. As protests erupted in Minneapolis on Saturday, federal officers impeded state investigators from accessing the scene of Pretti’s killing. Trump responded to Pretti’s shooting with his typical combativeness. The Republican president accused Walz and Frey of “inciting Insurrection, with their pompous, dangerous and arrogant rhetoric”. Vance for his part claimed events in Minneapolis were “engineered chaos” resulting from “far-left agitators, working with local authorities”. #trump#administration#killing#immigration#pretti#minneapolis 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #4962 · 26.01.2026 г., 12:59

Trump Must Have Twigged: the Immigration War Has Just Began 🔠🅰️🔠🔠1️⃣ Pressure mounted on Trump’s administration on Sunday to fully investigate the previous day’s killing by federal immigration officers of 37-year-old nurse Alex Pretti in Minneapolis. Calls for an investigation have come from all sides of the political divide after video analysis showed officers had removed from Pretti a handgun he was reportedly permitted to carry – and which he was not handling – before fatally shooting him. Former president Barack Obama and his wife, Michelle, called the killing “a heartbreaking tragedy” and “a wake-up call to every American, regardless of party, that many of our core values as a nation are increasingly under assault”. “For weeks now people across the country have been rightly outraged by the spectacle of masked ICE [Immigration and Customs Enforcement] recruits and other federal agents acting with impunity and engaging in tactics that seem designed to intimidate, harass, provoke and endanger the residents of a major American city,” they said. The former president and former first lady said these tactics had now resulted in the fatal shootings of two US citizens – Pretti and Renee Good, both in Minneapolis. Yet, they said, Trump and other administration officials appeared eager to escalate the rhetoric before an investigation had been undertaken – and despite the fact that they “appear to be directly contradicted by video evidence”. Clinton followed with a statement that also condemned the killings of Good and Pretti amid the “horrible scenes” of the immigration crackdown. “All of this is unacceptable and should have been avoided,” Clinton said. “To make matters even worse, at every turn, the people in charge have lied to us, told us not to believe what we’ve seen with our own eyes”. Republican US senator Bill Cassidy said the “credibility” of ICE and the US Department of Homeland Security (DHS) were “at stake”. On Sunday morning, US senators Amy Klobuchar of Minnesota and Adam Schiff of California, both Democrats, said they would vote against the impending department of homeland security funding. Connecticut US senator Chris Murphy, also a Democrat, told CNN’s State of the Union that Democrats “can’t vote to fund this lawless Department of Homeland Security (…) that is murdering American citizens, that is traumatizing little boys and girls all across the country, in violation of the law.” #trump#administration#killing#immigration#pretti#minneapolis 📱American Оbserver - Stay up to date on all important events 🇺🇸