QuantumCollocation.jl icon indicating copy to clipboard operation
QuantumCollocation.jl copied to clipboard

[Bug]: Objective constructors have bad initial keyword args

Open andgoldschmidt opened this issue 1 year ago • 1 comments

What happened?

function QuadraticSmoothnessRegularizer(;
	name::Symbol=nothing,
	times::AbstractVector{Int}=1:traj.T,
	R::AbstractVector{<:Real}=ones(traj.dims[name]),
	eval_hessian=true
)

and

function QuadraticRegularizer(;
	name::Symbol=nothing,
	times::AbstractVector{Int}=1:traj.T,
	dim::Int=nothing,
	R::AbstractVector{<:Real}=ones(traj.dims[name]),
	values::Union{Nothing,AbstractArray{<:Real}}=nothing,
	eval_hessian=true,
	timestep_symbol=:Δt
)

are an example of the bug. These interfaces are not usually called, but still the interface of these objectives should be adjusted.

Version

stable release

What does this bug affect?

  • [ ] quantum system construction
  • [X] problem setup
  • [ ] problem solution
  • [ ] problem performance
  • [ ] solution analysis
  • [ ] plotting
  • [ ] documentation
  • [ ] tests
  • [ ] other (please specify below)

Other information

No response

andgoldschmidt avatar Jan 24 '24 03:01 andgoldschmidt

For now, the fix should be to set default args to nothing, with their types declared as Unions with nothing so that the asserts print.

andgoldschmidt avatar Jul 03 '24 14:07 andgoldschmidt

Fixed by migration to DirectTrajOpt.jl, #189

andgoldschmidt avatar Apr 15 '25 21:04 andgoldschmidt