The model contains binary vector variables named y.var and z.var, continuous vector variable x.var, and scalar (continuous) variables c.var and d.var. After solving the model, I am able to recover the values of w.var via model$get_variable_value(w.var[i]). However, I cannot access the value of d.var or c.var. Neither model$get_variable_value(d.var) nor model$get_variable_value(d.var[i]) works. The first approach (no index variable) produces the error
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'index' in selecting a method for function 'moi_get': no slot of name "variable_index" for this object of class "MOI_scalar_affine_term"
while the second approach (with [i] included) produces the error message
Error in extract_solver_variable_value(private, rlang::enquo(variable_selector), :
no slot of name "arity" for this object of class "MOI_scalar_affine_term"
I notice that the vector variables have class RMPK_variable_list while the scalars are MOI_scalar_affine_term. Is there an undocumented method for accessing values of the scalar terms?
I have a MIP model initialized as follows:
solver <- ROI_optimizer("cplex")
model <- optimization_model(solver)
The model contains binary vector variables named
y.var
andz.var
, continuous vector variablex.var
, and scalar (continuous) variablesc.var
andd.var
. After solving the model, I am able to recover the values ofw.var
viamodel$get_variable_value(w.var[i])
. However, I cannot access the value ofd.var
orc.var
. Neithermodel$get_variable_value(d.var)
normodel$get_variable_value(d.var[i])
works. The first approach (no index variable) produces the errorwhile the second approach (with
[i]
included) produces the error messageI notice that the vector variables have class
RMPK_variable_list
while the scalars areMOI_scalar_affine_term
. Is there an undocumented method for accessing values of the scalar terms?