DOCUMENTATION

  • AIMMS optimization tooling introduction
    • AIMMS Developer & Deployment Platform
    • Comparison with other tools
    • Technical Specifications
    • Solvers
      • Solvers availability
      • Advanced Algorithms for Mathematical Programs
      • AIMMS Outer Approximation (AOA)
      • BARON
      • CBC
      • CONOPT
      • COPT
      • CP Optimizer
      • CPLEX
      • Gurobi
      • IPOPT
      • Knitro
      • MINOS
      • Octeract
      • ODH-CPLEX
      • PATH
      • SNOPT
    • Mathematical Programming
      • Mathematical Programming
      • Linear Programming
      • Mixed Integer Programming
      • Nonlinear Programming
      • Mixed Integer Nonlinear Programming
      • Constraint Programming
      • Other Mathematical Programming Types
  • Function Reference
  • User's Guide
  • Language Reference
  • Modeling Guide
  • webui
  • PRO Platform
    • Introduction to the AIMMS PRO Platform
    • Installation
      • System Requirements
      • Installation and Configuration of the License Server
      • General Architecture
      • Installation of AIMMS PRO on Windows
    • The AIMMS PRO Configurator
      • Configuring the configurator
      • Various sections of the configurator
      • Setting up an AIMMS PRO Cluster
      • Server-side Logging
    • Server Administration
      • AIMMS Application Management
      • AIMMS Version Management
      • User Management
      • Monitoring
      • Configuration
        • AD Settings
        • Retention Settings
        • Portal Customization
        • Tunnels
        • Queue Priorities
        • Log Management
        • Active Data Sessions
        • Seats Management
      • Linking Environments to Active Directory Domains
        • Link to Active Directory for AD Member Servers
        • Link to Active Directory for Non-AD Member Servers
      • SAML Support
      • Tunneling support
      • Commonly Encountered Errors
      • Miscellaneous
    • AIMMS PRO End-User Portal
    • MFA for AIMMS PRO Portal
    • Project Setup
      • Adding PRO Libraries to your Project
      • Basic AIMMS PRO Workflow
      • Conversion Guidelines
      • AIMMS PRO and Data Management
      • Advanced AIMMS PRO Workflows
        • Determining the Application State to Transfer
        • Advanced Usage of pro::DelegateToServer
        • Communication Between client-side and Server-side Sessions
        • Using Messages in Your PRO Applications
        • The PRO Progress Window
        • Using Solver leases instead of DelegateToServer
      • Debugging PRO-enabled Projects
    • AIMMS PRO Java/C# API
  • Cloud Platform
    • Introduction to AIMMS Cloud Platform
    • General Architecture
    • System Requirements
    • Server Administration
      • AIMMS Application Management
      • Activate AIMMS Version
      • User Management
      • Configuration
        • AD Settings
        • Retention Settings
        • Portal Customization
        • Tunnels
        • Queue Priorities
        • AIMMS Cloud Database and VPN Configuration
        • Active Data Sessions
        • Seats Management
      • Linking Environments to Active Directory Domains
        • Link to Active Directory for AD Member Servers
        • Link to Active Directory for Non-AD Member Servers
      • SAML Support
      • Tunneling support
      • Commonly Encountered Errors
      • Miscellaneous
    • AIMMS PRO End-User Portal
    • MFA for AIMMS PRO Portal
    • Project Setup
      • Adding PRO Libraries to your Project
      • Basic AIMMS PRO Workflow
      • Conversion Guidelines
      • AIMMS PRO and Data Management
      • Advanced AIMMS PRO Workflows
        • Determining the Application State to Transfer
        • Advanced Usage of pro::DelegateToServer
        • Communication Between client-side and Server-side Sessions
        • Using Messages in Your PRO Applications
        • The PRO Progress Window
        • Using Solver leases instead of DelegateToServer
      • Debugging PRO-enabled Projects
    • Gurobi Support on AIMMS Cloud Platform
    • Getting the latest AIMMS Releases on AIMMS Cloud Platform
    • AIMMS PRO REST API
    • Launching Python, R and other services
    • Running Tasks
    • Privacy Statement
    • Managing Sessions
  • Data integration with AIMMS
  • Library Repository
    • Getting Started with AIMMS Library Repositories
    • AIMMSXL Library
      • Using the AIMMSXL Library
      • Example
      • AIMMSXL Documentation
      • AIMMSXL Library Release Notes
    • CDM Library
      • Introduction
      • Installing AIMMS CDM
      • Configuring your model for CDM
      • Dealing with external and derived data
      • Day-to-day CDM operations
      • Callbacks and hooks provided by CDM
      • CDM Authentication and Authorization
      • CDM implementation details
      • Low-level CDM API
      • CDM Library Release Notes
    • Data Exchange Library
      • Using the Data Exchange library for communicating data
      • Data Exchange Mappings
      • Standard Data Exchange formats
      • Application Database
      • Consuming REST APIs
      • Generating API client code from an OpenAPI specification
      • Providing REST APIs
      • Azure Data Lake Storage
      • Data warehouses
      • Methods provided by the Data Exchange library
      • DEX Troubleshooting
      • DataExchange Library Release Notes
    • DataLink Library
      • What is DataLink?
      • The Data Map
      • Read and Write
      • Source Information
      • Data Map Automation
      • Tips and Tricks
      • Providers
      • Examples
      • DataLink Library Release Notes
    • Email Client Library
      • Introduction
      • Email Client API
      • EmailClient Library Release Notes
    • Forecasting Library
      • Introduction
      • Notational Conventions
        • Simple Linear Regression
        • Time Series Forecasting
      • Functions
        • forecasting::ExponentialSmoothing
        • forecasting::ExponentialSmoothingTune
        • forecasting::ExponentialSmoothingTrend
        • forecasting::ExponentialSmoothingTrendTune
        • forecasting::ExponentialSmoothingTrendSeasonality
        • forecasting::ExponentialSmoothingTrendSeasonalityTune
        • forecasting::MovingAverage
        • forecasting::WeightedMovingAverage
        • forecasting::SimpleLinearRegression
    • GuardServerSession Library
      • Introduction
      • Error and Profiling Results as Data
      • The GSS End User interface for end-users
      • The GSS User Interface for specialists
      • The action log
      • Investigate state solver session
      • Integrate GuardServerSession library with your AIMMS Application
      • Install GSS interface for end-users
      • Install UI of GuardServerSession Library
      • Install UI Request manager
      • Install UI Inspect Running Solver Sessions
      • GuardServerSession Library Release Notes
    • HTTP Client Library
      • Introduction
      • What is HTTP?
      • Using the HTTP Client
      • HTTP Client API
      • HTTPClient Library Release Notes
    • RLink Library
      • Setting up RLink
      • Using RLink
      • Iris Example
      • RLink Library Release Notes
    • Snowflake Library
      • Introduction
      • Snowflake API
      • Snowflake Library Release Notes
    • Unit Test Library
      • Creating unit test suites
      • Running test suites
      • Automated testing
      • AIMMSUnitTest Library Release Notes
      • New Features and Bug Fixes
  • Aimms Network License Server
    • Introduction
    • Linux Setup
    • AIMMS Network License Server Release Notes
  • AIMMS Information Security
  • AIMMS Release Notes
  • AIMMS PRO Release Notes
  • AIMMS Product Lifecycle
