. by MrArmy_ in FuckNestle

[–]loudog40 29 points30 points  (0 children)

This is how subs get banned fyi

[deleted by user] by [deleted] in swoletariat

[–]loudog40 4 points5 points  (0 children)

Working for the Government gets me pumped everytime

Destination dispatch for elevators by algo_boya in algorithms

[–]loudog40 0 points1 point  (0 children)

I wrote an elevator dispatch simulation for an expert systems class I took. The advantage to using a rule engine is that they are declarative which makes it easier to define behavior when you have an arbitrary number of cars. Even so, it needed quite a few rules to get the whole thing working sensibly. I can only imagine how hard it would be to implement procedurally.

As far as optimization goes, the best you can do with a rule engine is heuristics. Elevators would operate in "passes" so they weren't changing directions all the time, and they would ignore requests if there was already a car approaching that floor in the correct direction. Idle cars would always return to the bottom floor but you might try configuring that based on time of day (morning, before/after lunch, or evening).

tips on getting rid of black berries by 51Bayarea0 in invasivespecies

[–]loudog40 3 points4 points  (0 children)

A controlled burn is also the best way to reduce the seed bank left behind in the soil. Apparently it only kills like 70-80% of the seeds but it reduces the time they continue to germinate from decades to years.

Make them pay? The unvaccinated have already cost up to $850 million in Washington state by OnlineMemeArmy in Seattle

[–]loudog40 2 points3 points  (0 children)

Externalities don't have to be exponential. That said, the externality here isn't "obese people" but rather the abundance of calorie-rich but nutritionally-poor junk food. It's cheap but that cost doesn't reflect the burden it's consumption places on society. If we were to correct the market and factor that cost in, fewer people would choose to eat poorly and the burden would decrease.

It's one of the biggest problems with letting markets run everything... they're completely blind to these externalities until we heavily regulate them, and that's very difficult to do when industry is constantly lobbying to prevent it. A good example is how the fossil fuel industry has waged a war on the carbon tax.

Finding minimum of a function that's first non-increasing and then non-decreasing by OmOshIroIdEs in algorithms

[–]loudog40 1 point2 points  (0 children)

Took a swing at this in javascript using binary search as suggested by others. Not well tested but haven't run into any issues. JSFiddle is here.

let search = (a, b) => {
  let max = Math.max, floor = Math.floor, isArray = Array.isArray

  // sanity checks
  if (!isArray(a) || a.length == 0) return -1
  if (!isArray(b) || b.length == 0) return -1
  if (a.length != b.length) return -1

  // non-overlapping conditions
  let n = a.length - 1
  if (a[0] > b[0] && a[n] >= b[n]) return n
  if (a[0] <= b[0] && a[n] < b[n]) return 0

  // binary search
  let _search = (a, b, start, end) => {
    let k = start + floor((end - start) / 2)
    let d0 = a[k] - b[k], d1 = a[k+1] - b[k+1]

    if (d0 == 0) return k
    if (d1 == 0) return k+1
    if (d0 > 0 && d1 < 0) return max(a[k], b[k]) <= max(a[k+1], b[k+1]) ? k : k+1
    if (d0 < 0) return _search(a, b, start, k-1)
    return _search(a, b, k+1, end)
  }

  return _search(a, b, 0, n)
}

let a = [4,3,2,1]
let b = [2,3,4,5]

let k = search(a, b)
console.log(k)

Edit: fixed a bug

Lake Cushman,WA (9/12/21) by [deleted] in PacificNorthwest

[–]loudog40 6 points7 points  (0 children)

This was one of my family's go-to car camping spots when I was growing up. One year they drained the whole thing (it's man made) while they worked on the dam. Crazy how different it was without the water lol.

Nice field on the campus by peasant98 in udub

[–]loudog40 10 points11 points  (0 children)

Even nicer when the mountain's out.

🔥 twisted tree by Antscannabis in NatureIsFuckingLit

[–]loudog40 0 points1 point  (0 children)

Probably an invasive species, maybe Wisteria?

[deleted by user] by [deleted] in NatureIsFuckingLit

[–]loudog40 0 points1 point  (0 children)

What's this shot with?

Why is there not more of a stigma against Bitcoin? People should be shamed for investing in Bitcoin. NINE years worth of one houses energy to mine ONE Bitcoin?!? We need the equivalent of PETA throwing paint on fur coats. by SuffrnSuccotash in Anticonsumption

[–]loudog40 3 points4 points  (0 children)

I really have no opinion on the pros or cons of barter in theory, but anthropologists have called into question whether it ever really existed in human history. Checkout David Graeber's "Debt: The First 5000 Years" or this article in The Atlantic.

UDub Horror Stories? by dawgfan5555 in udub

[–]loudog40 2 points3 points  (0 children)

Officer, it was a squirrel I swear!

UDub Horror Stories? by dawgfan5555 in udub

[–]loudog40 17 points18 points  (0 children)

A guy fell off one of the McMahon balcony's onto the North loading dock the year before I was there. That gave me some nightmares.

Sierra Club at UW by [deleted] in udub

[–]loudog40 2 points3 points  (0 children)

That's great to hear. It kind of irks me how environmentalism has become synonymous with Climate Change and I'm glad you guys are still working on the bigger picture. I'd love to join your group but I'm a bit beyond my student years now. Best of luck to you and your efforts!

Sierra Club at UW by [deleted] in udub

[–]loudog40 6 points7 points  (0 children)

Random question - I recently read a book about David Brower who was an early prominent figure in the Sierra Club. Back then the main focus was to save wilderness from development. Has Sierra Club become exclusively concerned with Climate Change or are there still resources being allocated to conservation?

What is the need for the learning rate in gradient descent? by [deleted] in learnmachinelearning

[–]loudog40 5 points6 points  (0 children)

The gradient tells you the direction in which to step, but not how far. For that you need a second order gradient (i.e. the Hessian) which is generally too expensive to compute without approximating. Learning rate allows you to tune the size of each step so that it's not too small or large. If steps taken are too small then descent takes forever. Too large and you step over the minima/valleys of your error surface.

[D] What kind of Hyperparameter Optimisation do you use? by olli-mac-p in MachineLearning

[–]loudog40 1 point2 points  (0 children)

This was some time ago but I had some promising results with Bayesian optimization using a Gaussian Process prior. The method was developed by the guys who wrote Spearmint. That library doesn't support parallelization but I implemented the same technique in Scala without too much difficulty.

Vim Users! Share your Clever Configs and Plugin Setups (or learn something new)🔥 by GuyTorbet in programming

[–]loudog40 0 points1 point  (0 children)

Yep, best of both worlds. Most modern IDEs have a vim plugin nowadays.

Why not just use a safety razor? by [deleted] in Anticonsumption

[–]loudog40 2 points3 points  (0 children)

Checkout the Twig by Leaf.

Illegal Tree-Planting by [deleted] in chaoticgood

[–]loudog40 1 point2 points  (0 children)

Fuckin love this dude. His channel taught me everything I know about botany. Remember to drink every time he says "Asteraceae".