to_gams: Translate to GAMS

View source: R/roi_to_gams.R

to_gamsR Documentation

Translate to GAMS

Description

Translate a ROI OP to GAMS code. This function can translate optimization problems with linear or quadratic objective and linear or quadratic constraints.

Usage

to_gams(x)

Arguments

x

an ROI object of class OP.

Value

a character string giving the GAMS optimization model.

Examples

library("ROI")
mat <- matrix(c(3, 4, 2, 2, 1, 2, 1, 3, 2), nrow=3, byrow=TRUE)
x <- OP(objective = c(2, 4, 3),
        constraints = L_constraint(L = mat,
                                   dir = c("<=", "<=", "<="),
                                   rhs = c(60, 40, 80)),
        bounds = V_bound(ui = seq_len(3), ub = c(1000, Inf, 1000), nobj = 3),
        maximum = TRUE)
writeLines(to_gams(x))

ROI.plugin.neos documentation built on Nov. 26, 2023, 1:09 a.m.