AIMMS Documentation
AIMMS Logo
  • Documentation »
  • Library Repository »
  • RLink Library »
  • Setting up RLink
  • Edit on Github
Help & feedback

Table Of Contents
  • Setting up RLink
    • Requirements and responsibilities
    • Installation
    • R-packages on the AIMMS cloud

Setting up RLink

In order to run RLink certain conditions should hold. We will explain how these conditions can be met and who is responsible for it.

Requirements and responsibilities

RLink requires the following to be installed on the system:

  • R (version 3.0.0 or newer)

  • Rcpp (version 0.12.9 or newer)

  • DataLink (version 1.0.1.3 or newer)

  • aimms (contained in RLink)

Note

The latest R version that is compatible with RLink is 3.6.3

The R package called aimms (lower case) contains the functions SetData and GetData. In R they are in the namespace aimms because of the package name. In this way we can do aimms::SetData and aimms::GetData in R, so the name makes sense. Still it may be confusing with AIMMS the program or AIMMS the language. To avoid confusion, throughout this manual we will use aimms (lower case) to refer to the R package and R namespace.

Rlink can be run in AIMMS development platform, in AIMMS PRO and in AIMMS Cloud.

For the AIMMS development platform, the AIMMS PRO/Cloud Client side and the AIMMS PRO Server side make sure that R and Rcpp are installed on the machine. The developer has to make sure RLink and DataLink are added to the project. The R package aimms can be installed on the machine as well. Alternatively the developer can call:

rlink::CheckAndInstallPackage()

in the PostMainInitialization procedure of the project. In this way the aimms package that is included in RLink will be installed.

For the AIMMS Cloud Server side R and Rcpp are already provided. If RLink and DataLink are added to the project, then they will be automatically fetched from the library repository. The R package aimms is not provided on the AIMMS Cloud Server, to make sure that it is always current with the latest version of RLink. To publish an app that uses RLink, the developer must call:

rlink::CheckAndInstallPackage()

in the PostMainInitialization procedure of the project, so that the aimms package is always being fetched from the RLink library and installed.

Installation

