I am attempting to solve a p-median problem for a given dataset. I can successfully produce a list of optimal candidate sites. However, I am interested in a secondary list of optimal candidate sites which do not include any of the sites selected in the original solution.
For example, if
p = 5 and the list of optimal sites includes
1,2,3,4,5 how can create a new list without sites
I am familiar with the force = option but when I use a phrase like
force =! I receive an error. Also if I use
force = !1, for example, the
! is ignored and
1 remains part of the solution.
Example: R Code:
solution.5 <- allocations(en.county, p=5) unique(solution.5$allocation) unique(solution.5$allocdist) col.index <- match(solution.5$allocation,unique(solution.5$allocation)) col.alloc <- brewer.pal(5,'Accent')[col.index] plot(solution.5,col=col.alloc) points(coordinates(solution.5[c(18, 49, 288, 245, 159),]),col=2) solution.5.2 <- allocations(en.county, p=5, force = !c(18,49,288,245,159)) unique(solution.5.2$allocation)