For the sake of writing the code logically within pycollo, would it be possible to assign numerical values to parameter_variables? Such that the user throw in all single value parameters (optimized or not) in the description of the OCP.
Whenever the bound would be set to a single value, the parameter variable should be treated as a variable that has a numerical value assigned through aux data.
Whenever the bound is set to a range [0,1], the parameter variable will be optimized. Just like how an initial value would be handled (either bound or single value)
Whenever auxiliary data is assigned, parameter variables will be treated as a constant numerical value.
What happens now when parameter variable is assigned with aux data:
Minimal Reproduction
problem = pycollo.OptimalControlProblem(
name="Simple Block Slide",
parameter_variables= (m,mu,g)
)
problem.auxiliary_data = {
m: 1,
mu: 1,
g: 1
}
(same error output when removing following two lines)
problem.bounds.parameter_variables = [[1,1.1], [1,1.1], [1,1.1]]
problem.guess.parameter_variables = [1, 1, 1]
Solution
remove "parameter_variables= (m,mu,g)"
Error msg
|
self._initialise_backend() |
|
self.preprocess_user_problem_aux_data() |
|
self.preprocess_user_phase_independent_aux_data() |
|
self.add_aux_data_mapping((backend_sym, ), (backend_eqn, )) |
UnboundLocalError: cannot access local variable 'backend_sym' where it is not associated with a value
For the sake of writing the code logically within pycollo, would it be possible to assign numerical values to parameter_variables? Such that the user throw in all single value parameters (optimized or not) in the description of the OCP.
Whenever the bound would be set to a single value, the parameter variable should be treated as a variable that has a numerical value assigned through aux data.
Whenever the bound is set to a range [0,1], the parameter variable will be optimized. Just like how an initial value would be handled (either bound or single value)
Whenever auxiliary data is assigned, parameter variables will be treated as a constant numerical value.
What happens now when parameter variable is assigned with aux data:
Minimal Reproduction
problem = pycollo.OptimalControlProblem(
name="Simple Block Slide",
parameter_variables= (m,mu,g)
)
problem.auxiliary_data = {
m: 1,
mu: 1,
g: 1
}
(same error output when removing following two lines)
problem.bounds.parameter_variables = [[1,1.1], [1,1.1], [1,1.1]]
problem.guess.parameter_variables = [1, 1, 1]
Solution
remove "parameter_variables= (m,mu,g)"
Error msg
pycollo/pycollo/optimal_control_problem.py
Line 334 in 6e01d6c
pycollo/pycollo/backend.py
Line 76 in 6e01d6c
pycollo/pycollo/backend.py
Line 308 in 6e01d6c
pycollo/pycollo/backend.py
Line 547 in 6e01d6c
UnboundLocalError: cannot access local variable 'backend_sym' where it is not associated with a value