Besides AIMMS the following may need to be installed:

  • R (Executable)

  • Rcpp (R Package)

  • RLink (AIMMS Library)

  • DataLink (AIMMS Library)

  • aimms (R Package)

R and Rcpp

R is not just a software environment for statistical computing. It is a community with a foundation that maintains the software as an open source project. Out of respect to this community it feels inappropriate to bundle the binaries of R with RLink. For this reason R has to be downloaded and installed independently of RLink.

R can be obtained from “The Comprehensive R Archive Network”:https://cran.r-project.org/. Here you can choose the binaries you need to install R on your system, or even build it from source. Also extensive documentation is available, i.e.: “R Installation and Administration”:https://cran.r-project.org/doc/manuals/r-release/R-admin.html .

Information of Rcpp can be found “here”:https://cran.r-project.org/web/packages/Rcpp/index.html. Rcpp can be installed just like any other R packages from the command line using:

R CMD INSTALL [options] [-l lib] Rcpp

or on windows using Rcmd.exe:

Rcmd.exe INSTALL [options] [-l lib] Rcpp

Alternatively the package can be installed inside R using:

install.packages("Rcpp")

It will prompt and ask for a repository if no default repository is specified. Alternatively you can specify a repository, like:

install.packages("Rcpp", repos='http://cran.us.r-project.org')

Important

The function install.packages is a normal R function and can also be called in RLink. The AIMMS Cloud Server requires the Linux version of the packages and on CRAN they are only provided as source. This means that an app installing a package will always have to download and compile it, every time the app is launched, adding considerable to the startup time.

RLink and DataLink

RLink and DataLink are made available by AIMMS in the library repository. In order to include these libraries, in AIMMS go to the menu File / Library Manager….

In the library manager the panel on the left shows the library configuration of the current project. On the right there are choices to add a library. Click option Add Library from Repository… and a new window opens. On the left there is a list of Available Libraries/Versions. Clicking the name shows details about the latest version of the library. Clicking the AIMMS logo in front of it also shows previous versions.

By clicking on _RLink_ in the left panel you’ll see its dependency on DataLink with the required version. The Library Manager is smart enough to add DataLink to the list when you click the “_Select_” button at the bottom. The window closes and we are back in the window showing the library structure. The two libraries, RLink and DataLink, are now visible in the left pane, that shows the “new” library configuration of the project. By clicking “_OK_” the project is updated and the RLink and DataLink libraries are added to the project.

When publishing in our cloud, the RLink and DataLink libraries don’t have to be included in the aimmspack. The .aimms file of the project contains all information needed for fetching these libraries from the repository, and that will happen automatically in the cloud.

R package aimms

The aimms package is included in RLink. In this way RLink and the aimms package can be developed further, and the most recent version of aimms can be released together with newer versions of RLink.

It is possible to install aimms at a location that is in the .libPath of R. This is the directory list used by R to find installed packages. In that case RLink can call R and R can find and use the aimms package.

To install the aimms package locally we first need to know where the package is. To do this open an AIMMS project for which library RLink is added. The libraries from the repository typically get installed in a writable temp directory. Go to library RLink and look at the data of string parameter rlink::LIBRARY_ROOT.

Open R and at the prompt you can use setwd to change the current working directory. Here we copy the string from rlink::LIBRARY_ROOT between quotes as argument in setwd. It will look something like this:

setwd("C:\\Users\\alice\\ ... \\vc120_x64_Release\\")

Here ... is used because the string can be quite long. On windows we also have to “double” the backslashes otherwise R will complain.

Now the current working directory of R is the location where RLink is installed. You can check this using getwd(). The package aimms is located in directory R, so we have to do

setwd("R")

Doing

list.files()

will show the files in the current directory. One of the files looks like aimms_0.1.0.zip. The numbers can be different, but this is the aimms package that has to be installed. Next we have to decided where we want to install the aimms package. In R you can do

.libPaths()

to show the default locations where R looks for packages. To pick a single location we can simply select one. i.e.

.libPaths()[1]

will pick the first location from .libPaths(). Now we are ready to install the package. We can do:

install.packages("aimms_0.1.0.zip",lib=.libPaths()[1],repos=NULL,type="source")

Where we passed the arguments:

  • The name of the package: aimms_0.1.0.zip, which is the file we found in the R directory.

  • The location where we want to install it: .libPaths()[1], which is the first directory in the search path of R.

  • Using repos=NULL, which says that we want to load it from disk rather then a repository.

  • The type="source" indicates that there is no C/C++ code that needs to be compiled.

For situations where the AIMMS developer does not have control over the R installation (AIMMS PRO server or the AIMMS Cloud), the following function is available:

rlink::CheckAndInstallPackage()

This functions calls the R script cniaimms.r that is located in the R directory of RLink. It will add this directory to the .libPath and installs the aimms package here if no aimms package is found.

