Learn R Programming

localsolver (version 2.3)

ls.problem: Create problem instance from model formulated in LSP language.

Description

Creates problem instance from model LSP code passed. Detects functions in model LSP code.

Usage

ls.problem(model.text.lsp, ls.path = NULL)

Arguments

model.text.lsp
text of model formulated in LSP language.
ls.path
path to the LocalSolver executable. Optional argument (NULL by default). If not provided, the LocalSolver will be searched by the system in PATH environment variable.

Value

created ls.problem instance.

Details

Functions detected in model LSP code must contain model function as it main 'workhorse' function of LocalSolver model. They can contain param, display and any other custom functions.

Because localsolver package defines input function based on data passed to ls.solve and output function base on output expressions added to problem instance with add.output.expr these two(input and output) functions cannot occur in model LSP code passed. Passing them will cause appropriate error.

For mode details see LocalSolver LSP language reference manual: http://www.localsolver.com/lspreferencemanual.html.

Examples

Run this code
model.text.lsp <- lsp.model.example('extdata/knapsack.txt')
lsp <- ls.problem(model.text.lsp)

Run the code above in your browser using DataLab