Given n sets of points in the plane find the shortest path which passes from exactly one point from each set

I am trying to find an algorithm for this. You can imagine each set (S1, S2, …, Sn) as points with different colour. Also it isn’t necessarily |S1|=|S2|=…=|Sn|.

For n=1 the problem is simplified into a “Closest Pair” problem, which can be solved with divide and conquer in O(nlogn).

For n=1 we trivially have a single (random) point.

For n=2 we have two sets of points S, Q and we seek to find the (distance of the) closest pair of points p, q such as p in S and q in Q. I have also found an efficient algorithm for this, using voronoi diagrams (https://stackoverflow.com/a/13000634/6625377)

For n>2 things get tricky. I have no clue where should I head to. Let’s say we have x red, y green and z blue points laid down in a Euclidian plane. How do we find the minimum distance of a route passing for one red, one green and one blue point?

Is this some special case of the Traveling Purchaser Problem?

Can I craft a link that sets up “Alert Me” options?

I know how to create a link to the “Alert Me” feature of a library (opens dialog box just like if the user clicked “Set alert on this library” in the Library tab of the Ribbon. Is there a way to craft that link to change some of the default options? Specifically I’d like the alert to trigger on “Someone changes an item that appears in the following view:” with a specific view selected. It would also be nice to customize the Alert Title and perhaps specify the Change Type.

My environment is currently using SharePoint 2013. I do not have access to SharePoint Designer. I have site owner permissions for the sub-site hosting the library.

What sets the bdeleted field to 1 in the dbo.UserProfile_Full table? Is it the UPA sync timer job

I have deleted a user from AD, i want their user profile and mysite removed. I understand that is the role of the My Site Clean Up timer job. Although it seems the bdeleted field is never changed to 1. When i manually change bdeleted=1 and manually run the My Site Clean Up timer job it works and the user profile and mysite is removed.

Sharepoint Item Workflow always sets Modified By to the Item Creator?

I have a custom list with a SP Designer 2013 workflow on it – the flow emails individuals in list fields whenever the list item is changed by anyone. The flow works fine, but the list item is displaying odd behaviour.

No matter who edits an appended multiple text field in the Item, the workflow creates another version of the item and changes the author of the last change to the item creator… even though the time stamps are correct, the Last Modified person is always the Creator! Even though the creator didn’t do the edit.

Is this something that Workflow is doing, can anyone advise where I might have gone wrong?

Native iOS icon sets

I’ve always found designing natively for iOS tricky – Google seems to just have everything there for you to look through and design exactly the same.

Whereas the Apple Human Interface Guidelines still seem to add confusion for me and I end up with more questions that I originally started with!

Take Googles Material Icons page for instance – is there anything similar at all for iOS?

Creating many big sets of small numbers

There are $ n$ numbers $ a_1,\ldots,a_n\in [0,1]$ .

Their sum is $ \sum_{i=1}^n a_i = s$ , where $ s$ is some integer.

We want to group them into sets so that the sum of each set is at least $ t$ , where $ t$ is some integer.

Let $ F(n,s,t)$ be the largest number of sets that we can always create (for any $ a_i$ ).

What is $ F(n,s,t)$ ?

Example. $ F(n=8,s=7,t=1)=4$ :

  • Proof that $ F(8,7,1)\geq 4$ : We can always create 4 sets by dividing the $ 8$ numbers arbitrarily into $ 4$ pairs. The sum of each pair is at most $ 2$ , and the sum of all pairs is $ 7$ , so the sum of each pair is at least $ 1$ .
  • Proof that $ F(8,7,1)\leq 4$ : We cannot always create 5 sets. Suppose for all $ i$ , $ a_i=7/8$ . In any $ 5$ sets, at least one set is a singleton so its sum is less than $ 1$ .

Similarly, whenever $ n$ is even, $ F(n,n-1,1)=n/2$ .

What else is known on the function $ F$ ?

Currently I am particularly interested in the case $ t=2$ , but I will be happy for any more general references.

UPPER BOUND: $ F(n,s,t)\leq \lfloor {s+1\over t+1}\rfloor$ . Proof. Suppose that $ s+1$ numbers equal $ s/(s+1)$ and the other $ n-s-1$ numbers equal $ 0$ . To create a set with sum at least $ t$ , we need $ t+1$ nonzeros. So we can create at most $ \lfloor {s+1\over t+1}\rfloor$ such sets.

Count the number of ways numbers 1,2,…,n can be divided into two sets of equal sum


count the number of ways numbers 1,2,…,n can be divided into two sets of equal sum.

This is my recursive algorithm, what is wrong here?:

int f(int sum,int i){//sum is the current sum, i is the current indx (<=n)     if(i>n){         return ((2*sum)==(n*(n+1)/2));//ie sum==totalsum/2     }     int cnt=f(sum,i+1)+f(sum+i,i+1);//move to i+1 or add i to sum and then move to i+1     return cnt; } 
For example, if n=7, there are four solutions: {1,3,4,6} and {2,5,7} {1,2,5,6} and {3,4,7} {1,2,4,7} and {3,5,6} {1,6,7} and {2,3,4,5} ie f(0,1)=7 

Answer is f(0,1) for any n (n is globally defined)

Thanks!

For a collection $S$ of weighted sets $S_i$, find those $k$ elements that maximise the sum of weights of all sets $S_i$ covered by them

I have a collection $ S$ of sets $ S_i$ . Each $ S_i$ has a weight given by how many times this set was observed in some data. I now want to find the $ k$ elements that maximize the cumulative weight of all sets that can be covered by those elements (that is, those sets that contain only elements from those $ k$ selected).

As an example, let $ S$ consist of the following sets and corresponding weights: $ $ \{1\} = 20 \ \{2\} = 10 \ \{3\} = 5 \ \{1,2\} = 10 \ \{2,3\} = 40 \ \{1,3\} = 5 \ \{1,2,3\} = 5\ $ $

In this case, I want my solution for $ k = 2$ to be $ \{2,3\}$ , as $ \{1,2\}$ has a cumulative weight of $ 20+10+10=40$ , $ \{1,3\}$ has a cumulative weight of $ 20+5+5=30$ and $ \{2,3\}$ has a cumulative weight of $ 10+5+40=55$ .

I have the feeling that my problem resembles a maximum coverage problem, but with a limit on the elements, not the sets, and with the sets having weights instead of the elements.