addAttachment: Creates a new attachment.

Description Usage Arguments Value Examples

Description

Creates a new attachment.

Usage

1

Arguments

name

The name of the attachment. If a file is specified, the name can be omitted and the basename of the file is used. If name is a string pointing to a file and file is not specified, the content of the file pointed by name is used as attachment data.

file

The name of the file containing the data for the attachment.

data

The data for the attachment. If data is a list in which names(data) is not empty, the data is first converted to csv.

Value

An attachment object suitable for use with methods of DOcplexcloudClient and DOcplexcloudJob.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Creates an attachment whose content is the content of this file,
# and whose name is "model.lp" (the 3 expressions are equivalent):
a <- addAttachment(file = "/home/joe/models/model.lp")
a <- addAttachment(name = "/home/joe/models/model.lp")
a <- addAttachment("/home/joe/models/model.lp")

# Creates an attachment whose content is the specified file, and
# whose name is "model.lp"
a <- addAttachment(name = "model.lp",
                   file = "/home/joe/models/model_1231.lp")

# Create an attachment whose data is stored in memory
model <- "Minimize
            obj: x + y
          Subject To
          Bounds
            3 <= x <= 17
            2 <= y
          End"
a <- addAttachment(name="model.lp",
                   data=charToRaw(model))
## Not run: 
# Submits and runs the specified model.lp:
job <- client$submitJob(addAttachment("/home/joe/models/model.lp"))

## End(Not run)

IBMDecisionOptimization/DOcplexcloud-R-client documentation built on May 7, 2019, 5:04 a.m.