3. Run Optimisation

Run the program
Requirements:

The package Rcplex needs to be correctly installed.

To understand more about what the data input should look like, please refer to the previous document: input data processing.

# read the saved data
d <- readRDS('d.RData')

Check if the data look like the right format,

# check if the data is correctly loaded
d$cvec
d$Amat
d$bvec
d$Qmat
d$lb
d$ub
d$sense

Once you’re satisfied, run the following code chunk.

library(Rcplex)

# use data from the d list
problem_1 <- Rcplex(cvec = d$cvec, 
                    Amat = d$Amat, 
                    bvec = d$bvec, 
                    Qmat = d$Qmat, 
                    lb = d$lb, 
                    ub = d$ub, 
                    objsense ="min", 
                    sense = d$sense) 

To save the results for the future,

saveRDS(problem_1, file = 'result.RData')