u/Aphrontic_Alchemist

[WP] Records of this civilization long since eroded into dust, decayed into the earth. Yet they long to be remembered again, so they made the earth and sky sing the memories they contained.

reddit.com
u/Aphrontic_Alchemist — 1 day ago
▲ 14 r/latin

How were -uus and -vus differentiated in written Classical Latin?

Both were written -VVS (e.g. CONTINVVS [kɔnˈtɪ.nu.ʊs] and ÁCTÍVVS [aːkˈtiː.wʊs]).

reddit.com
u/Aphrontic_Alchemist — 5 days ago

[WP] I bethink a time when the echt sky taunted us with its lease freedom. When the twinkling stars jibed at us for being shackled to the earth. Before our lord shielded us with his hallowed welkin. Listen. The errand-ghosts are ringing his welkin for his downcoming. Graith yourself for his wisings.

reddit.com
u/Aphrontic_Alchemist — 12 days ago

[WP] A fleet of aliens landed somewhere on Earth, asking for writings of all religions, both extinct and extant. A human cleric asked the leader, "Why?" The leader answered "We believe that the highest worship is syncretizing all perspectives of the divine, no matter how contradictory."

reddit.com
u/Aphrontic_Alchemist — 18 days ago

I tried adapting the Held-Karp Algorithm to maximize cost, but the tours visit only some of the cities and give the wrong cost.

I tried adapting the C++ implementation in Rosetta Code:

#include <climits>
#include <iostream>
#include <vector>
using namespace std;
typedef unsigned long long ull;

void heldKarpMax(const vector<vector<ull>>& dist) {
  int numberOfCities = dist.size(),
      totalSubsets = 1 << numberOfCities;

  // dp[mask][j] = max cost to start at 0, visit exactly the cities in mask, and end at j
  vector<vector<ull>> dp(totalSubsets, vector<ull>(numberOfCities, 0));
  // parent[mask][j] = best predecessor of j in the optimal path for (mask, j)
  vector<vector<int>> parent(totalSubsets, vector<int>(numberOfCities, -1));
  // base case: mask = (1<<0), at city 0, cost = 0
  dp[1][0] = 0;  
  
  // Build up DP table
  for(int mask = 1; mask < totalSubsets; ++mask) {
    // Always include city 0 in the tour
    if(!(mask & 1)) continue;
    for(int j = 1; j < numberOfCities; ++j) {
      //  Skip if city j isn't in the current subset
      if(!(mask & (1 << j))) continue;
      int prevMask = mask ^ (1 << j);
      for(int k = 0; k < numberOfCities; ++k) {
      // Skip if city k isn't in the previous subset
        if(!(prevMask & (1 << k))) continue;
        ull cost = dp[prevMask][k] + dist[k][j];
        if(cost > dp[mask][j]) {
          dp[mask][j] = cost;
          parent[mask][j] = k;
        }
      }
    }
  }

  // Close the tour by returning to city 0
  int fullMask = totalSubsets - 1,
      lastCity = -1;
  ull maxCost = 0;
  for(int j = 1; j < numberOfCities; ++j) {
  ull cost = dp[fullMask][j] + dist[j][0];
    if(cost > maxCost) {
      maxCost = cost;
      lastCity = j;
    }
  }
    
  // Reconstruct the optimal tour
  vector<int> tour;
  int mask = fullMask, 
      cur = lastCity;
  while(cur != -1) {
    tour.push_back(cur);
    int p = parent[mask][cur];
    mask ^= (1 << cur);
    cur = p;
  }

  // Put city 0 at both ends of the tour
  reverse(tour.begin(), tour.end());
  tour.push_back(0);

  // Print the cost and tour
  cout << "Longest  tour: ";
  for(int i = 0; i < tour.size(); i++) 
    cout << tour[i] << (i != tour.size() - 1 ? " -> " : " ");
  cout << "at " << maxCost << " units\n";
}

int main(void) {
  vector<vector<ull>> dist = {
    { 0,  2, 15, 10},
    { 2,  0,  7,  4},
    {15,  7,  0, 12},
    {10,  4, 12,  0}
  };

  heldKarpMax(dist);
}

The result in the terminal is

Longest  tour: 0 -> 3 -> 2 -> 0 at 37 units

when it should be

Longest  tour: 0 -> 3 -> 1 -> 2 -> 0 at 36 units

Strangely, these adjacency matrices:

vector<vector<ull>> dist = {
  { 0,  2, 15, 10, 19},
  { 2,  0,  7,  4,  8},
  {15,  7,  0, 12,  3},
  {10,  4, 12,  0,  6},
  {19,  8,  3,  6,  0}
};

and

vector<vector<ull>> dist = {
  { 0,  1,  2,  3},
  { 1,  0,  1,  2},
  { 2,  1,  0,  1},
  { 3,  2,  1,  0}
 };

give the correct result:

Longest  tour: 0 -> 4 -> 1 -> 3 -> 2 -> 0 at 58 units

and

Longest  tour: 0 -> 3 -> 1 -> 2 -> 0 at 8 units

respectively, so the algorithm only works for some adjacency matrices. I know the results are correct, since I hand-checked them.

u/Aphrontic_Alchemist — 20 days ago

[WP] In this godforsaken country, being neither grandiose nor extravagant is a sin worse than treachery. Now that everything is fucked, why not engage in the most grandiose, most extravagant act? Even those fools at the top will thank you for your "service".

reddit.com
u/Aphrontic_Alchemist — 29 days ago

[WP] A wizard from a fantasy world is transported to a weird version of the modern world where secret service and similar agencies save female world leaders or 1st ladies that luxury airplanes trapped in penthouses of high-rises.

reddit.com
u/Aphrontic_Alchemist — 2 months ago

[WP] The palace chef is the unwilling target of all the verbal venting in the palace. They heard everything from the king's ruinous "gossip" to a loose-lip's betrayal plans. As a rule, they only listen, and not engage. Everyone who confided with the chef tacitly agrees to pry no secrets from them.

reddit.com
u/Aphrontic_Alchemist — 3 months ago

[WP] In a world with many magic systems, you're a comparative magic researcher. You find out that all magic systems come from the same source. Despite being so disparate, you managed to reconstruct the primordial magic system.

reddit.com
u/Aphrontic_Alchemist — 3 months ago

[WP] The government sponsors all superhero and supervillain activities as public entertainment. The government also insures all collateral, from property damage to even death. All bills are paid with the government's money. Taxes unusually stayed level even with this level of expenditure.

reddit.com
u/Aphrontic_Alchemist — 3 months ago

[WP] None told the newbie goddess that the powers that exceptional people, e.g. superheroes, wizards, etc., already have aren't compatible with the power system of the world she governs.

reddit.com
u/Aphrontic_Alchemist — 3 months ago

[WP] You're a space explorer and landed on a habitable planet and self-sufficient settlement. The next planetary day, native sapients built an what seems to be village with your settlement as the center.

reddit.com
u/Aphrontic_Alchemist — 3 months ago

[WP] The relationship between gods and their worshippers aren't as tilted to the gods' favor as it 1st seems. Balancing the odds only takes the faith of thousands of those with strong faith... or of billions of those with weak faith.

reddit.com
u/Aphrontic_Alchemist — 3 months ago