Reputation: 28012
Lets say I have a reference node R and several test nodes T1, T2.... Tn. Any particular node has a set of properties Rp1, Rp2, ... Rpn and T1p1, T1p2, T1p3, ... T1pn, and T2p1, T2p2, T2p3, ... T2pn, and so on. So, any node can have n properties, each of a particular type.
I have my own method of defining the distance between any two properties of the same kind between any two nodes. Furthermore, I would weigh the distances between properties and then sum them up. Thus, the distance between R and T1 would be:
dRT1 = w1*dRT1p1 + w2*dRT1p2 + w3*dRT1p3 + w4*dRT1p4 + ... wn*dRT1pn.
Now, given the reference node R, and the test nodes T1, T2 .... Tn, and given that I know the distance is the least between R and a particular node Tm (1<m<n), and if the weights are actually variables and the distances are actually constants, how do I calculate the weights such that dRTm is the minimal among all the distances between R and every other test nodes.
We have the distances dRT1, dRT2, dRT3, dRT4, ... dRTn and we know that dRTm is minimum. What algorithm should we use to determine the weights?
Upvotes: 1
Views: 172
Reputation: 25522
It seems what you want to do is to set the weights so that a particular distance (dRTm) gets a lower numerical value than any other distance, i.e. set the weights so that the inequalities
dRTm <= dRT1
...
dRTm <= dRTn
are all fulfilled. Setting all the weights to zero as mentioned in one of the comments is a trivial solution because all distances will be identically zero and all the inequalities trivially fulfilled (with equality replacing inequality) so it makes more sense to consider the stronger problem
dRTm < dRT1
...
dRTm < dRT(m-1)
dRTm < dRT(m+1)
...
dRTm < dRTn
In any case, this a simple linear programming problem. Put in the above constraints and then minimize
min : dRTm
It is linear because the calculated individual distances are constants at the time of solving for minimum dRTm. You can solve this with any linear programming package, or if you want to cook up a slow but easy to implement solution by yourself, e.g. with Fourier-Motzkin elimination. Simplex would be the actual method of choice, however.
Upvotes: 1
Reputation: 19601
This looks like http://en.wikipedia.org/wiki/Linear_regression, where after the article says "Thus the model takes the form" y is dRt1, the x variables are e.g. dRT1p1, and the beta variables they are trying to work out - their parameter vector - is your w1, w2...
Upvotes: 0