request_object: Requesting an object from the master.

View source: R/request_object.R

request_objectR Documentation

Requesting an object from the master.

Description

Request an object from the master.

Usage

request_object (object_names, verbose_slave=FALSE)

Arguments

object_names

name(s) of object to be requested from master (string array).

verbose_slave

enable diagnostic messages.

Details

This function requests an object (i.e. variable) from the master. Also partial requests like a[3] are possible. This is not necessary for ordinary optimizations! However, it enables the slave to react specifically on the overall conditions of the optimization.
Potentially useful objects are the variables listed and explained in globvars.R (see package source code).

Value

If existing, returns the requested object, otherwise NA. If multiple objects where requested, a named list is returned, which can conveniently be imported into the current environment (see example).

Note

In serial mode (optim_*), this function basically looks up the search tree and the package environment for the requested objects. In parallel mode (optim_p*), mpi-communications are used.

Author(s)

Till Francke

See Also

push_object

Examples


## Not run: 
#objective function with additional master-slave interaction
interact_function = function(parms)
{
  library(ppso)
  X=request_object("X")   #request some object
  print(paste("X:",X))
  flush.console()
  
  print(paste("pushing object..."))
  push_object(list("fitness_gbest"=1000))     #push some object
  flush.console()
  
  print("returning results...")
  return(ackley_function(parms))
}

result = optim_pdds_robust(objective_function=interact_function, projectfile=NULL, logfile=NULL, load_projectfile="no",
                            max_number_function_calls=20, verbose=TRUE, tryCall=TRUE)


## End(Not run)							

TillF/ppso documentation built on March 11, 2024, 1:27 a.m.