rneos/0000755000176200001440000000000013650243122011376 5ustar liggesusersrneos/NAMESPACE0000644000176200001440000000156213650031777012634 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/man/0000755000176200001440000000000013650040574012157 5ustar liggesusersrneos/man/rpc.serialize.Rd0000644000176200001440000000163613650031777015233 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/NgetSolverTemplate.Rd0000644000176200001440000000242513650031777016242 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/Nhelp.Rd0000644000176200001440000000171213650031777013522 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/NgetJobInfo.Rd0000644000176200001440000000316613650031777014625 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/NgetIntermediateResultsNonBlocking.Rd0000644000176200001440000000453413650031777021417 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/NprintQueue.Rd0000644000176200001440000000204613650031777014734 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/NeosComm-class.Rd0000644000176200001440000000254112666402323015273 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{http://www.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{http://www.omegahat.net/RCurl}, and\cr libcurl web site: \url{http://curl.haxx.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/NgetJobStatus.Rd0000644000176200001440000000336113650031777015212 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/man/NlistServersInCategory.Rd0000644000176200001440000000250413650031777017104 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/Nping.Rd0000644000176200001440000000212413650031777013525 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/Nversion.Rd0000644000176200001440000000204413650031777014256 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/NgetIntermediateResults.Rd0000644000176200001440000000436613650031777017276 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/NlistAllSolvers.Rd0000644000176200001440000000206313650031777015554 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/NgetFinalResultsNonBlocking.Rd0000644000176200001440000000344313650031777020034 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/NlistCategories.Rd0000644000176200001440000000210513650031777015550 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/xml.rpc.Rd0000644000176200001440000000465513650031777014050 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/NemailHelp.Rd0000644000176200001440000000175013650031777014474 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/NsubmitJob.Rd0000644000176200001440000000225713650031777014535 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/NeosJob-class.Rd0000644000176200001440000000423213650031777015116 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/Nwelcome.Rd0000644000176200001440000000200113650031777014215 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/NgetFinalResults.Rd0000644000176200001440000000335513650037401015700 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/NeosOff-class.Rd0000644000176200001440000000273513650031777015124 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/NeosXml-class.Rd0000644000176200001440000000425213650031777015146 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/NeosAns-class.Rd0000644000176200001440000000257513650031777015135 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/NkillJob.Rd0000644000176200001440000000221513650031777014157 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/CreateXmlString.Rd0000644000176200001440000000315713650031777015534 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/CreateNeosComm.Rd0000644000176200001440000000351313650031777015321 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/XMLRPCServer.Rd0000644000176200001440000000341213650031777014647 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/DESCRIPTION0000644000176200001440000000213213650243122013102 0ustar liggesusersPackage: rneos Version: 0.4-0 Date: 2020-04-22 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: 267 Repository/R-Forge/DateTimeStamp: 2020-04-22 12:56:33 Date/Publication: 2020-04-23 07:40:02 UTC NeedsCompilation: no Packaged: 2020-04-22 13:10:08 UTC; rforge Author: Bernhard Pfaff [aut, cre], Duncan Temple Lang [ctb] (included XMLRPC package, hosted at http://www.omegahat.net/XMLRPC/; BSD license.) rneos/R/0000755000176200001440000000000013650040574011605 5ustar liggesusersrneos/R/NkillJob.R0000644000176200001440000000137713650031777013451 0ustar liggesusers## ## XML-RPC method: killJob() ## NkillJob <- function(obj, killmsg = NULL, convert = TRUE){ if(!(class(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/NgetSolverTemplate.R0000644000176200001440000000136213650031777015523 0ustar liggesusers## ## NEOS: getSolverTemplate ## NgetSolverTemplate <- function(category, solvername, inputMethod, nc = CreateNeosComm()){ if (!(class(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.R0000644000176200001440000002173113650031777012746 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/NlistAllSolvers.R0000644000176200001440000000100113650031777015025 0ustar liggesusers## ## XML-RPC method: listAllSolvers() ## NlistAllSolvers <- function(convert = TRUE, nc = CreateNeosComm()){ if(!(class(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.R0000644000176200001440000000212713650031777013765 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/NgetIntermediateResultsNonBlocking.R0000644000176200001440000000250113650031777020671 0ustar liggesusers## ## XML-RPC method: getIntermediateResultsNonBlocking() ## NgetIntermediateResultsNonBlocking <- function (obj, offset = NULL, convert = TRUE){ if (!(class(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/NlistSolversInCategory.R0000644000176200001440000000163413650031777016375 0ustar liggesusers## ## XML-RPC method: listSolversInCategory() ## NlistSolversInCategory <- function(category, convert = TRUE, nc = CreateNeosComm()){ if (!(class(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/NlistCategories.R0000644000176200001440000000111113650031777015026 0ustar liggesusers## ## XML-RPC method: listCategories() ## NlistCategories <- function(convert = TRUE, nc = CreateNeosComm()){ if(!(class(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/CreateXmlString.R0000644000176200001440000000121211434522117014773 0ustar liggesusers## ## Function: CreateXmlString ## CreateXmlString <- function(neosxml, cdatalist){ if(!(class(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/Nping.R0000644000176200001440000000071213650031777013010 0ustar liggesusers## ## XML-RPC method: ping() ## Nping <- function(convert = TRUE, nc = CreateNeosComm()){ if(!(class(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/NgetFinalResultsNonBlocking.R0000644000176200001440000000152013650031777017310 0ustar liggesusers## ## XML-RPC method: getFinalResultsNonBlocking() ## NgetFinalResultsNonBlocking <- function(obj, convert = TRUE){ if (!(class(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/Nhelp.R0000644000176200001440000000071213650031777013003 0ustar liggesusers## ## XML-RPC method: help() ## Nhelp <- function(convert = TRUE, nc = CreateNeosComm()){ if(!(class(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/show-methods.R0000644000176200001440000000172311546600274014355 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/NgetIntermediateResults.R0000644000176200001440000000240513650031777016550 0ustar liggesusers## ## XML-RPC method: getIntermediateResults ## NgetIntermediateResults <- function (obj, offset = NULL, convert = TRUE){ if (!(class(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/update-methods.R0000644000176200001440000000120311550567145014654 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/NgetFinalResults.R0000644000176200001440000000144413650031777015171 0ustar liggesusers## ## XML-RPC method: getFinalResults() ## NgetFinalResults <- function(obj, convert = TRUE){ if (!(class(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/CreateNeosComm.R0000644000176200001440000000123713030206534014567 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(!(class(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/NprintQueue.R0000644000176200001440000000074213650031777014217 0ustar liggesusers## ## XML-RPC method: printQueue() ## NprintQueue <- function(convert = TRUE, nc = CreateNeosComm()){ if(!(class(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/Nwelcome.R0000644000176200001440000000072613650031777013513 0ustar liggesusers## ## XML-RPC method: welcome() ## Nwelcome <- function(convert = TRUE, nc = CreateNeosComm()){ if(!(class(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/NemailHelp.R0000644000176200001440000000073613650031777013761 0ustar liggesusers## ## XML-RPC method: emailHelp() ## NemailHelp <- function(convert = TRUE, nc = CreateNeosComm()){ if(!(class(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/Nversion.R0000644000176200001440000000072613650031777013545 0ustar liggesusers## ## XML-RPC method: version() ## Nversion <- function(convert = TRUE, nc = CreateNeosComm()){ if(!(class(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/NgetJobInfo.R0000644000176200001440000000113713650031777014103 0ustar liggesusers## ## XML-RPC method: getJobInfo() ## NgetJobInfo <- function (obj, convert = TRUE){ if (!(class(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/NgetJobStatus.R0000644000176200001440000000114413650031777014471 0ustar liggesusers## ## XML-RPC method: getJobStatus() ## NgetJobStatus <- function(obj, convert = TRUE){ if(!(class(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/NsubmitJob.R0000644000176200001440000000131213650031777014006 0ustar liggesusers## ## XML-RPC method: submitJob() ## NsubmitJob <- function(xmlstring, user = "rneos", interface = "", id = 0, nc = CreateNeosComm()){ if(!(class(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/MD50000644000176200001440000000603113650243122011706 0ustar liggesusers3cb818c39050914420cd52ada48514d2 *DESCRIPTION 0189322a3b569f7a75b62044a08d043b *NAMESPACE 8c9c0314b83ddecc248c1946edd9a50b *R/AllClasses.R 94c6055be97ed066b371257f4bf1572b *R/CreateNeosComm.R 76a2878b039efa5deee5e54ffcfb3862 *R/CreateXmlString.R fd317242bac01adcd3951a687085262d *R/NemailHelp.R 6ad1ea965848ef12dc77d41662579daf *R/NgetFinalResults.R 9fe66cb3ba7aa28a63593b162a5ffd19 *R/NgetFinalResultsNonBlocking.R ae9b0dd462b80cad67af1f3118d4ec9b *R/NgetIntermediateResults.R 8a3c1988d70ea7ae8843c0ec26a2464e *R/NgetIntermediateResultsNonBlocking.R 093d8204841d1b4dd9fbc69dce9fd541 *R/NgetJobInfo.R c74a268df6525ccc2e09fb9bdf777393 *R/NgetJobStatus.R ff0fd2e4189e487e42943798bedee214 *R/NgetSolverTemplate.R 578e6310fc77ffe1d4cc0bbd80fdd706 *R/Nhelp.R 70aa5d920b9a6796d8e7f25673b7fb20 *R/NkillJob.R 186fd0287a2685e3cd867f7c6b7e4417 *R/NlistAllSolvers.R 8a05211996ad7f9e934ee021ed5e6c7e *R/NlistCategories.R ba1fb346231c39d33f2a206bd11e4d74 *R/NlistSolversInCategory.R 07ea45d10f50a6a5cffb9128af4a3115 *R/Nping.R 4e147cf6bb7c0633d4037c5687327a4a *R/NprintQueue.R f8b1b00ba0953a5e726438e8630a2fdc *R/NsubmitJob.R c13a6fa4747e4d486d97e26994da6300 *R/Nversion.R 37745d2d610138bcc234e6c611402577 *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 4ff277f19f456507902aadf869ddca68 *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 e443026e4d4a4c0eb20bc1305ea2aa90 *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/inst/0000755000176200001440000000000013650040574012361 5ustar liggesusersrneos/inst/ExGAMS/0000755000176200001440000000000013650040574013405 5ustar liggesusersrneos/inst/ExGAMS/TwoStageStochastic.gms0000644000176200001440000000405711547576307017720 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/0000755000176200001440000000000013650040575013410 5ustar liggesusersrneos/inst/ExAMPL/diet.mod0000644000176200001440000000061211435716663015044 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/inst/ExAMPL/diet.dat0000644000176200001440000000131711435716652015036 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 ;