Error "Problem in parse(text = "script.run(exprs.literal={\ncurrent(s1,p)\"li..: End of file before closing ")" on input line 2" when using " to assign to a changeable parameter.
book
Article ID: KB0080791
calendar_today
Updated On:
Products
Versions
Spotfire NuOpt for S+
All supported versions
Description
The S+NuOpt User's Guide contains incorrect syntax when assigning to a changeable parameter. The following example in the User's Guide, does not work:
> initVal ## a sample model function() { a <- Set(1:10) i <- Element(set = a) p <- Parameter(list(1:10, 1:10), index = i, changeable = T) x <- Variable(list(1:10, rep(30, 10)), index = i) x[i] >= p[i] f <- Objective(minimize) f ~ Sum(-1/(x[i] - 50), i) } > s1 <- System(initVal) ## making a System > sol1 <- solve(s1,f) ## solve the System > current(s1,x) ## result of variable x 1 2 3 4 5 6 7 8 1.000116 2.000001 3.000034 4.000105 5.000166 6.000199 7.000207 8.000199 9 10 9.000184 10.00017 attr(, "indexes"): [1] "i" > current(s1,p)"list(1:10,21:30) ## assign to the changeable Parameter
This fails with an error: Problem in parse(text = "script.run(exprs.literal={\ncurrent(s1,p)\"li..: End of file before closing ")" on input line 2 Use traceback() to see the call stack
Issue/Introduction
Error "Problem in parse(text = "script.run(exprs.literal={\ncurrent(s1,p)\"li..: End of file before closing ")" on input line 2" when using " to assign to a changeable parameter.
Environment
Product: TIBCO Spotfire S+NuOpt
Version: All supported versions
OS: All supported operating systems
--------------------
Resolution
The correct method to assign to a changeable parameter is to use ~ instead of ". For example:
current(s1,p) ~ list(1:10,21:30) ## assign to the changeable Parameter