rneos/0000755000176200001440000000000015135331705011403 5ustar liggesusersrneos/MD50000644000176200001440000000603115135331705011713 0ustar liggesusersf4b7963894f883c1bcb6dbf3bc1fe6f5 *DESCRIPTION 0189322a3b569f7a75b62044a08d043b *NAMESPACE 8c9c0314b83ddecc248c1946edd9a50b *R/AllClasses.R c2df5a865d8275a6fecee14183a5882d *R/CreateNeosComm.R 3f3b05aa16707cfa15de9e8ebaacfdcd *R/CreateXmlString.R b3648672e39af7cf3531a1d306629a06 *R/NemailHelp.R c51aed6692359fac29bda94d81ce7d17 *R/NgetFinalResults.R 9781c7c13686eb7e4b378e1c4e3e5733 *R/NgetFinalResultsNonBlocking.R caaa4f2bbde9b2857065704bba00b334 *R/NgetIntermediateResults.R 06aa406c23105c981d688cb6d04da946 *R/NgetIntermediateResultsNonBlocking.R eb214fa4fb4414d2d36ad68de1ae2aa2 *R/NgetJobInfo.R 5b3736cf3cf3edd195825f85f3468bb4 *R/NgetJobStatus.R 22db40c87be86b5f78829e8266d58070 *R/NgetSolverTemplate.R a62682a47ca8df96e72f31aa50942876 *R/Nhelp.R 50c3f327bbf1d5de4e0e50a51ad8fe10 *R/NkillJob.R 0c8051661bda92383edc270a3786f146 *R/NlistAllSolvers.R 9ce218c2e1b0c424c916c175479ee49e *R/NlistCategories.R 8e06cfa9293f301ba83364ebba81a1f3 *R/NlistSolversInCategory.R 34112ebebb3e839fb4384ad95a7b6508 *R/Nping.R b3d9516904f251a062a6c9c2096c89f7 *R/NprintQueue.R 00be36f2d45df9c71273ea998bce41b0 *R/NsubmitJob.R ee8b9f56dc07804b36fa58aecab39015 *R/Nversion.R d93fb41b0dd7eb4b810769078a90540e *R/Nwelcome.R 0c889f6fc7b678173301f389e941937f *R/XMLRPC.R 8012c64214ad7e6e948ef4bf0ed6ac20 *R/show-methods.R 84cd3dfac5ac1c5d9d24b917434ff3fd *R/update-methods.R e92f448378d5d31319cd45a541b3920d *inst/ExAMPL/diet.dat 0c5c9af916ddbaa80447e644b907c4dc *inst/ExAMPL/diet.mod 2d5ed772d8f685ca9048147555c90a6c *inst/ExGAMS/TwoStageStochastic.gms a8879d0bb869e88d85035b88db064840 *man/CreateNeosComm.Rd 3e5ab7d4005126b2da2e68831e667e3d *man/CreateXmlString.Rd cfc1a514917fa368115bb9df6945a97b *man/NemailHelp.Rd 7aa989af5f1042e0e15ced02f516c627 *man/NeosAns-class.Rd 5e51c4790f0ec186fbe0644fdf80f263 *man/NeosComm-class.Rd 114ef19b5a68d5abb60495e94935417f *man/NeosJob-class.Rd 6cbb18eef8c7de6e11d2b165595a3a31 *man/NeosOff-class.Rd a29d13427a33275337e558d38b877870 *man/NeosXml-class.Rd eec6647aa6ea120e8e8e66794fd0341b *man/NgetFinalResults.Rd 2ca608dccd7204563a62f8e5f7adf7ce *man/NgetFinalResultsNonBlocking.Rd 5358000b4fc94e54a93a05fcbc42b4b8 *man/NgetIntermediateResults.Rd 4a5dc8a175fa7fddb67c5e0b968cb670 *man/NgetIntermediateResultsNonBlocking.Rd 9270d107957dd481cbbe9a0a84805109 *man/NgetJobInfo.Rd ab8b0864373b3b392c2e93e7cc19e446 *man/NgetJobStatus.Rd 6b713068736dbcaecec8b735c10c80b7 *man/NgetSolverTemplate.Rd 6569149d7f47992561b8f243e231c653 *man/Nhelp.Rd 40d3de2cf708aa09f9a12e5d77af3e1a *man/NkillJob.Rd 51f572f84408ccd59ead88f2d6f0c22b *man/NlistAllSolvers.Rd d24628645bba796db818385302823af1 *man/NlistCategories.Rd d785525f3e9ea4cc58bade7dfce1ecaf *man/NlistServersInCategory.Rd 6223b19bfbaa020e448c9d4780209e02 *man/Nping.Rd e6e9aa249aa2c6ca6b16ce59ee93f88d *man/NprintQueue.Rd 147654c58c7928a6cdf4aeb5440087bf *man/NsubmitJob.Rd ecbac347f02afc4dbc7ef4603f421f67 *man/Nversion.Rd 4a660ce785e1150537c9ee4894bea736 *man/Nwelcome.Rd f7b37e89139bca0cfc512a234ee50178 *man/XMLRPCServer.Rd 9f89a2b2b8f2f1203393b0071f94c538 *man/rpc.serialize.Rd 0e0f61dc811f579f773834bf0e627f74 *man/xml.rpc.Rd rneos/R/0000755000176200001440000000000013650031524011600 5ustar liggesusersrneos/R/NkillJob.R0000644000176200001440000000127315135161227013436 0ustar liggesusers## ## XML-RPC method: killJob() ## NkillJob <- function(obj, killmsg = NULL, convert = TRUE) { if (!inherits(obj, "NeosJob")) { stop("\nObject 'obj' is not of class 'NeosJob'.\n") } call <- match.call() jobnumber <- obj@jobnumber password <- obj@password nc <- obj@nc if (is.null(killmsg)) { killmsg <- "" } else { killmsg <- as.character(killmsg) } ans <- xml.rpc( url = nc@url, method = "killJob", .args = list( jobnumber = jobnumber, password = password, killmsg = killmsg ), .convert = convert, .opts = nc@curlopts, .curl = nc@curlhandle ) res <- new("NeosAns", ans = ans, method = "killJob", call = call, nc = nc) return(res) } rneos/R/NgetIntermediateResults.R0000644000176200001440000000220015135160700016526 0ustar liggesusers## ## XML-RPC method: getIntermediateResults ## NgetIntermediateResults <- function(obj, offset = NULL, convert = TRUE) { if (!inherits(obj, "NeosJob")) { stop("\nObject 'obj' is not of class 'NeosJob'.\n") } call <- match.call() jobnumber <- obj@jobnumber password <- obj@password nc <- obj@nc if (is.null(offset)) { offset <- as.integer(0) } else { offset <- as.integer(offset) } ans <- xml.rpc( url = nc@url, method = "getIntermediateResults", .args = list( jobnumber = jobnumber, password = password, offset = offset ), .convert = FALSE, .opts = nc@curlopts, .curl = nc@curlhandle ) tmp <- xmlToList(xmlRoot(xmlTreeParse(ans))) offset <- as.integer(tmp[2, ]) if (convert) { tmp1 <- tmp[1, ] if (!is.null(tmp1$params)) { tmp1 <- gsub("\\n", "", tmp1) class(tmp1) <- "base64" ans <- base64(tmp1) } else { ans <- "\nNothing left to return from NEOS.\n" } } res <- new("NeosOff", ans = ans, offset = offset, jobnumber = jobnumber, password = password, method = "getIntermediateResults", call = call, nc = nc ) return(res) } rneos/R/NlistCategories.R0000644000176200001440000000105615135161325015027 0ustar liggesusers## ## XML-RPC method: listCategories() ## NlistCategories <- function(convert = TRUE, nc = CreateNeosComm()) { if (!inherits(nc, "NeosComm")) { stop("\nObject provided for 'nc' must be of class 'NeosComm'.\n") } call <- match.call() ans <- xml.rpc( url = nc@url, method = "listCategories", .convert = convert, .opts = nc@curlopts, .curl = nc@curlhandle ) if (convert) { ans <- paste(names(ans), as.character(ans), sep = ": ") } res <- new("NeosAns", ans = ans, method = "listCategories", call = call, nc = nc) return(res) } rneos/R/Nwelcome.R0000644000176200001440000000070115135161636013502 0ustar liggesusers## ## XML-RPC method: welcome() ## Nwelcome <- function(convert = TRUE, nc = CreateNeosComm()) { if (!inherits(nc, "NeosComm")) { stop("\nObject provided for 'nc' must be of class 'NeosComm'.\n") } call <- match.call() ans <- xml.rpc( url = nc@url, method = "welcome", .convert = convert, .opts = nc@curlopts, .curl = nc@curlhandle ) res <- new("NeosAns", ans = ans, method = "welcome", call = call, nc = nc) return(res) } rneos/R/CreateXmlString.R0000644000176200001440000000120315135161766015006 0ustar liggesusers## ## Function: CreateXmlString ## CreateXmlString <- function(neosxml, cdatalist) { if (!inherits(neosxml, "NeosXml")) { stop("\nPlease provide an object of class 'NeosXml' for argument neosxml.\n") } xmlstr <- neosxml@xml lnames <- names(cdatalist) if (!(all(lnames %in% names(xmlstr)))) { stop("\nNamed list object 'cdatalist' does contain entries that are not node names of object 'xmlstr'.\n") } idx <- 1:length(cdatalist) tmp <- removeChildren(xmlstr, kids = lnames) for (i in idx) { tmp <- append.XMLNode(tmp, newXMLNode(lnames[i], cdatalist[[i]], cdata = TRUE)) } ans <- toString(tmp) return(ans) } rneos/R/NlistSolversInCategory.R0000644000176200001440000000154315135161400016357 0ustar liggesusers## ## XML-RPC method: listSolversInCategory() ## NlistSolversInCategory <- function(category, convert = TRUE, nc = CreateNeosComm()) { if (!inherits(nc, "NeosComm")) { stop("\nObject provided for 'nc' must be of class 'NeosComm'.\n") } category <- as.character(category) cats <- NlistCategories(nc = nc)@ans cats <- unlist(lapply(strsplit(cats, split = ":"), function(x) x[1])) if (!category %in% cats) { stop(paste( "\nSpecified category not available. Must be one of:\n", paste(cats, collapse = ", "), ".\n" )) } call <- match.call() ans <- xml.rpc( url = nc@url, method = "listSolversInCategory", .args = list(category = category), .convert = convert, .opts = nc@curlopts, .curl = nc@curlhandle ) res <- new("NeosAns", ans = ans, method = "listCategories", call = call, nc = nc ) return(res) } rneos/R/NgetFinalResultsNonBlocking.R0000644000176200001440000000141615135160627017311 0ustar liggesusers## ## XML-RPC method: getFinalResultsNonBlocking() ## NgetFinalResultsNonBlocking <- function(obj, convert = TRUE) { if (!inherits(obj, "NeosJob")) { stop("\nObject 'obj' is not of class 'NeosJob'.\n") } call <- match.call() jobnumber <- obj@jobnumber password <- obj@password nc <- obj@nc ans <- xml.rpc( url = nc@url, method = "getFinalResultsNonBlocking", .args = list(jobnumber = jobnumber, password = password), .convert = FALSE, .opts = nc@curlopts, .curl = nc@curlhandle ) if (convert) { tmp <- xmlValue(xmlRoot(xmlParse(ans))) tmp <- gsub("\\n", "", tmp) class(tmp) <- "base64" ans <- base64(tmp) } res <- new("NeosAns", ans = ans, method = "getFinalResultsNonBlocking", call = call, nc = nc ) return(res) } rneos/R/CreateNeosComm.R0000644000176200001440000000133015135162241014565 0ustar liggesusersCreateNeosComm <- function( curlopts = list( httpheader = c(`Content-Type` = "text/xml", "User-Agent" = "R"), port = 3333 ), curlhandle = getCurlHandle()) { url <- "https://www.neos-server.org" if (!("httpheader" %in% names(curlopts))) { stop("\nNo 'httpheader' list element has been specified in 'curlopts'.\n") } if (!("port" %in% names(curlopts))) { stop("\nNo 'port' list element has been specified in 'curlopts'.\n") } if (!inherits(curlhandle, "CURLHandle")) { stop("\nObject for 'curlhandle' must be of class 'CURLHandle'.\n") } result <- new("NeosComm", url = url, curlopts = curlopts, curlhandle = curlhandle ) return(result) } rneos/R/NgetFinalResults.R0000644000176200001440000000134215135160554015162 0ustar liggesusers## ## XML-RPC method: getFinalResults() ## NgetFinalResults <- function(obj, convert = TRUE) { if (!inherits(obj, "NeosJob")) { stop("\nObject 'obj' is not of class 'NeosJob'.\n") } call <- match.call() jobnumber <- obj@jobnumber password <- obj@password nc <- obj@nc ans <- xml.rpc( url = nc@url, method = "getFinalResults", .args = list(jobnumber = jobnumber, password = password), .convert = FALSE, .opts = nc@curlopts, .curl = nc@curlhandle ) if (convert) { tmp <- xmlValue(xmlRoot(xmlParse(ans))) tmp <- gsub("\\n", "", tmp) class(tmp) <- "base64" ans <- base64(tmp) } res <- new("NeosAns", ans = ans, method = "getFinalResults", call = call, nc = nc ) return(res) } rneos/R/NlistAllSolvers.R0000644000176200001440000000075015135161267015035 0ustar liggesusers## ## XML-RPC method: listAllSolvers() ## NlistAllSolvers <- function(convert = TRUE, nc = CreateNeosComm()) { if (!inherits(nc, "NeosComm")) { stop("\nObject provided for 'nc' must be of class 'NeosComm'.\n") } call <- match.call() ans <- xml.rpc( url = nc@url, method = "listAllSolvers", .convert = convert, .opts = nc@curlopts, .curl = nc@curlhandle ) res <- new("NeosAns", ans = ans, method = "listAllSolvers", call = call, nc = nc ) return(res) } rneos/R/AllClasses.R0000644000176200001440000000212713650012740013752 0ustar liggesusers## ## Class for NEOS communication objects ## setClass("NeosComm", representation(url = "character", curlopts = "list", curlhandle = "CURLHandle")) ## ## Class for returned Values from requests to NEOS ## setClass("NeosAns", representation(ans = "character", method = "character", call = "call", nc = "NeosComm")) ## ## Class for returned XML template from NEOS ## setClass("NeosXml", representation(xml = "XMLNode", method = "character", call = "call", nc = "NeosComm")) ## ## Class for assigned jobnumber and password from NEOS ## setClass("NeosJob", representation(jobnumber = "numeric", password = "character", method = "character", call = "call", nc = "NeosComm")) ## ## Class for NEOS offset ## setClass("NeosOff", representation(ans = "character", offset = "integer", jobnumber = "numeric", password = "character", method = "character", call = "call", nc = "NeosComm")) ## ## Classes related to XMLRPC ## setClass("XMLRPCServer", contains = "character") setClass("XMLRPCServerConnection", representation (curl = "CURLHandle"), contains = "XMLRPCServer") rneos/R/NprintQueue.R0000644000176200001440000000071515135161501014204 0ustar liggesusers## ## XML-RPC method: printQueue() ## NprintQueue <- function(convert = TRUE, nc = CreateNeosComm()) { if (!inherits(nc, "NeosComm")) { stop("\nObject provided for 'nc' must be of class 'NeosComm'.\n") } call <- match.call() ans <- xml.rpc( url = nc@url, method = "printQueue", .convert = convert, .opts = nc@curlopts, .curl = nc@curlhandle ) res <- new("NeosAns", ans = ans, method = "printQueue", call = call, nc = nc) return(res) } rneos/R/show-methods.R0000644000176200001440000000172313650013750014350 0ustar liggesusers## ## show-method for objects of class NeosAns ## setMethod("show", "NeosAns", function(object){ if(is.character(object@ans) && length(object@ans) == 1){ cat("\n") cat(object@ans) cat("\n") } else { print(object@ans) } }) ## ## show-method for objects of class NeosXml ## setMethod("show", "NeosXml", function(object){ print(object@xml) }) ## ## show-method for objects of class NeosJob ## setMethod("show", "NeosJob", function(object){ cat("\n") cat(paste("The job number is:", object@jobnumber, "\n")) cat(paste("The pass word is :", object@password, "\n")) cat("\n") }) ## ## show-method for objects of class NeosOff ## setMethod("show", "NeosOff", function(object){ title <- paste("# The new offset is:", object@offset, "#", sep=" ") row <- paste(rep("#", nchar(title)), collapse="") cat("\n") cat(object@ans) cat("\n") cat(row, "\n") cat(title, "\n") cat(row, "\n") cat("\n") }) rneos/R/Nping.R0000644000176200001440000000066515135161445013013 0ustar liggesusers## ## XML-RPC method: ping() ## Nping <- function(convert = TRUE, nc = CreateNeosComm()) { if (!inherits(nc, "NeosComm")) { stop("\nObject provided for 'nc' must be of class 'NeosComm'.\n") } call <- match.call() ans <- xml.rpc( url = nc@url, method = "ping", .convert = convert, .opts = nc@curlopts, .curl = nc@curlhandle ) res <- new("NeosAns", ans = ans, method = "ping", call = call, nc = nc) return(res) } rneos/R/NgetJobInfo.R0000644000176200001440000000106215135161012014062 0ustar liggesusers## ## XML-RPC method: getJobInfo() ## NgetJobInfo <- function(obj, convert = TRUE) { if (!inherits(obj, "NeosJob")) { stop("\nObject 'obj' is not of class 'NeosJob'.\n") } call <- match.call() jobnumber <- obj@jobnumber password <- obj@password nc <- obj@nc ans <- xml.rpc( url = nc@url, method = "getJobInfo", .args = list(jobnumber = jobnumber, password = password), .convert = convert, .opts = nc@curlopts, .curl = nc@curlhandle ) res <- new("NeosAns", ans = ans, method = "getJobInfo", call = call, nc = nc) return(res) } rneos/R/NgetIntermediateResultsNonBlocking.R0000644000176200001440000000226215135160752020671 0ustar liggesusers## ## XML-RPC method: getIntermediateResultsNonBlocking() ## NgetIntermediateResultsNonBlocking <- function(obj, offset = NULL, convert = TRUE) { if (!inherits(obj, "NeosJob")) { stop("\nObject 'obj' is not of class 'NeosJob'.\n") } call <- match.call() jobnumber <- obj@jobnumber password <- obj@password nc <- obj@nc if (is.null(offset)) { offset <- as.integer(0) } else { offset <- as.integer(offset) } ans <- xml.rpc( url = nc@url, method = "getIntermediateResultsNonBlocking", .args = list( jobnumber = jobnumber, password = password, offset = offset ), .convert = FALSE, .opts = nc@curlopts, .curl = nc@curlhandle ) tmp <- xmlToList(xmlRoot(xmlTreeParse(ans))) offset <- as.integer(tmp[2, ]) if (convert) { tmp1 <- tmp[1, ] if (!is.null(tmp1$params)) { tmp1 <- gsub("\\n", "", tmp1) class(tmp1) <- "base64" ans <- base64(tmp1) } else { ans <- "\nNothing left to return from NEOS.\n" } } res <- new("NeosOff", ans = ans, offset = offset, jobnumber = jobnumber, password = password, method = "getIntermediateResultsNonBlocking", call = call, nc = nc ) return(res) } rneos/R/Nhelp.R0000644000176200001440000000066515135161170013001 0ustar liggesusers## ## XML-RPC method: help() ## Nhelp <- function(convert = TRUE, nc = CreateNeosComm()) { if (!inherits(nc, "NeosComm")) { stop("\nObject provided for 'nc' must be of class 'NeosComm'.\n") } call <- match.call() ans <- xml.rpc( url = nc@url, method = "help", .convert = convert, .opts = nc@curlopts, .curl = nc@curlhandle ) res <- new("NeosAns", ans = ans, method = "help", call = call, nc = nc) return(res) } rneos/R/NgetJobStatus.R0000644000176200001440000000107215135161051014456 0ustar liggesusers## ## XML-RPC method: getJobStatus() ## NgetJobStatus <- function(obj, convert = TRUE) { if (!inherits(obj, "NeosJob")) { stop("\nObject 'obj' is not of class 'NeosJob'.\n") } call <- match.call() jobnumber <- obj@jobnumber password <- obj@password nc <- obj@nc ans <- xml.rpc( url = nc@url, method = "getJobStatus", .args = list(jobnumber = jobnumber, password = password), .convert = convert, .opts = nc@curlopts, .curl = nc@curlhandle ) res <- new("NeosAns", ans = ans, method = "getJobStatus", call = call, nc = nc) return(res) } rneos/R/NgetSolverTemplate.R0000644000176200001440000000127015135161123015506 0ustar liggesusers## ## NEOS: getSolverTemplate ## NgetSolverTemplate <- function(category, solvername, inputMethod, nc = CreateNeosComm()) { if (!inherits(nc, "NeosComm")) { stop("\nObject provided for 'nc' must be of class 'NeosComm'.\n") } call <- match.call() ans <- xml.rpc( url = nc@url, method = "getSolverTemplate", .args = list( category = category, solvername = solvername, inputMethod = inputMethod ), .convert = TRUE, .opts = nc@curlopts, .curl = nc@curlhandle ) xml <- xmlRoot(xmlTreeParse(ans, asText = TRUE)) res <- new("NeosXml", xml = xml, method = "getSolverTemplate", call = call, nc = nc ) return(res) } rneos/R/XMLRPC.R0000644000176200001440000002173113650015604012735 0ustar liggesusers## ## XMLRPC-related functions ## XMLRPCServer <- function(url, curl = NULL, class = if(!is.null(curl)) "XMLRPCServerConnection" else "XMLRPCServer", ..., .opts = list(...)) { if(is.null(curl) && length(.opts) || (is.logical(curl) && curl)) curl = getCurlHandle(.opts = .opts) ans = new(class, url) if(!is.null(curl)) ans@curl = curl ans } setMethod("$", "XMLRPCServer", function(x, name) { function(...) xml.rpc(as(x, "character"), name, ...) }) setMethod("$", "XMLRPCServerConnection", function(x, name) { function(...) xml.rpc(as(x, "character"), name, ..., .curl = x@curl) }) xml.rpc <- function(url, method, ..., .args = list(...), .opts = list(), .defaultOpts = list(httpheader = c('Content-Type' = "text/xml"), followlocation = TRUE, useragent = useragent), .convert = TRUE, .curl = getCurlHandle(), useragent = "R-XMLRPC"){ # Turn the method and arguments to an RPC body. body = createBody(method, .args) # merge the .defaultOpts and the .opts into one list. .defaultOpts[["postfields"]] = saveXML(body) if(length(.opts)) .defaultOpts[names(.opts)] = .opts rdr = dynCurlReader(.curl, baseURL = url) .defaultOpts[["headerfunction"]] = rdr$update ans = postForm(url, .opts = .defaultOpts, style = "POST", curl = .curl) hdr = parseHTTPHeader(rdr$header()) if(as.integer(hdr[["status"]]) %/% 100 != 2) { # call an RCurl error generator function. stop("Problems") } ans = rdr$value() # Now either convert using the default converter fnction (convertToR) # or return as is or allow the caller to specify a function to use for conversion. if(is.logical(.convert)) { if(.convert) convertToR(ans) else ans } else if(is.function(.convert)) .convert(ans) else ans } createBody <- function(method, args){ top = newXMLNode("methodCall", newXMLNode("methodName", method)) params = newXMLNode("params", parent = top) sapply(args, function(x) newXMLNode("param", rpc.serialize(x), parent = params)) top } setGeneric("rpc.serialize", function(x, ...) standardGeneric("rpc.serialize")) setMethod("rpc.serialize", "ANY", function(x, ...) { if(isS4(x)) return(rpc.serialize.S4Object(x, ...)) stop("Not sure how to convert this type of object to XMLRPC format") }) rpc.serialize.S4Object <- function(x, ...){ els = slotNames(x) rpc.serialize(structure(lapply(els, function(id) slot(x, id)), names = els), ...) } basicTypeMap <- c("integer" = "i4", "double" = "double", "character" = "string", "logical" = "boolean", "POSIXt" = "dateTime.iso8601", "POSIXct" = "dateTime.iso8601", "Date" = "dateTime.iso8601", "raw" = "base64") cast <- function(x) { if (is.logical(x)) as.integer(x) else x } setOldClass("AsIs") setMethod("rpc.serialize", "AsIs", function(x) { type = basicTypeMap[typeof(x)] vectorArray(x, type) }) setMethod("rpc.serialize", "NULL", function(x, ...) { rpc.serialize(list()) }) setMethod("rpc.serialize", "raw", function(x, ...) { val = base64Encode(x) newXMLNode("value", newXMLNode("base64", val)) }) setMethod("rpc.serialize", "Date", function(x, ...) { val = format(x, "%Y%m%dT%H:%H:%S") if(length(x) == 1) newXMLNode("value", newXMLNode("dateTime.iso8601", val)) else vectorArray(val, basicTypeMap["Date"]) }) setMethod("rpc.serialize", "POSIXt", function(x, ...) { val = format(as.POSIXct(x), "%Y%m%dT%H:%H:%S") if(length(x) == 1) newXMLNode("value", newXMLNode("dateTime.iso8601", val)) else vectorArray(val, basicTypeMap["POSIXt"]) }) setMethod("rpc.serialize", "vector", function(x, ...) { type <- basicTypeMap[typeof(x)] x <- cast(x) if(length(names(x))) { warning("Skipping names on vector!") names(x) = NULL } if(length(x) == 1){ newXMLNode("value", newXMLNode(type, if(type == "string") newXMLCDataNode(x) else x)) } else { vectorArray(x, type) } }) FormatStrings <- c(numeric = "%f", int = "%d", integer = "%d", logical = "%s", i4 = "%d", double = "%f", string = "%s", Date = "%s", POSIXt = "%s", POSIXct = "%s") vectorArray <- function(x, type){ top <- newXMLNode("value") a <- newXMLNode("array", parent = top) data <- newXMLNode("data", parent = a) tmpl <- if(type == "string") ## is.character(x)) sprintf("<%s>", type, type) else if(type == "dateTime.iso8601") { if(is(x, "Date")) x = format(x, "%Y%m%dT00:00:00") else x = format(as.POSIXct(x), "%Y%m%dT%H:%H:%S") sprintf("<%s>%%s", type, type) } else { if(type == "double") { x = as.character(x) pct = "%s" } else pct = FormatStrings[type] if(is.na(pct)) pct = "%s" sprintf("<%s>%s", type, pct, type) } txt <- sprintf(tmpl, x) parseXMLAndAdd(txt, data) top } setMethod("rpc.serialize", "list", function(x, ...) { if(length(names(x))) { a = newXMLNode("struct") sapply(names(x), function(id) { type = basicTypeMap[typeof(x[[id]])] newXMLNode("member", newXMLNode("name", id), rpc.serialize(x[[id]] ), parent = a) }) a } else { a = newXMLNode("array") data = newXMLNode("data", parent = a) sapply(x, function(x) { elName = basicTypeMap[typeof(x)] newXMLNode("value", newXMLNode(elName, if(elName == "string") newXMLCDataNode(x) else x, parent = data)) }) a } }) setGeneric("convertToR", function(node) standardGeneric('convertToR')) setMethod("convertToR", 'XMLInternalDocument', function(node) { fault = getNodeSet(node,path="//methodResponse/fault/value/struct") if (length(fault) > 0) { fault = xmlRPCToR(fault[[1]]) e = simpleError(paste("faultCode: ", fault$faultCode, " faultString: ", fault$faultString)) class(e) = c("XMLRPCError", class(e)) stop(e) } a = xpathApply(node, "//param/value", xmlRPCToR) if(length(a) == 1) a[[1]] else a }) setMethod("convertToR", "XMLInternalNode", function(node) { if(length(getNodeSet(node, "./param/value"))) { ans = xpathApply(node, "./param/value", xmlRPCToR, simplify = FALSE) } else xmlToList(node) }) setMethod("convertToR", "character", function(node) { convertToR(xmlParse(node, asText = TRUE)) }) xmlRPCToR <- function(node, ...){ if(is.null(node)) return(NULL) if(xmlName(node) == "value") node = node[[1]] if(is(node, "XMLInternalTextNode")) return(xmlValue(node)) type = xmlName(node) switch(type, 'array' = xmlRPCToR.array(node, ...), 'struct' = xmlRPCToR.struct(node, ...), 'i4' = as.integer(xmlValue(node)), 'int' = as.integer(xmlValue(node)), 'boolean' = if(xmlValue(node) == "1") TRUE else FALSE, 'double' = as.numeric(xmlValue(node)), 'string' = xmlValue(node), 'dateTime.iso8601' = as.POSIXct(strptime(xmlValue(node), "%Y%m%dT%H:%M:%S")), 'base64' = base64(xmlValue(node), encode = FALSE), xmlValue(node) ) } xmlRPCToR.struct <- function(node, ...){ ans <- xmlApply(node, function(x) xmlRPCToR(x[["value"]][[1]], ...)) names(ans) <- xmlSApply(node, function(x) xmlValue(x[["name"]])) ans } xmlRPCToR.array <- function(node, ...){ ans = xmlApply(node[["data"]], function(x) xmlRPCToR(x[[1]])) if(!is.list(ans[[1]]) && all(sapply(ans, typeof) == typeof(ans[[1]]))) structure(unlist(ans), names = NULL) else ans } rneos/R/update-methods.R0000644000176200001440000000120313337313451014646 0ustar liggesusers## ## Methods for updating an existing object ## ======================================= ## ## Method definition for objects of class "NeosOff" ## setMethod("update", signature(object = "NeosOff"), function(object, formula.,..., evaluate = TRUE){ call <- object@CALL extras <- match.call(expand.dots = FALSE)$... if (length(extras) > 0) { existing <- !is.na(match(names(extras), names(call))) for (a in names(extras)[existing]) call[[a]] <- extras[[a]] if (any(!existing)) { call <- c(as.list(call), extras[!existing]) call <- as.call(call) } } if (evaluate) eval(call, parent.frame()) else call }) rneos/R/Nversion.R0000644000176200001440000000070115135161601013524 0ustar liggesusers## ## XML-RPC method: version() ## Nversion <- function(convert = TRUE, nc = CreateNeosComm()) { if (!inherits(nc, "NeosComm")) { stop("\nObject provided for 'nc' must be of class 'NeosComm'.\n") } call <- match.call() ans <- xml.rpc( url = nc@url, method = "version", .convert = convert, .opts = nc@curlopts, .curl = nc@curlhandle ) res <- new("NeosAns", ans = ans, method = "version", call = call, nc = nc) return(res) } rneos/R/NemailHelp.R0000644000176200001440000000071115135162100013733 0ustar liggesusers## ## XML-RPC method: emailHelp() ## NemailHelp <- function(convert = TRUE, nc = CreateNeosComm()) { if (!inherits(nc, "NeosComm")) { stop("\nObject provided for 'nc' must be of class 'NeosComm'.\n") } call <- match.call() ans <- xml.rpc( url = nc@url, method = "emailHelp", .convert = convert, .opts = nc@curlopts, .curl = nc@curlhandle ) res <- new("NeosAns", ans = ans, method = "emailHelp", call = call, nc = nc) return(res) } rneos/R/NsubmitJob.R0000644000176200001440000000122315135161541014000 0ustar liggesusers## ## XML-RPC method: submitJob() ## NsubmitJob <- function(xmlstring, user = "rneos", interface = "", id = 0, nc = CreateNeosComm()) { if (!inherits(nc, "NeosComm")) { stop("\nObject provided for 'nc' must be of class 'NeosComm'.\n") } call <- match.call() ans <- xml.rpc( url = nc@url, method = "submitJob", .args = list( xmlstring = xmlstring, user = user, interface = interface, id = id ), .convert = TRUE, .opts = nc@curlopts, .curl = nc@curlhandle ) res <- new("NeosJob", jobnumber = ans[[1]], password = ans[[2]], method = "submitJob", call = call, nc = nc ) return(res) } rneos/NAMESPACE0000644000176200001440000000156213650006503012621 0ustar liggesusers## ## Import directives ## import(XML) import(RCurl) import(methods) ## Import functions importFrom(stats, update) ## ## Export of functions ## export(CreateNeosComm, CreateXmlString, NemailHelp, NgetFinalResults, NgetFinalResultsNonBlocking, NgetIntermediateResults, NgetIntermediateResultsNonBlocking, NgetJobInfo, NgetJobStatus, NgetSolverTemplate, Nhelp, NkillJob, NlistAllSolvers, NlistCategories, NlistSolversInCategory, Nping, NprintQueue, NsubmitJob, Nversion, Nwelcome, xml.rpc, XMLRPCServer, rpc.serialize) ## ## Export of S4-classes ## exportClasses(NeosComm, NeosAns, NeosXml, NeosJob, NeosOff, XMLRPCServer) ## ## Export of S4-methods ## exportMethods(show, update, "$") rneos/inst/0000755000176200001440000000000013337313447012365 5ustar liggesusersrneos/inst/ExGAMS/0000755000176200001440000000000013337313447013411 5ustar liggesusersrneos/inst/ExGAMS/TwoStageStochastic.gms0000644000176200001440000000405713337313447017711 0ustar liggesusers$TITLE Stochastic Two-stage program * TwoStageStochastic.gms: Stochastic Two-stage program. * Consiglio, Nielsen and Zenios. * PRACTICAL FINANCIAL OPTIMIZATION: A Library of GAMS Models, Section 6.3.1 * Last modified: Apr 2008. SET Assets Available assets /Stock, Put_1, Call_1, Put_2, Call_2/; SET Assets_1(Assets) Assets available up to the end of the first stage /Stock, Put_1, Call_1/; SET Assets_2(Assets) Assets available up to the end of the second stage /Stock, Put_2, Call_2/; SET Scenarios Set of scenarios /SS_1 * SS_3/; ALIAS (Assets, i ); ALIAS (Assets_1, j); ALIAS (Assets_2, k); ALIAS (Scenarios, l); PARAMETER pr(l) Scenario probability /SS_1 = 0.25, SS_2 = 0.50, SS_3 = 0.25/; PARAMETER P_1(j) Asset prices at the beginning of the first stage /Stock = 43, Put_1 = 0.81, Call_1 = 4.76/; TABLE P_2(l,i) Asset prices (values) at the beginning of the second stage Stock Put_1 Call_1 Put_2 Call_2 SS_1 44 1 0 0.92 4.43 SS_2 36 0 4 1.40 0.85 SS_3 47 2 0 3.02 6.82; TABLE V(l,k) Asset prices (values) at the end of the second stage Stock Put_2 Call_2 SS_1 48 1 0 SS_2 32 0 3 SS_3 55 4 0; POSITIVE VARIABLES x(j) First-stage holdings y(l,k) Second-stage holdings; VARIABLE z Objective function value; EQUATIONS BudgetCon Equation defining the budget contraint ObjDef Objective function definition MinReturnCon(l) Equation defining the minimum return contraint RebalanceCon(l) Equation defining the rebalance contraint; ObjDef .. z =E= SUM((k,l), pr(l) * V(l,k) * y(l,k)); BudgetCon .. SUM(j, P_1(j) * x(j)) =L= 10000; MinReturnCon(l) .. SUM(k, V(l,k) * y(l,k)) =G= 11500; RebalanceCon(l) .. SUM(j, P_2(l,j) * x(j)) =G= SUM(k, P_2(l,k) * y(l,k)); MODEL StochasticTwoStage /ALL/; SOLVE StochasticTwoStage MAXIMIZING z USING LP; DISPLAY x.l,z.l; rneos/inst/ExAMPL/0000755000176200001440000000000013337313447013413 5ustar liggesusersrneos/inst/ExAMPL/diet.dat0000644000176200001440000000131713337313447015034 0ustar liggesusersdata; set NUTR := A B1 B2 C ; set FOOD := BEEF CHK FISH HAM MCH MTL SPG TUR ; param: cost f_min f_max := BEEF 3.19 0 100 CHK 2.59 0 100 FISH 2.29 0 100 HAM 2.89 0 100 MCH 1.89 0 100 MTL 1.99 0 100 SPG 1.99 0 100 TUR 2.49 0 100 ; param: n_min n_max := A 700 10000 C 700 10000 B1 700 10000 B2 700 10000 ; param amt (tr): A C B1 B2 := BEEF 60 20 10 15 CHK 8 0 20 20 FISH 8 10 15 10 HAM 40 40 35 10 MCH 15 35 15 15 MTL 70 30 15 15 SPG 25 50 25 15 TUR 60 20 15 10 ; rneos/inst/ExAMPL/diet.mod0000644000176200001440000000061213337313447015040 0ustar liggesusersset NUTR; set FOOD; param cost {FOOD} > 0; param f_min {FOOD} >= 0; param f_max {j in FOOD} >= f_min[j]; param n_min {NUTR} >= 0; param n_max {i in NUTR} >= n_min[i]; param amt {NUTR,FOOD} >= 0; var Buy {j in FOOD} >= f_min[j], <= f_max[j]; minimize Total_Cost: sum {j in FOOD} cost[j] * Buy[j]; subject to Diet {i in NUTR}: n_min[i] <= sum {j in FOOD} amt[i,j] * Buy[j] <= n_max[i]; rneos/man/0000755000176200001440000000000013650031554012155 5ustar liggesusersrneos/man/CreateNeosComm.Rd0000644000176200001440000000351313650020240015300 0ustar liggesusers\name{CreateNeosComm} \alias{CreateNeosComm} \title{ Creating an object for communications with NEOS } \description{ This function creates an object of class \code{NeosComm} that will contain all necessary information for dealing with HTTP requests to NEOS. This object will be needed in all requests to NEOS and hence must be created in advance of XML-RPC requests. } \usage{ CreateNeosComm(curlopts = list(httpheader = c(`Content-Type` = "text/xml", `User-Agent` = "R"), port = 3333), curlhandle = getCurlHandle()) } \arguments{ \item{curlopts}{A named list of elements that are passed as options to curl. By default, the \code{httpheader} and the \code{port} options are preset.} \item{curlhandle}{An object of class \code{CURLHandle}. By default the returned object of getCurlHandle() is employed.} } \details{ A list of valid \code{curl} options can be retrieved from \code{listCurlOptions()}. Please note, that the relevant HTTP-bodies within the requests will be created directly in the API-functions provided in this package and must not be provided as list elements in \code{curloptions}. However, if one accesses NEOS \emph{via} a Proxy-Server, for instance, than the values for the relevant options must be set within the list-argument \code{curlopts}. The values of the returned object will be passed down to the function \code{xml.rpc()} which is utilised for all calls to the function \code{Nfoo} contained in this package. Hereby, \code{foo} signify the name of NEOS-API. } \value{ An object of class \code{NeosComm}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosComm}} } \examples{ \dontrun{ nc <- CreateNeosComm() nc } } \keyword{IO} rneos/man/NemailHelp.Rd0000644000176200001440000000175013650020445014462 0ustar liggesusers\name{NemailHelp} \alias{NemailHelp} \title{ XML-RPC method emailHelp of Neos } \description{ This functions calls the XML-RPC method \dQuote{emailHelp()} of NEOS and returns general help message for email users. } \usage{ NemailHelp(convert = TRUE, nc = CreateNeosComm()) } \arguments{ \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned.} \item{nc}{Object of class \code{NeosComm}: By default, this argument is set by calling \code{CreateNeosComm()} and thereby using the default values of this function.} } \value{ An object of class \code{NeosAns}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosAns}} and \code{\link{CreateNeosComm}} } \examples{ \dontrun{ NemailHelp() } } \keyword{IO} rneos/man/NeosXml-class.Rd0000644000176200001440000000425213650020471015133 0ustar liggesusers\name{NeosXml-class} \Rdversion{1.1} \docType{class} \alias{NeosXml-class} \alias{show,NeosXml-method} \title{Class "NeosXml"} \description{ Objects of this class contain the returned results from NEOS as well as information on which kind of query has been sent and how it was sent. } \section{Objects from the Class}{ Objects can be created by calls of the form \code{new("NeosXml", ...)} or more conveniently by calling the relevant R API functions. } \section{Slots}{ \describe{ \item{\code{xml}:}{Object of class \code{"XMLNode"}: The returned and converted XML-template of NEOS.} \item{\code{method}:}{Object of class \code{"character"}: The name of the called API function.} \item{\code{call}:}{Object of class \code{"call"}: The call to the generating function of the object.} \item{\code{nc}:}{Object of class \code{"NeosComm"}: The NeosComm object that has been used in the request to NEOS.} } } \section{Methods}{ \describe{ \item{show}{\code{signature(object = "NeosXml")}: Returns the converted slot \code{xml} from an object of class \code{NeosXml}.} } } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosComm}} } \examples{ showClass("NeosXml") \dontrun{ tmp <-NgetSolverTemplate(category = "go", solvername = "ASA", inputMethod = "AMPL") ## setting path to example model and data file modf <- system.file("ExAMPL", "diet.mod", package = "rneos") datf <- system.file("ExAMPL", "diet.dat", package = "rneos") ## import of file contents modc <- paste(paste(readLines(modf), collapse = "\n"), "\n") datc <- paste(paste(readLines(datf), collapse = "\n"), "\n") ## create list object argslist <- list(model = modc, data = datc, commands = "", comments = "") ## create XML string xmls <- CreateXmlString(neosxml = tmp, cdatalist = argslist) test <- NsubmitJob(xmlstring = xmls, user = "rneos", interface = "", id = 0) NgetJobStatus(obj = test, convert = TRUE) NgetJobInfo(obj = test, convert = TRUE) NgetFinalResults(obj = test, convert = TRUE) } } \keyword{classes} \keyword{IO} rneos/man/Nping.Rd0000644000176200001440000000212413650020353013511 0ustar liggesusers\name{Nping} \alias{Nping} \title{ XML-RPC method ping of Neos } \description{ This functions calls the XML-RPC method \dQuote{ping()} of NEOS and returns an object of class \code{NeosAns}. It is verified that this NeosServer is running and a message \sQuote{NeosServer is alive} is returned. } \usage{ Nping(convert = TRUE, nc = CreateNeosComm()) } \arguments{ \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned.} \item{nc}{Object of class \code{NeosComm}: By default, this argument is set by calling \code{CreateNeosComm()} and thereby using the default values of this function.} } \value{ An object of class \code{NeosAns}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosAns}}, \code{\link{NlistCategories}} and \code{\link{CreateNeosComm}} } \examples{ \dontrun{ Nping() } } \keyword{IO} rneos/man/CreateXmlString.Rd0000644000176200001440000000315713650020515015520 0ustar liggesusers\name{CreateXmlString} \alias{CreateXmlString} \title{ Inserting CDATA into XML-templates of NEOS } \description{ With this function the information for XML-templates can be inserted. Ordinarily, one creates an object with the function \code{NgetSolverTemplate()} first and then inserts the requested CDATA fields of this XML-form with this function. } \usage{ CreateXmlString(neosxml, cdatalist) } \arguments{ \item{neosxml}{An object of class \code{NeosXml} created with the function \code{NgetSolverTemplate()}. } \item{cdatalist}{A named list object with the CDATA tags to be filled. } } \value{A character string containing the specified optimization problem, which can then be used in a call to \code{NsubmitJob()}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosXml}} and \code{\link{NgetSolverTemplate}} } \examples{ \dontrun{ tmp <-NgetSolverTemplate(category = "go", solvername = "ASA", inputMethod = "AMPL") ## setting path to example model and data file modf <- system.file("ExAMPL", "diet.mod", package = "rneos") datf <- system.file("ExAMPL", "diet.dat", package = "rneos") ## import of file contents modc <- paste(paste(readLines(modf), collapse = "\n"), "\n") cat(modc) datc <- paste(paste(readLines(datf), collapse = "\n"), "\n") cat(datc) ## create list object argslist <- list(model = modc, data = datc, commands = "", comments = "") ## create XML string xmls <- CreateXmlString(neosxml = tmp, cdatalist = argslist) xmls } } \keyword{IO} rneos/man/NlistCategories.Rd0000644000176200001440000000210513650020324015532 0ustar liggesusers\name{NlistCategories} \alias{NlistCategories} \title{ XML-RPC method listCategories of Neos } \description{ This functions calls the XML-RPC method \dQuote{listCategories()} of NEOS and returns an object of class \code{NeosAns}; a dictionary with entries ('abbreviated name':'full name',...). } \usage{ NlistCategories(convert = TRUE, nc = CreateNeosComm()) } \arguments{ \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned.} \item{nc}{Object of class \code{NeosComm}: By default, this argument is set by calling \code{CreateNeosComm()} and thereby using the default values of this function.} } \value{ An object of class \code{NeosAns}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosAns}} and \code{\link{CreateNeosComm}} } \examples{ \dontrun{ NlistCategories() } } \keyword{IO} rneos/man/NgetIntermediateResults.Rd0000644000176200001440000000436613650020507017263 0ustar liggesusers\name{NgetIntermediateResults} \alias{NgetIntermediateResults} \title{ XML-RPC method getIntermediateResults of Neos } \description{ This functions calls the XML-RPC method \dQuote{getIntermediateResults()} of NEOS, which returns intermediate results of a job submitted to NEOS, starting at the character offset up to the last received data. Intermediate results are usually the standard output of the solver daemon. If the job is still running, then this function will hang until another packet of output is sent to NEOS or the job is finished. This function will return a tuple of thebase-64 encoded object and the new offset (object, newoffset). The offset refers to uncoded characters. } \usage{ NgetIntermediateResults(obj, offset = NULL, convert = TRUE) } \arguments{ \item{obj}{NeosJob, an object of class \code{NeosJob} as returned by the function \code{NsubmitJob}.} \item{offset}{Integer, the offset from which on the results are returned. In a first run this is set to \code{integer(0)}.} \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned (base-64 encoded).} } \value{ An object of class \code{NeosOff}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosOff}} and \code{\link{NsubmitJob}} } \examples{ \dontrun{ tmp <-NgetSolverTemplate(category = "go", solvername = "ASA", inputMethod = "AMPL") ## setting path to example model and data file modf <- system.file("ExAMPL", "diet.mod", package = "rneos") datf <- system.file("ExAMPL", "diet.dat", package = "rneos") ## import of file contents modc <- paste(paste(readLines(modf), collapse = "\n"), "\n") datc <- paste(paste(readLines(datf), collapse = "\n"), "\n") ## create list object argslist <- list(model = modc, data = datc, commands = "", comments = "") ## create XML string xmls <- CreateXmlString(neosxml = tmp, cdatalist = argslist) test <- NsubmitJob(xmlstring = xmls, user = "rneos", interface = "", id = 0) NgetIntermediateResults(obj = test, convert = TRUE) } } \keyword{IO} rneos/man/NprintQueue.Rd0000644000176200001440000000204613650020477014727 0ustar liggesusers\name{NprintQueue} \alias{NprintQueue} \title{ XML-RPC method printQueue of Neos } \description{ This functions calls the XML-RPC method \dQuote{printQueue()} of NEOS and returns an object of class \code{NeosAns}, which is a string containing the current NEOS jobs. } \usage{ NprintQueue(convert = TRUE, nc = CreateNeosComm()) } \arguments{ \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned.} \item{nc}{Object of class \code{NeosComm}: By default, this argument is set by calling \code{CreateNeosComm()} and thereby using the default values of this function.} } \value{ An object of class \code{NeosAns}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosAns}} and \code{\link{CreateNeosComm}} } \examples{ \dontrun{ NprintQueue() } } \keyword{IO} rneos/man/rpc.serialize.Rd0000644000176200001440000000163613650021360015216 0ustar liggesusers\name{rpc.serialize} \alias{rpc.serialize} \alias{rpc.serialize,ANY-method} \alias{rpc.serialize,AsIs-method} \alias{rpc.serialize,NULL-method} \alias{rpc.serialize,Date-method} \alias{rpc.serialize,POSIXt-method} \alias{rpc.serialize,list-method} \alias{rpc.serialize,raw-method} \alias{rpc.serialize,vector-method} \title{Serialize R objects to XML-RPC format} \description{ This function and its methods convert R objects to XML for use in XML-RPC requests. } \usage{ rpc.serialize(x, ...) } \arguments{ \item{x}{the R object to be serialized in XML-RPC format} \item{\dots}{additional parameters understood by methods} } \value{ An \code{XMLInternalNode} object representing the XML content. } \references{ The XML-RPC specification at \url{http://www.xmlrpc.com/spec.md}. } \author{Duncan Temple Lang} \seealso{\code{\link{xml.rpc}}} %\examples{} \keyword{IO} \keyword{programming} \concept{RPC} \concept{XML} rneos/man/NgetIntermediateResultsNonBlocking.Rd0000644000176200001440000000453413650020523021402 0ustar liggesusers\name{NgetIntermediateResultsNonBlocking} \alias{NgetIntermediateResultsNonBlocking} \title{ XML-RPC method getIntermediateResultsNonBlocking of Neos } \description{ This functions calls the XML-RPC method \dQuote{getIntermediateResultsNonBlocking()} of NEOS, which returns intermediate results of a job submitted to NEOS, starting at the character offset up to the last received data. Intermediate results are usually the standard output of the solver daemon. If the job is still running, then this function will hang until another packet of output is sent to NEOS or the job is finished. This function will return a tuple of thebase-64 encoded object and the new offset (object, newoffset). The offset refers to uncoded characters. } \usage{ NgetIntermediateResultsNonBlocking(obj, offset = NULL, convert = TRUE) } \arguments{ \item{obj}{NeosJob, an object of class \code{NeosJob} as returned by the function \code{NsubmitJob}.} \item{offset}{Integer, the offset from which on the results are returned. In a first run this is set to \code{integer(0)}.} \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned (base-64 encoded).} } \value{ An object of class \code{NeosOff}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosOff}} and \code{\link{NsubmitJob}} } \examples{ \dontrun{ tmp <-NgetSolverTemplate(category = "go", solvername = "ASA", inputMethod = "AMPL") ## setting path to example model and data file modf <- system.file("ExAMPL", "diet.mod", package = "rneos") datf <- system.file("ExAMPL", "diet.dat", package = "rneos") ## import of file contents modc <- paste(paste(readLines(modf), collapse = "\n"), "\n") datc <- paste(paste(readLines(datf), collapse = "\n"), "\n") ## create list object argslist <- list(model = modc, data = datc, commands = "", comments = "") ## create XML string xmls <- CreateXmlString(neosxml = tmp, cdatalist = argslist) test <- NsubmitJob(xmlstring = xmls, user = "rneos", interface = "", id = 0) NgetIntermediateResultsNonBlocking(obj = test, convert = TRUE) } } \keyword{IO} rneos/man/NkillJob.Rd0000644000176200001440000000221513650020550014142 0ustar liggesusers\name{NkillJob} \alias{NkillJob} \title{ XML-RPC method killJob of Neos } \description{ This method is used to cancel a job submission running on NEOS (or waiting to run on NEOS). The job password is required to prevent abuse of this function (extracted from relevant slot of \code{obj}). This functions calls the XML-RPC method \dQuote{killJob()} of NEOS and returns an object of class \code{NeosAns}. } \usage{ NkillJob(obj, killmsg = NULL, convert = TRUE) } \arguments{ \item{obj}{Object of class \code{NeosJob}, as returned by the function \code{NsubmitJob}.} \item{killmsg}{Character, optional description.} \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned.} } \value{ An object of class \code{NeosAns} containing the returned message from NEOS. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosAns}} and \code{\linkS4class{NeosJob}} } \keyword{IO} rneos/man/NgetSolverTemplate.Rd0000644000176200001440000000242513650020410016220 0ustar liggesusers\name{NgetSolverTemplate} \alias{NgetSolverTemplate} \title{ XML-RPC method getSolverTemplate of Neos } \description{ This functions calls the XML-RPC method \dQuote{getSolverTemplate()} of NEOS. If the solver category:solvername:inputMethod exists on NEOS, then an XML template is returned as an object of class \code{NeosXml}. } \usage{ NgetSolverTemplate(category, solvername, inputMethod, nc = CreateNeosComm()) } \arguments{ \item{category}{Character, the abbreviation of a category} \item{solvername}{Character, the name of the solver to be used.} \item{inputMethod}{Character, the name of the solver for which the xml-template shall be returned.} \item{nc}{Object of class \code{NeosComm}: By default, this argument is set by calling \code{CreateNeosComm()} and thereby using the default values of this function.} } \value{ An object of class \code{NeosXml}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosXml}}, \code{\link{NlistAllSolvers}} and \code{\link{CreateNeosComm}} } \examples{ \dontrun{ NgetSolverTemplate(category = "go", solvername = "ASA", inputMethod = "AMPL") } } \keyword{IO} rneos/man/NeosAns-class.Rd0000644000176200001440000000257513650020531015117 0ustar liggesusers\name{NeosAns-class} \Rdversion{1.1} \docType{class} \alias{NeosAns-class} \alias{show,NeosAns-method} \title{Class "NeosAns"} \description{ Objects of this class contain the returned results from NEOS as well as information on which kind of query has been sent and how it was sent. } \section{Objects from the Class}{ Objects can be created by calls of the form \code{new("NeosAns", ...)} or more conveniently by calling the relevant R API functions. } \section{Slots}{ \describe{ \item{\code{ans}:}{Object of class \code{"character"}: The returned XML-RPC of NEOS as character string.} \item{\code{method}:}{Object of class \code{"character"}: The name of the called API function.} \item{\code{call}:}{Object of class \code{"call"}: The call to the generating function of the object.} \item{\code{nc}:}{Object of class \code{"NeosComm"}: The NeosComm object that has been used in the request to NEOS.} } } \section{Methods}{ \describe{ \item{show}{\code{signature(object = "NeosAns")}: Returns the converted slot \code{ans} from an object of class \code{NeosAns}.} } } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosComm}} } \examples{ showClass("NeosAns") } \keyword{classes} \keyword{IO} rneos/man/Nversion.Rd0000644000176200001440000000204413650020540014240 0ustar liggesusers\name{Nversion} \alias{Nversion} \title{ XML-RPC method version of Neos } \description{ This functions calls the XML-RPC method \dQuote{version()} of NEOS and returns an object of class \code{NeosAns}, which is a string containing the version number of the NEOS server. } \usage{ Nversion(convert = TRUE, nc = CreateNeosComm()) } \arguments{ \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned.} \item{nc}{Object of class \code{NeosComm}: By default, this argument is set by calling \code{CreateNeosComm()} and thereby using the default values of this function.} } \value{ An object of class \code{NeosAns}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosAns}} and \code{\link{CreateNeosComm}} } \examples{ \dontrun{ Nversion() } } \keyword{IO} rneos/man/Nhelp.Rd0000644000176200001440000000171213650020453013507 0ustar liggesusers\name{Nhelp} \alias{Nhelp} \title{ XML-RPC method help of Neos } \description{ This functions calls the XML-RPC method \dQuote{help()} of NEOS and returns an object of class \code{NeosAns}. } \usage{ Nhelp(convert = TRUE, nc = CreateNeosComm()) } \arguments{ \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned.} \item{nc}{Object of class \code{NeosComm}: By default, this argument is set by calling \code{CreateNeosComm()} and thereby using the default values of this function.} } \value{ An object of class \code{NeosAns}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosAns}} and \code{\link{CreateNeosComm}} } \examples{ \dontrun{ Nhelp() } } \keyword{IO} rneos/man/NeosJob-class.Rd0000644000176200001440000000423213650020422015077 0ustar liggesusers\name{NeosJob-class} \Rdversion{1.1} \docType{class} \alias{NeosJob-class} \alias{show,NeosJob-method} \title{Class "NeosJob"} \description{ Objects of this class contain among other slots the returned jobnumber and password for jobs submitted to NEOS. Objects of this class can then be used for retrieving the optimization results. } \section{Objects from the Class}{ Objects can be created by calls of the form \code{new("NeosJob", ...)} or more conveniently by calling the relevant R API function \code{NsubmitJob}. } \section{Slots}{ \describe{ \item{\code{jobnumber}:}{Object of class \code{"numeric"}: The returned job number.} \item{\code{password}:}{Object of class \code{"character"}: The returned pass word.} \item{\code{method}:}{Object of class \code{"character"}: The name of the called API function.} \item{\code{call}:}{Object of class \code{"call"}: The call to the generating function of the object.} \item{\code{nc}:}{Object of class \code{"NeosComm"}: The NeosComm object that has been used in the request to NEOS.} } } \section{Methods}{ \describe{ \item{show}{\code{signature(object = "NeosJob")}: Displays the slots \code{jobnumber} and \code{password} from an object of class \code{NeosJob}.} } } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \examples{ showClass("NeosJob") \dontrun{ tmp <-NgetSolverTemplate(category = "go", solvername = "ASA", inputMethod = "AMPL") ## setting path to example model and data file modf <- system.file("ExAMPL", "diet.mod", package = "rneos") datf <- system.file("ExAMPL", "diet.dat", package = "rneos") ## import of file contents modc <- paste(paste(readLines(modf), collapse = "\n"), "\n") datc <- paste(paste(readLines(datf), collapse = "\n"), "\n") ## create list object argslist <- list(model = modc, data = datc, commands = "", comments = "") ## create XML string xmls <- CreateXmlString(neosxml = tmp, cdatalist = argslist) NsubmitJob(xmlstring = xmls, user = "rneos", interface = "", id = 0) } } \keyword{classes} \keyword{IO} rneos/man/NgetJobInfo.Rd0000644000176200001440000000316613650020315014607 0ustar liggesusers\name{NgetJobInfo} \alias{NgetJobInfo} \title{ XML-RPC method getJobInfo of Neos } \description{ This functions calls the XML-RPC method \dQuote{getJobInfo()} of NEOS and returns a four-tuple (category, solver name, input, status). } \usage{ NgetJobInfo(obj, convert = TRUE) } \arguments{ \item{obj}{Object of class \code{NeosJob}, as returned by the function \code{NsubmitJob}.} \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned.} } \value{ An object of class \code{NeosAns}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosAns}}, \code{\linkS4class{NeosJob}} and \code{\link{NgetJobStatus}} } \examples{ \dontrun{ tmp <-NgetSolverTemplate(category = "go", solvername = "ASA", inputMethod = "AMPL") ## setting path to example model and data file modf <- system.file("ExAMPL", "diet.mod", package = "rneos") datf <- system.file("ExAMPL", "diet.dat", package = "rneos") ## import of file contents modc <- paste(paste(readLines(modf), collapse = "\n"), "\n") datc <- paste(paste(readLines(datf), collapse = "\n"), "\n") ## create list object argslist <- list(model = modc, data = datc, commands = "", comments = "") ## create XML string xmls <- CreateXmlString(neosxml = tmp, cdatalist = argslist) test <- NsubmitJob(xmlstring = xmls, user = "rneos", interface = "", id = 0) NgetJobInfo(obj = test, convert = TRUE) } } \keyword{IO} rneos/man/NeosComm-class.Rd0000644000176200001440000000253515135163140015271 0ustar liggesusers\name{NeosComm-class} \Rdversion{1.1} \docType{class} \alias{NeosComm-class} \title{Class "NeosComm"} \description{ The purpose of this class is to gather the relevant information needed for HTTP requests that is passed to NEOS. } \section{Objects from the Class}{ Objects can be created by calls of the form \code{new("NeosComm", ...)} or more conveniently by creating an object from \code{CreateNeosComm()}. } \section{Slots}{ \describe{ \item{\code{url}:}{Object of class \code{"character"}: The URL to NEOS, \emph{i.e.}, \url{https://neos-server.org/}} \item{\code{curlopts}:}{Object of class \code{"list"}: A named list of valid Curl options.} \item{\code{curlhandle}:}{Object of class \code{"CURLHandle"}: Objects of this class can be created and altered with \code{getCurlHandle()}} } } \section{Methods}{ No methods defined with class "NeosComm" in the signature. } \references{ Omegahat web site for RCurl: \url{https://www.omegahat.net/RCurl/}, and\cr libcurl web site: \url{https://curl.se} } \author{ Bernhard Pfaff } \seealso{ \code{\link{CreateNeosComm}}, \code{\link[RCurl]{getCurlHandle}} and \code{\link[RCurl]{CURLHandle-class}} } \examples{ showClass("NeosComm") \dontrun{ nc <- CreateNeosComm() nc } } \keyword{classes} \keyword{IO} rneos/man/NgetFinalResults.Rd0000644000176200001440000000335513650037313015702 0ustar liggesusers\name{NgetFinalResults} \alias{NgetFinalResults} \title{ XML-RPC method getFinalResults of Neos } \description{ This functions calls the XML-RPC method \dQuote{getFinalResults()} of NEOS, which gets results of a job submitted to NEOS. If the job is still running, then this function will hang until the job is finished. } \usage{ NgetFinalResults(obj, convert = TRUE) } \arguments{ \item{obj}{NeosJob, an object of class \code{NeosJob} as returned by the function \code{NsubmitJob}.} \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned (base-64 encoded).} } \value{ An object of class \code{NeosAns}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosAns}} and \code{\link{NsubmitJob}} } \examples{ \dontrun{ tmp <-NgetSolverTemplate(category = "lp", solvername = "MOSEK", inputMethod = "AMPL") ## setting path to example model and data file modf <- system.file("ExAMPL", "diet.mod", package = "rneos") datf <- system.file("ExAMPL", "diet.dat", package = "rneos") ## import of file contents modc <- paste(paste(readLines(modf), collapse = "\n"), "\n") datc <- paste(paste(readLines(datf), collapse = "\n"), "\n") ## create list object argslist <- list(model = modc, data = datc, commands = "", comments = "") ## create XML string xmls <- CreateXmlString(neosxml = tmp, cdatalist = argslist) test <- NsubmitJob(xmlstring = xmls, user = "rneos", interface = "", id = 0) NgetFinalResults(obj = test, convert = TRUE) } } \keyword{IO} rneos/man/NlistAllSolvers.Rd0000644000176200001440000000206313650020462015541 0ustar liggesusers\name{NlistAllSolvers} \alias{NlistAllSolvers} \title{ XML-RPC method listAllSolvers of Neos } \description{ This functions calls the XML-RPC method \dQuote{listAllSolvers()} of NEOS and returns an object of class \code{NeosAns}; a list of \code{category:solver:inputMethod}. } \usage{ NlistAllSolvers(convert = TRUE, nc = CreateNeosComm()) } \arguments{ \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned.} \item{nc}{Object of class \code{NeosComm}: By default, this argument is set by calling \code{CreateNeosComm()} and thereby using the default values of this function.} } \value{ An object of class \code{NeosAns}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosAns}} and \code{\link{CreateNeosComm}} } \examples{ \dontrun{ NlistAllSolvers() } } \keyword{IO} rneos/man/xml.rpc.Rd0000644000176200001440000000465513650021135014033 0ustar liggesusers\name{xml.rpc} \alias{xml.rpc} \title{Invoke XML-RPC method from R} \description{ This function can be used to invoke a method provided by an XML-RPC (remote procedure call) server. It can pass R objects in the request by serializing them to XML format and also converts the result back to R. } \usage{ xml.rpc(url, method, ..., .args = list(...), .opts = list(), .defaultOpts = list(httpheader = c("Content-Type" = "text/xml"), followlocation = TRUE, useragent = useragent), .convert = TRUE, .curl = getCurlHandle(), useragent = "R-XMLRPC") } %- maybe also 'usage' for other objects documented here. \arguments{ \item{url}{the URL of the XML-RPC server} \item{method}{a string giving the name of the XML-RPC method to invoke} \item{\dots}{a collection of argument valuesn} \item{.args}{an alternative way to specify the collection (list) of arguments} \item{.opts}{a list of options passed on to \code{\link[RCurl]{postForm}}. This is for the caller to specify server-specific curl options as opposed to general XML-RPC options which are set via \code{.defaultOpts}. } \item{.defaultOpts}{standard/default RCurl options used when making this call} \item{.convert}{either a logical value indicating whether to perform the defalt conversion (via \code{convertToR}) or not, or alternatively a function which is called with a string giving the body of the HTTP response of the XML-RPC call.} \item{.curl}{a CURLHandle object that the caller can specify to allow reusing existing handles and connections. This can greatly improve efficiency.} \item{useragent}{the string identifying the application that is reported to the Web server as making the request.} } \value{ If \code{.convert} is a logical value and \code{TRUE}, an R object giving the result of the XML-RPC method invocation. If \code{.convert} is \code{FALSE}, a string giving the body of the response. If \code{.convert} is a function, it is called with the body of the XML-RPC response as a string. } \references{\url{http://www.xmlrpc.com} \url{http://www.cafeconleche.org/books/xmljava/chapters/ch02s05.html} for a DTD for XML-RPC and examples and discussion. } \author{Duncan Temple Lang } \seealso{ \code{\link[RCurl]{postForm}} \code{\link[RCurl]{getURL}} and REST Web services \code{SSOAP} package. } \keyword{IO} \keyword{programming} rneos/man/NlistServersInCategory.Rd0000644000176200001440000000250315135157524017102 0ustar liggesusers\name{NlistSolversInCategory} \alias{NlistSolversInCategory} \title{ XML-RPC method listSolversInCategory of Neos } \description{ This functions calls the XML-RPC method \dQuote{listSolversInCategory()} of NEOS and returns an object of class \code{NeosAns}. The returned content is a list of solver:input for every solver in the category (category can be abbreviation or full_name). } \usage{ NlistSolversInCategory(category, convert = TRUE, nc = CreateNeosComm()) } \arguments{ \item{category}{Character, the abbreviation of a category} \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned.} \item{nc}{Object of class \code{NeosComm}: By default, this argument is set by calling \code{CreateNeosComm()} and thereby using the default values of this function.} } \value{ An object of class \code{NeosAns}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosAns}}, \code{\link{NlistCategories}} and \code{\link{CreateNeosComm}} } \examples{ \dontrun{ NlistSolversInCategory(category = "go") } } \keyword{IO} rneos/man/Nwelcome.Rd0000644000176200001440000000200113650020366014205 0ustar liggesusers\name{Nwelcome} \alias{Nwelcome} \title{ XML-RPC method welcome of Neos } \description{ This functions calls the XML-RPC method \dQuote{welcome()} of NEOS and returns an object of class \code{NeosAns}, which is a welcome message (string). } \usage{ Nwelcome(convert = TRUE, nc = CreateNeosComm()) } \arguments{ \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned.} \item{nc}{Object of class \code{NeosComm}: By default, this argument is set by calling \code{CreateNeosComm()} and thereby using the default values of this function.} } \value{ An object of class \code{NeosAns}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosAns}} and \code{\link{CreateNeosComm}} } \examples{ \dontrun{ Nwelcome() } } \keyword{IO} rneos/man/XMLRPCServer.Rd0000644000176200001440000000341213650016440014635 0ustar liggesusers\name{XMLRPCServer} \alias{XMLRPCServer} \alias{XMLRPCServer-class} \alias{XMLRPCServerConnection-class} \alias{$,XMLRPCServer-method} \alias{$,XMLRPCServerConnection-method} \title{Create an instance of an XMLRPCServer object} \description{ The \code{XMLRPCServer} class is a means to identify a string as the URL of an XML-RPC server. We can then use this to invoke a method provided by the server either via a call to \code{\link{xml.rpc}} or via an expression of the form \code{server$methodName(arg1, arg2, ...)}. The \code{XMLRPCServerConnection} class allows us to associate a \code{CURLHandle} object with an XML-RPC server. This connection is then used in each of the calls to that server. This allows us to reuse a single curl connection to the server and also slightly simplifies passing it to each call. } \usage{ XMLRPCServer(url, curl = NULL, class = if (!is.null(curl)) "XMLRPCServerConnection" else "XMLRPCServer", ..., .opts = list(...)) } \arguments{ \item{url}{the URL for the XML-RPC server.} \item{curl}{either a logical value indicating whether to create a new \code{CURLHandle} object, or an instance of a \code{CURLHandle} or alternatively \code{NULL}. If CURL options are specified via the \code{\dots} or \code{.opts} parameters, then a CURL handle is automatically created using these. } \item{class}{the name of the class to create.} \item{\dots}{name=value pairs of CURL options that are used to create a new \code{CURLHandle} object.} \item{.opts}{an alternative way to specify the CURL options for the handle to be created.} } \value{ An object of class given by the value of \code{class}. } \author{ Duncan Temple Lang } \seealso{ \code{\link{xml.rpc}} } \keyword{IO} \concept{XMLRPC} \concept{OOP} rneos/man/NgetFinalResultsNonBlocking.Rd0000644000176200001440000000344313650020431020015 0ustar liggesusers\name{NgetFinalResultsNonBlocking} \alias{NgetFinalResultsNonBlocking} \title{ XML-RPC method getFinalResultsNonBlocking of Neos } \description{ This functions calls the XML-RPC method \dQuote{getFinalResultsNonBlocking()} of NEOS, which gets results of a job submitted to NEOS. If the job is still running, then this function will return an empty string (base-64 encoded). } \usage{ NgetFinalResultsNonBlocking(obj, convert = TRUE) } \arguments{ \item{obj}{NeosJob, an object of class \code{NeosJob} as returned by the function \code{NsubmitJob}.} \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned (base-64 encoded).} } \value{ An object of class \code{NeosAns}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosAns}} and \code{\link{NsubmitJob}} } \examples{ \dontrun{ tmp <-NgetSolverTemplate(category = "go", solvername = "ASA", inputMethod = "AMPL") ## setting path to example model and data file modf <- system.file("ExAMPL", "diet.mod", package = "rneos") datf <- system.file("ExAMPL", "diet.dat", package = "rneos") ## import of file contents modc <- paste(paste(readLines(modf), collapse = "\n"), "\n") datc <- paste(paste(readLines(datf), collapse = "\n"), "\n") ## create list object argslist <- list(model = modc, data = datc, commands = "", comments = "") ## create XML string xmls <- CreateXmlString(neosxml = tmp, cdatalist = argslist) test <- NsubmitJob(xmlstring = xmls, user = "rneos", interface = "", id = 0) NgetFinalResultsNonBlocking(obj = test, convert = TRUE) } } \keyword{IO} rneos/man/NsubmitJob.Rd0000644000176200001440000000225713650020437014524 0ustar liggesusers\name{NsubmitJob} \alias{NsubmitJob} \title{ XML-RPC method submitJob of Neos } \description{ This functions calls the XML-RPC method \dQuote{submitJob()} of NEOS and returns an object of class \code{NeosJob}. } \usage{ NsubmitJob(xmlstring, user = "rneos", interface = "", id = 0, nc = CreateNeosComm()) } \arguments{ \item{xmlstring}{Character, the xml string according to the solver's template and filled withe the user's optimisation data.} \item{user}{Character, the name of the user; for certain optimizers an email address is required.} \item{interface}{Character, the name of the interface.} \item{id}{Integer, an identifier for the submitted job.} \item{nc}{Object of class \code{NeosComm}: By default, this argument is set by calling \code{CreateNeosComm()} and thereby using the default values of this function.} } \value{ An object of class \code{NeosJob}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosJob}}, \code{\link{CreateXmlString}} and \code{\link{NgetSolverTemplate}} } \keyword{IO} rneos/man/NeosOff-class.Rd0000644000176200001440000000273513650020333015106 0ustar liggesusers\name{NeosOff-class} \Rdversion{1.1} \docType{class} \alias{NeosOff-class} \alias{show,NeosOff-method} \alias{update,NeosOff-method} \title{Class "NeosOff"} \description{ Objects of this class contain among other slots the partial result and the offset. } \section{Objects from the Class}{ Objects can be created by calls of the form \code{new("NeosOff", ...)}. } \section{Slots}{ \describe{ \item{\code{ans}:}{Object of class \code{"character"}: The partial result returned from NEOS.} \item{\code{offset}:}{Object of class \code{"integer"}: The integer offset until the results have been returned.} \item{\code{jobnumber}:}{Object of class \code{"numeric"}: The returned job number.} \item{\code{password}:}{Object of class \code{"character"}: The returned pass word.} \item{\code{method}:}{Object of class \code{"character"}: The name of the called API function.} \item{\code{call}:}{Object of class \code{"call"}: The call to the generating function of the object.} \item{\code{nc}:}{Object of class \code{"NeosComm"}: The NeosComm object that has been used in the request to NEOS.} } } \section{Methods}{ \describe{ \item{update}{Updates an object of class \code{NeosOff}.} } } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \examples{ showClass("NeosOff") } \keyword{classes} \keyword{IO} rneos/man/NgetJobStatus.Rd0000644000176200001440000000336113650020266015201 0ustar liggesusers\name{NgetJobStatus} \alias{NgetJobStatus} \title{ XML-RPC method getJobStatus of Neos } \description{ This functions calls the XML-RPC method \dQuote{getJobStatus()} of NEOS and returns an object of class \code{NeosAns}. The functions returns the current job status (either \dQuote{Done}, \dQuote{Running}, \dQuote{Waiting}, \dQuote{Unknown Job} or \dQuote{Bad Password}). } \usage{ NgetJobStatus(obj, convert = TRUE) } \arguments{ \item{obj}{NeosJob, an object of class \code{NeosJob} as returned by the function \code{NsubmitJob}.} \item{convert}{Logical, if \code{convert = TRUE} (the default) the value of the returned XML-RPC result is extracted and returned as character, otherwise the XML-RPC string is returned.} } \value{ An object of class \code{NeosAns}. } \references{ NEOS API: \url{https://neos-server.org/neos/xml-rpc.html} } \author{ Bernhard Pfaff } \seealso{ \code{\linkS4class{NeosAns}} and \code{\link{NsubmitJob}} } \examples{ \dontrun{ tmp <-NgetSolverTemplate(category = "go", solvername = "ASA", inputMethod = "AMPL") ## setting path to example model and data file modf <- system.file("ExAMPL", "diet.mod", package = "rneos") datf <- system.file("ExAMPL", "diet.dat", package = "rneos") ## import of file contents modc <- paste(paste(readLines(modf), collapse = "\n"), "\n") datc <- paste(paste(readLines(datf), collapse = "\n"), "\n") ## create list object argslist <- list(model = modc, data = datc, commands = "", comments = "") ## create XML string xmls <- CreateXmlString(neosxml = tmp, cdatalist = argslist) test <- NsubmitJob(xmlstring = xmls, user = "rneos", interface = "", id = 0) NgetJobStatus(obj = test, convert = TRUE) } } \keyword{IO} rneos/DESCRIPTION0000644000176200001440000000212615135331705013112 0ustar liggesusersPackage: rneos Version: 0.4-1 Date: 2026-01-24 Title: XML-RPC Interface to NEOS Authors@R: c(person(given = "Bernhard", family = "Pfaff", email = "bernhard@pfaffikus.de", role = c("aut", "cre")), person(given = "Duncan Temple", family = "Lang", email = "= 2.10.0), methods, RCurl, XML, stats LazyLoad: yes Description: Within this package the XML-RPC API to NEOS is implemented. This enables the user to pass optimization problems to NEOS and retrieve results within R. License: GPL (>= 2) Maintainer: Bernhard Pfaff Repository: CRAN Repository/R-Forge/Project: rneos Repository/R-Forge/Revision: 249 Repository/R-Forge/DateTimeStamp: 2016-03-02 22:39:48 Date/Publication: 2026-01-25 06:10:13 UTC NeedsCompilation: no Packaged: 2026-01-24 15:34:34 UTC; bp Author: Bernhard Pfaff [aut, cre], Duncan Temple Lang [ctb] (included XMLRPC package, hosted at http://www.omegahat.net/XMLRPC/; BSD license.)