Skip to content

Commit

Permalink
fixed up spurious document build
Browse files Browse the repository at this point in the history
  • Loading branch information
njtierney committed Jul 5, 2018
1 parent 3440852 commit d5f8051
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 24 deletions.
2 changes: 1 addition & 1 deletion R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ distance_matrix_cpp <- function(facility, user) {
#' you are interested in. If a number is less than distance_cutoff, it will be
#' 1, if it is greater than it, it will be 0.
#'
#' @return a logical matrix 1 if distance between element[i,j] is less than or
#' @return a logical matrix 1 if distance between element i, j is less than or
#' equal to the distance_cutoff, and 0 otherwise
#'
#' @export
Expand Down
6 changes: 3 additions & 3 deletions R/extract_mc_result.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

extract_mc_results <- function(x){

# find the facilities selected ------------------------------------------------
# find the facilities selected ================================================

mc_facilities_selected <- extract_facility_selected(
solution_vector = x$lp_solution$solution,
A_mat = x$A,
proposed_facilities = x$proposed_facility)

# user_affected ---------------------------------------------------------------
# user_affected ==============================================================

mc_users_affected <- extract_users_affected(
A_mat = x$A,
Expand Down Expand Up @@ -90,7 +90,7 @@ extract_mc_results <- function(x){
}

#
# # extract results ---------------------------------------------------------
# # extract results =======================================================
#
# # get the dimenions from the matrix
# J <- nrow(x$A)
Expand Down
2 changes: 1 addition & 1 deletion R/extract_mc_result_relocation.R
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ extract_mc_results_relocation <- function(x){
# # n_existing_removed
# # which_existing_removed
#
# # back to old summary method ---------------------------------------------------
# # back to old summary method =============================================
#
# # ... surprisingly (!) this works with very few changes good job, past nick!
#
Expand Down
4 changes: 2 additions & 2 deletions R/facility_user_dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ facility_user_dist <- function(facility,
coverage_distance = 100,
nearest = "facility"){

# check that lat and long are specified -----------------------------------
# check that lat and long are specified
# if(
# (c("lat") %in% names(facility) == TRUE) |
# (c("long") %in% names(facility) == TRUE) |
Expand All @@ -45,7 +45,7 @@ facility_user_dist <- function(facility,
# warning("make sure lat and long are in the names")
# }

# dodgy method to get the cross product ---------------------------------------
# dodgy method to get the cross product

# do a dodgy cross product by adding a column of 1
# and then joining on this column
Expand Down
2 changes: 1 addition & 1 deletion R/max_cov_relocation.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ c <- c(rep(0, Ny), rep(1,Nx))
# this is a line to optimise with cpp
Ain <- cbind(-A, diag(Nx))

# create the m vector ----------------------------------------------------------
# create the m vector =========================================================

# this is the vector of costs, which will have the length
# of the number of rows of y plus the number of x's as 0s
Expand Down
16 changes: 8 additions & 8 deletions R/maxcovr-refactor-vectors.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ max_coverage_vec <- function(existing_facility = NULL,
# constraint_dir
# rhs

# create objective -------------------------------------------------------------
# create objective =============================================================
# this should be made into a function that would perform different
# functions based on whether relocation == TRUE

Expand Down Expand Up @@ -121,12 +121,12 @@ c <- c(rep(0, Ny), rep(1,Nx))
# Ny
# c (objective_in)

# perform extra functions for data munging -------------------------------------
# perform extra functions for data munging ===================================
facility_id_list <- 1:nrow(proposed_facility)
colnames(A) <- facility_id_list
user_id_list <- 1:nrow(user_not_covered)

# create constraint matrix -----------------------------------------------------
# create constraint matrix ====================================================
# this should be made into a function that would perform different
# functions based on whether relocation == TRUE
# create_constraint_matrix(..., relocation){
Expand All @@ -143,7 +143,7 @@ constraint_matrix <- rbind(
c(rep(1, Ny), rep(0,Nx))
)

# create constraint directions -------------------------------------------------
# create constraint directions ================================================

# lpSolve: const.dir
# glpk: dir
Expand All @@ -164,7 +164,7 @@ constraint_directions <- c(rep("<=", Nx), "==")

} # end else

# create right hand side matrix ------------------------------------------------
# create right hand side matrix ===============================================

# bin <- matrix(rep(0,Nx), ncol = 1)
# rhs_matrix <- rbind(bin, beq)
Expand All @@ -180,7 +180,7 @@ rhs_matrix <- purrr::map(
)
)

# solve the model --------------------------------------------------------------
# solve the model =============================================================

# at this point, all of the model outputs, independent of being relocation or
# not, are ready for the analysis.
Expand Down Expand Up @@ -301,7 +301,7 @@ x <- list(
# model_call = model_call
)

# extract the model results ----------------------------------------------------
# extract the model results ===================================================

# this is a place where I'll need to generalise it into separate function for
# relocation and fixed methods.
Expand Down Expand Up @@ -440,7 +440,7 @@ return(res)



# return the model -------------------------------------------------------------
# return the model ===========================================================

# model_result <- extract_mc_results_2(x)

Expand Down
2 changes: 1 addition & 1 deletion man/binary_matrix_cpp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/distanceHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ return dist_mat;
//' you are interested in. If a number is less than distance_cutoff, it will be
//' 1, if it is greater than it, it will be 0.
//'
//' @return a logical matrix 1 if distance between element[i,j] is less than or
//' @return a logical matrix 1 if distance between element i, j is less than or
//' equal to the distance_cutoff, and 0 otherwise
//'
//' @export
Expand Down
6 changes: 1 addition & 5 deletions tests/testthat/test_distance_matrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ my_dist_cpp <- distance_matrix_cpp(facility_test_cpp, user_test_cpp)

# my_dist_cpp[1:5,1:5]

# compare this to the dplyr method ---------------------------------------------
# compare this to the dplyr method ============================================

# maxcovr::facility_user_dist(facility = york,
# user = york_crime,
Expand Down Expand Up @@ -65,10 +65,6 @@ my_dist_dplyr <- user %>%
select(-user_id) %>%
as.matrix()

# my_dist_dplyr[1:5,1:5]

# my_dist_dplyr <-
# -----------------

testthat::test_that("cpp distance matrix produces same numeric result as using dplyr method",{
# I still need to make a method that gives the big matrix names
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_nearest_distance.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ near_cpp <- nearest_facility_dist(facility = facility_test_cpp,
# coverage_distance = 100)


# begin old dplyr way ---------------------------------------------------------
# begin old dplyr way =========================================================

facility <- dplyr::mutate(york, key = 1) %>%
dplyr::rename(lat_facility = lat,
Expand Down

0 comments on commit d5f8051

Please sign in to comment.