diff --git a/NAMESPACE b/NAMESPACE index 22290a3..4fab61f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,18 +1,12 @@ # Generated by roxygen2: do not edit by hand export(benders) -export(clean_output_benders) export(delete_antares_output) -export(enable_hurdle_costs) -export(filter_output_areas) -export(filter_output_links) export(get_whole_simulation_name) export(read_candidates) export(read_options) export(report) export(run_simulation) -export(set_simulation_period) -export(update_link) import(data.table) importFrom(antaresEditObject,getPlaylist) importFrom(antaresEditObject,setPlaylist) diff --git a/R/benders_tools.R b/R/benders_tools.R index ccac71b..2cc3911 100644 --- a/R/benders_tools.R +++ b/R/benders_tools.R @@ -16,6 +16,7 @@ #' @importFrom assertthat assert_that #' @importFrom antaresRead simOptions getLinks getAreas #' @importFrom antaresEditObject updateGeneralSettings updateOptimizationSettings +#' @noRd #' set_antares_options <- function(benders_options, candidates, opts = antaresRead::simOptions()) { diff --git a/R/check.R b/R/check.R index 73d8a29..b252fc9 100644 --- a/R/check.R +++ b/R/check.R @@ -13,7 +13,7 @@ #' #' @importFrom antaresRead simOptions readClusterDesc #' @importFrom dplyr filter -#' +#' @noRd #' benders_check <- function(candidates, opts = antaresRead::simOptions()) { diff --git a/R/clean.R b/R/clean.R index d5630af..b4a9bc6 100644 --- a/R/clean.R +++ b/R/clean.R @@ -44,7 +44,7 @@ delete_antares_output <- function(simulation_name, opts = antaresRead::simOption #' #' @importFrom antaresRead simOptions #' @importFrom assertthat assert_that -#' @export +#' @noRd #' clean_output_benders <- function(best_solution, unique_key, opts = antaresRead::simOptions()) { diff --git a/R/link.r b/R/link.r index cc5ca61..deb3610 100644 --- a/R/link.r +++ b/R/link.r @@ -6,7 +6,7 @@ #' Name of one link #' @return #' name of the first area that the link connects -#' +#' @noRd #' from <- function(link_name) { @@ -21,7 +21,7 @@ from <- function(link_name) #' Name of one link #' @return #' name of the second area that the link connects -#' +#' @noRd #' to <- function(link_name) { @@ -48,7 +48,7 @@ to <- function(link_name) #' #' @importFrom assertthat assert_that #' @importFrom antaresRead simOptions -#' @export +#' @noRd #' #' @@ -137,7 +137,7 @@ enable_hurdle_costs <- function(link_names, enable = TRUE, opts = antaresRead::s #' @importFrom assertthat assert_that #' @importFrom antaresRead simOptions #' @importFrom utils write.table -#' @export +#' @noRd #' #' update_link <- function(link_name, property_name, new_value, opts = antaresRead::simOptions()) diff --git a/R/master.R b/R/master.R index a34bc81..88c5887 100644 --- a/R/master.R +++ b/R/master.R @@ -20,6 +20,7 @@ #' @importFrom antaresRead simOptions #' @importFrom assertthat assert_that #' @importFrom antaresEditObject getPlaylist +#' @noRd #' initiate_master <- function(candidates, exp_options , opts = antaresRead::simOptions()) { @@ -126,6 +127,7 @@ initiate_master <- function(candidates, exp_options , opts = antaresRead::simOpt #' #' @importFrom antaresRead simOptions #' @importFrom assertthat assert_that +#' @noRd #' solve_master <- function(opts = antaresRead::simOptions(), relax_integrality = FALSE, ampl_path = NULL) { diff --git a/R/patch_numeric_accuracy.R b/R/patch_numeric_accuracy.R deleted file mode 100644 index e08c0b3..0000000 --- a/R/patch_numeric_accuracy.R +++ /dev/null @@ -1,32 +0,0 @@ -#' This function update the bender cuts so as to deal with the numeric -#' inaccuracy of the ANTARES output -#' Not used since v0.3 -#' -#' Marginal costs are returned in ANTARES with a 10^0 accuracy (without any decimal). -#' This can cause numeric imprecisions in the cut of the benders decomposition and -#' make it converge to a non-optimal solution. -#' -#' This function (tries to) corrects this by updating the constant term of the cuts -#' -#' @param x_current -#' vector of current invested capacities -#' @param x_max -#' vector of maximum possible investments -#' @return -#' Return correct term to substract to the b of \code{ax+b} -#' -#' -#' -numeric_patch_cut <- function(x_current, x_max) -{ - # a few checks - assert_that(length(x_current) == length(x_max)) - - # compute max distance between current point (x_current) and boundary of the investment space - each_max <- function(i,vec1, vec2){max(vec2[i] - vec1[i], vec1[i])} - d_max <- norm(sapply(1:length(x_current), FUN = each_max, vec1 = x_current, vec2 = x_max), type = "2") - - # as error can be up to +/- 0.5 - return (d_max * 0.5 + 1) -} - diff --git a/R/read_candidates.R b/R/read_candidates.R index 462a098..bcf90d4 100644 --- a/R/read_candidates.R +++ b/R/read_candidates.R @@ -196,7 +196,7 @@ read_candidates <- function(file, opts = antaresRead::simOptions()) #' #' @return #' Returns a vector of link name -#' +#' @noRd #' with_profile <- function(candidates) { @@ -218,7 +218,7 @@ with_profile <- function(candidates) #' #' @return #' Returns a vector of link name -#' +#' @noRd #' without_profile <- function(candidates) { diff --git a/R/report.R b/R/report.R index 93cc0d0..6dfc3d6 100644 --- a/R/report.R +++ b/R/report.R @@ -53,6 +53,7 @@ report <- function(benders_out = "last", file = default_report_file(opts), opts #' #' @importFrom antaresRead simOptions #' @importFrom lubridate now +#' @noRd #' default_report_file <- function(opts = antaresRead::simOptions()) { diff --git a/R/simulation_settings.R b/R/simulation_settings.R index 29f9700..272c507 100644 --- a/R/simulation_settings.R +++ b/R/simulation_settings.R @@ -22,7 +22,7 @@ #' #' @importFrom assertthat assert_that #' @importFrom antaresRead simOptions -#' @export +#' @noRd #' #' filter_output_areas <- function(areas, filter, type, opts = antaresRead::simOptions()) @@ -91,7 +91,7 @@ filter_output_areas <- function(areas, filter, type, opts = antaresRead::simOpti #' #' @importFrom assertthat assert_that #' @importFrom antaresRead simOptions -#' @export +#' @noRd #' #' filter_output_links <- function(links, filter, type, opts = antaresRead::simOptions()) @@ -158,7 +158,7 @@ filter_output_links <- function(links, filter, type, opts = antaresRead::simOpti #' @importFrom antaresRead simOptions #' @importFrom data.table first last #' @importFrom antaresEditObject updateGeneralSettings -#' @export +#' @noRd #' set_simulation_period <- function(weeks, opts = antaresRead::simOptions()) { diff --git a/man/benders_check.Rd b/man/benders_check.Rd deleted file mode 100644 index 521836d..0000000 --- a/man/benders_check.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/check.R -\name{benders_check} -\alias{benders_check} -\title{Check that the ANTARES study is ready for benders decomposition} -\usage{ -benders_check(candidates, opts = antaresRead::simOptions()) -} -\arguments{ -\item{candidates}{list of investment candidates, as returned by -\code{\link{read_candidates}}} - -\item{opts}{list of simulation parameters returned by the function -\code{antaresRead::setSimulationPath}} -} -\value{ -boolean, indicating whether or not the test are fullfilled -} -\description{ -Check that the ANTARES study is ready for benders decomposition -} diff --git a/man/clean_output_benders.Rd b/man/clean_output_benders.Rd deleted file mode 100644 index c54439a..0000000 --- a/man/clean_output_benders.Rd +++ /dev/null @@ -1,24 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/clean.R -\name{clean_output_benders} -\alias{clean_output_benders} -\title{Delete the output of the benders iterations which are not usefull anymore} -\usage{ -clean_output_benders(best_solution, unique_key, - opts = antaresRead::simOptions()) -} -\arguments{ -\item{best_solution}{identifier of the best solution so far -(the output related to this iteration will not be removed)} - -\item{unique_key}{unique string to identify the output of the current expansion problem} - -\item{opts}{list of simulation parameters returned by the function -\code{antaresRead::setSimulationPath}} -} -\value{ - -} -\description{ -Delete the output of the benders iterations which are not usefull anymore -} diff --git a/man/default_report_file.Rd b/man/default_report_file.Rd deleted file mode 100644 index 830b75f..0000000 --- a/man/default_report_file.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/report.R -\name{default_report_file} -\alias{default_report_file} -\title{Return the default file name for the report} -\usage{ -default_report_file(opts = antaresRead::simOptions()) -} -\arguments{ -\item{opts}{list of simulation parameters returned by the function -\code{antaresRead::setSimulationPath}} -} -\value{ -name of the first area that the link connects -} -\description{ -Return the default file name for the report -} diff --git a/man/enable_hurdle_costs.Rd b/man/enable_hurdle_costs.Rd deleted file mode 100644 index cabdf66..0000000 --- a/man/enable_hurdle_costs.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/link.r -\name{enable_hurdle_costs} -\alias{enable_hurdle_costs} -\title{Enable or disable the hurdle cost of a link or a list of links} -\usage{ -enable_hurdle_costs(link_names, enable = TRUE, - opts = antaresRead::simOptions()) -} -\arguments{ -\item{link_names}{Name of one link, or vector with several link names} - -\item{enable}{Should the hurdle costs be enabled (\code{TRUE}) or disabled (\code{FALSE}) ?} - -\item{opts}{list of simulation parameters returned by the function -\code{antaresRead::setSimulationPath}} -} -\value{ -The function does not return anything. It is used to modify the input of an -ANTARES study -} -\description{ -\code{enable_hurdle_costs} is a function which modifies the input file of an ANTARES -study and enable (or disable) the hurdle costs of a link -} diff --git a/man/filter_output_areas.Rd b/man/filter_output_areas.Rd deleted file mode 100644 index ff2ca26..0000000 --- a/man/filter_output_areas.Rd +++ /dev/null @@ -1,29 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/simulation_settings.R -\name{filter_output_areas} -\alias{filter_output_areas} -\title{Modify the filters on the output of the areas} -\usage{ -filter_output_areas(areas, filter, type, opts = antaresRead::simOptions()) -} -\arguments{ -\item{areas}{Area, or vector of areas whose filter will be changed.} - -\item{filter}{Vector of filters to adopt for the area. Can contain "annual", "monthly", "weekly", -"daily", "hourly" or a combination of them.} - -\item{type}{On which type of output the filters will applied ? The MC synthesis (\code{type = "synthesis"}) ? The -year by year outputs (\code{type = "year-by-year"}) ? Or both(\code{type = c("synthesis", "year-by-year")}) -?} - -\item{opts}{list of simulation parameters returned by the function -\code{antaresRead::setSimulationPath}} -} -\value{ -The function does not return anything. It is used to modify the input of an -ANTARES study -} -\description{ -\code{filter_output_areas} is a function which modifies the input file of an ANTARES -study by updating the output filters of some areas -} diff --git a/man/filter_output_links.Rd b/man/filter_output_links.Rd deleted file mode 100644 index 3d8ee52..0000000 --- a/man/filter_output_links.Rd +++ /dev/null @@ -1,29 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/simulation_settings.R -\name{filter_output_links} -\alias{filter_output_links} -\title{Modify the filters on the output of the links} -\usage{ -filter_output_links(links, filter, type, opts = antaresRead::simOptions()) -} -\arguments{ -\item{links}{Link, or vector of links whose filter will be changed.} - -\item{filter}{Vector of filters to adopt for the area. Can contain "annual", "monthly", "weekly", -"daily", "hourly" or a combination of them.} - -\item{type}{On which type of output the filters will applied ? The MC synthesis (\code{type = "synthesis"}) ? The -year by year outputs (\code{type = "year-by-year"}) ? Or both(\code{type = c("synthesis", "year-by-year")}) -?} - -\item{opts}{list of simulation parameters returned by the function -\code{antaresRead::setSimulationPath}} -} -\value{ -The function does not return anything. It is used to modify the input of an -ANTARES study -} -\description{ -\code{filter_output_links} is a function which modifies the input file of an ANTARES -study by updating the output filters of some links -} diff --git a/man/from.Rd b/man/from.Rd deleted file mode 100644 index 4a54493..0000000 --- a/man/from.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/link.r -\name{from} -\alias{from} -\title{Return the first area that a link connects} -\usage{ -from(link_name) -} -\arguments{ -\item{link_name}{Name of one link} -} -\value{ -name of the first area that the link connects -} -\description{ -Return the first area that a link connects -} diff --git a/man/initiate_master.Rd b/man/initiate_master.Rd deleted file mode 100644 index 9676ba9..0000000 --- a/man/initiate_master.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/master.R -\name{initiate_master} -\alias{initiate_master} -\title{Initiate master problem} -\usage{ -initiate_master(candidates, exp_options, opts = antaresRead::simOptions()) -} -\arguments{ -\item{candidates}{list of investment candidates, as returned by -\code{\link{read_candidates}}} - -\item{exp_options}{list of options related to the expansion planning, as returned -by the function \code{\link{read_options}}} - -\item{opts}{list of simulation parameters returned by the function -\code{antaresRead::setSimulationPath}} -} -\value{ -This function does not return anything. -} -\description{ -\code{initiate_master} copy the AMPL files into the temporary -folder of the expansion planning optimisation and create the other input -and output file of the master problem -} diff --git a/man/numeric_patch_cut.Rd b/man/numeric_patch_cut.Rd deleted file mode 100644 index 24ecb5a..0000000 --- a/man/numeric_patch_cut.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/patch_numeric_accuracy.R -\name{numeric_patch_cut} -\alias{numeric_patch_cut} -\title{This function update the bender cuts so as to deal with the numeric -inaccuracy of the ANTARES output -Not used since v0.3} -\usage{ -numeric_patch_cut(x_current, x_max) -} -\arguments{ -\item{x_current}{vector of current invested capacities} - -\item{x_max}{vector of maximum possible investments} -} -\value{ -Return correct term to substract to the b of \code{ax+b} -} -\description{ -Marginal costs are returned in ANTARES with a 10^0 accuracy (without any decimal). -This can cause numeric imprecisions in the cut of the benders decomposition and -make it converge to a non-optimal solution. -} -\details{ -This function (tries to) corrects this by updating the constant term of the cuts -} diff --git a/man/set_antares_options.Rd b/man/set_antares_options.Rd deleted file mode 100644 index b9d13f9..0000000 --- a/man/set_antares_options.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/benders_tools.R -\name{set_antares_options} -\alias{set_antares_options} -\title{Set ANTARES study options related to the current benders decomposition} -\usage{ -set_antares_options(benders_options, candidates, - opts = antaresRead::simOptions()) -} -\arguments{ -\item{benders_options}{list of benders decomposition options, as returned by -\code{\link{read_options}}.} - -\item{candidates}{list of investment candidates, as returned by -\code{\link{read_candidates}}} - -\item{opts}{list of simulation parameters returned by the function -\code{antaresRead::setSimulationPath}} -} -\value{ -nothing -} -\description{ -Set ANTARES study options related to the current benders decomposition -} diff --git a/man/set_simulation_period.Rd b/man/set_simulation_period.Rd deleted file mode 100644 index 6b6344d..0000000 --- a/man/set_simulation_period.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/simulation_settings.R -\name{set_simulation_period} -\alias{set_simulation_period} -\title{Set period on which we want the ANTARES simulation to run. -Update "first day" and "last day" parameters of the ANTARES study.} -\usage{ -set_simulation_period(weeks, opts = antaresRead::simOptions()) -} -\arguments{ -\item{weeks}{vector of weeks identiers which should be simulated} - -\item{opts}{list of simulation parameters returned by the function -\code{antaresRead::setSimulationPath}} -} -\value{ - -} -\description{ -Set period on which we want the ANTARES simulation to run. -Update "first day" and "last day" parameters of the ANTARES study. -} diff --git a/man/solve_master.Rd b/man/solve_master.Rd deleted file mode 100644 index 14fd5ca..0000000 --- a/man/solve_master.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/master.R -\name{solve_master} -\alias{solve_master} -\title{Solver master problem} -\usage{ -solve_master(opts = antaresRead::simOptions(), relax_integrality = FALSE, - ampl_path = NULL) -} -\arguments{ -\item{opts}{list of simulation parameters returned by the function -\code{antaresRead::setSimulationPath}} - -\item{relax_integrality}{logical, indicating whether (TRUE) or not (FALSE) the integer variables -should be relaxed} - -\item{ampl_path}{Character containing the path to the ampl.exe file} -} -\value{ -This function does not return anything. -} -\description{ -\code{solver_master} execute the AMPL file master_run.ampl -located in the temporary folder of the current expansion -planning optimisation -} diff --git a/man/to.Rd b/man/to.Rd deleted file mode 100644 index aa5041d..0000000 --- a/man/to.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/link.r -\name{to} -\alias{to} -\title{Return the second area that a link connects} -\usage{ -to(link_name) -} -\arguments{ -\item{link_name}{Name of one link} -} -\value{ -name of the second area that the link connects -} -\description{ -Return the second area that a link connects -} diff --git a/man/update_link.Rd b/man/update_link.Rd deleted file mode 100644 index c4b0987..0000000 --- a/man/update_link.Rd +++ /dev/null @@ -1,28 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/link.r -\name{update_link} -\alias{update_link} -\title{Update the properties of a link (capacity, impedance or hurdle costs)} -\usage{ -update_link(link_name, property_name, new_value, - opts = antaresRead::simOptions()) -} -\arguments{ -\item{link_name}{Name of one link} - -\item{property_name}{Name of the propery to change, must be equal to "direct_capacity" or "indirect_capacity" or -"impedance" or "direct_hurdle_cost" or "indirect_hurdle_cost"} - -\item{new_value}{New value of the property} - -\item{opts}{list of simulation parameters returned by the function -\code{antaresRead::setSimulationPath}} -} -\value{ -The function does not return anything. It is used to modify the input of an -ANTARES study -} -\description{ -\code{update_link} is a function which modifies the input file of an ANTARES -study and update the properties of a link -} diff --git a/man/with_profile.Rd b/man/with_profile.Rd deleted file mode 100644 index ebe362e..0000000 --- a/man/with_profile.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/read_candidates.R -\name{with_profile} -\alias{with_profile} -\title{Return vector of candidate names which have a link profile} -\usage{ -with_profile(candidates) -} -\arguments{ -\item{candidates}{list of investment candidates, as returned by -\code{\link{read_candidates}}} -} -\value{ -Returns a vector of link name -} -\description{ -Return vector of candidate names which have a link profile -} diff --git a/man/without_profile.Rd b/man/without_profile.Rd deleted file mode 100644 index aa8b7a8..0000000 --- a/man/without_profile.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/read_candidates.R -\name{without_profile} -\alias{without_profile} -\title{Return vector of candidate names which do not have a link profile} -\usage{ -without_profile(candidates) -} -\arguments{ -\item{candidates}{list of investment candidates, as returned by -\code{\link{read_candidates}}} -} -\value{ -Returns a vector of link name -} -\description{ -Return vector of candidate names which do not have a link profile -}