Description Usage Arguments Details Value Examples
Prepares input and data for LocalSolver, runs the application and parses its output to get resulting values.
1 |
lsp |
problem instance created with
|
data |
named list of data items. Each element of the list should be indexed with the parameter name and should be a number, vector, matrix or array (of dimension 2 or 3) of numbers. The class of the numbers should be either integer (they will be then handled as integer by the LocalSolver) or numeric (LocalSolver will then treat them as elements of class double). |
Result of this function is named list of output expressions
added to the problem (for description of R data structures
form see add.output.expr
). Parameters set
with set.params
are passed to LocalSolver by
means of generation(or modification) of LocalSolver
param
function (see LocalSolver LSP language
reference manual
http://www.localsolver.com/lspreferencemanual.html
for more details).
Make sure you pass integers in data
if you
want them to be ints
in LocalSolver. Otherwise they
will be considered doubles
.
Errors occurred in model LSP code (passed while creating
problem with ls.problem
) are handled: They
cause error containing original error message and error
occurrence context to make it easier to detect potential
errors in model LSP code. All other LocalSolver errors
(e.g. in output expressions) and interaction errors
(between localsolver package and LocalSolver process) are
passed to caller without processing.
named list of all output expression values on best solution found.
1 2 3 4 5 6 | model.text.lsp <- lsp.model.example('extdata/knapsack.txt')
lsp <- ls.problem(model.text.lsp)
lsp <- set.params(lsp, lsTimeLimit=60)
lsp <- add.output.expr(lsp, "x", 4)
data <- list(nbItems=4L, itemWeights=c(1L,2L,3L,4L), itemValues=c(5,6,7,8), knapsackBound=40L)
result <- ls.solve(lsp, data)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.