The function rlink::CheckAndInstallPackage should be called in the MainInitialization of the project. The first time the project is run the installation may happen. In all subsequent runs of the project no installation is needed, but the R directory still should be added to the .libPath.

R-packages on the AIMMS cloud

Package

Version

Package

Version

Package

Version

assertthat

0.2.1

httpuv

1.5.2

readr

1.3.1

backports

1.1.5

httr

1.4.1

readxl

1.3.1

base

3.4.4

iterators

1.0.12

rematch

1.0.1

base64enc

0.1-3

jsonlite

1.6

reshape2

1.4.3

BH

1.69.0-1

KernSmooth

2.23-15

rgdal

1.4-4

bit

1.1-14

labeling

0.3

rgeos

0.5-2

bit64

0.9-7

later

1.0.0

rio

0.5.16

boot

1.3-20

lattice

0.20-38

rlang

0.4.0

boxr

0.3.4

lazyeval

0.2.2

rpart

4.1-15

brew

1.0-6

leafem

0.0.1

satellite

1.0.1

callr

3.3.2

leaflet

2.0.2

scales

1.0.0

cellranger

1.1.0

leafpop

0.0.1

scclust

0.2.2

class

7.3-15

leaps

3

sf

0.8-0

classInt

0.4-2

littler

0.3.3

shiny

1.4.0

cli

1.1.0

lmtest

0.9-37

sourcetools

0.1.7

clipr

0.7.0

locfit

1.5-9.1

sp

1.3-1

cluster

2.0.7-1

magrittr

1.5

spatial

7.3-11

codetools

0.2-16

maptools

0.9-8

splines

3.4.4

colorspace

1.4-1

mapview

2.7.0

stats

3.4.4

compiler

3.4.4

markdown

1.1

stats4

3.4.4

crayon

1.3.4

MASS

7.3-51.1

stringi

1.3.1

crosstalk

1.0.0

Matrix

1.2-16

stringr

1.4.0

curl

4.2

methods

3.4.4

survival

2.44-1.1

data.table

1.12.6

mgcv

1.8-28

svglite

1.2.2

datasets

3.4.4

mime

0.7

sys

3.3

DBI

1.0.0

munsell

0.5.0

systemfonts

0.1.1

digest

0.6.21

nlme

3.1-137

tcltk

3.4.4

distances

0.1.8

nnet

7.3-12

tibble

2.1.3

docopt

0.6.1

openssl

1.4.1

tidyselect

0.2.5

dplyr

0.8.3

openxlsx

4.1.0.1

timeDate

3043.102

e1071

1.7-2

parallel

3.4.4

tools

3.4.4

ellipsis

0.3.0

pillar

1.4.2

TSA

1.2

fansi

0.4.0

pkgconfig

2.0.3

tseries

0.10-47

fastmap

1.0.1

plogr

0.2.0

TTR

0.23-5

forcats

0.4.0

plyr

1.8.4

units

0.6-5

foreach

1.4.7

png

0.1-7

urca

1.3-0

forecast

8.9

prettyunits

1.0.2

utf8

1.1.4

foreign

0.8-70

processx

3.4.1

utils

3.4.4

fracdiff

1.4-2

progress

1.2.2

uuid

0.1-2

gdalUtils

2.0.1.14

promises

1.1.0

vctrs

0.2.0

gdtools

0.2.1

ps

1.3.0

viridis

0.5.1

ggplot2

3.2.1

purrr

0.3.3

viridisLite

0.3.0

glue

1.3.0

quadprog

1.5-7

webshot

0.5.1

graphics

3.4.4

quantmod

0.4-15

withr

2.1.2

grDevices

3.4.4

R.methodsS3

1.7.1

xfun

0.1

grid

3.4.4

R.oo

1.22.0

xtable

1.8-4

gridExtra

2.3

R.utils

2.9.0

xts

0.11-2

gtable

0.3.0

R6

2.4.0

yaml

2.2.0

haven

2.1.1

raster

3.0-7

zeallot

0.1.0

hms

0.5.1

RColorBrewer

1.1-2

zip

2.0.4

htmltools

0.4.0

Rcpp

1.0.2

zoo

1.8-6

Last updated: Nov 25, 2022

Help & Feedback

Docs

Edit this page to fix an error or add an improvement in a pull request
Create an issue to suggest an improvement to this page

Product

Create a topic if there's something you don't like about this feature
Propose functionality by submitting a feature request

Support

Not what you where looking for? Search the docs

Remember we also have Community support

Still having trouble ? Reach out to us


Next Previous

AIMMS
AIMMS COMMUNITY
AIMMS DOCS
DISCLAIMER
PRIVACY STATEMENT
© 1989 - 2025 AIMMS B.V.