Skip to content
Snippets Groups Projects
Unverified Commit a22f6ea1 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Ensure slew rate cost function is always a number

parent d9feb511
No related branches found
No related tags found
1 merge request!4Resolve "Add secondary objective function"
...@@ -74,6 +74,7 @@ function (::Type{Trapezoid})(; orientation=nothing, rise_time=nothing, flat_time ...@@ -74,6 +74,7 @@ function (::Type{Trapezoid})(; orientation=nothing, rise_time=nothing, flat_time
get_free_variable.(slew_rate), get_free_variable.(slew_rate),
group group
) )
add_cost_function!(-sum(abs(res.slew_rate)))
else else
res = Trapezoid1D( res = Trapezoid1D(
get_free_variable(rise_time), get_free_variable(rise_time),
...@@ -83,13 +84,13 @@ function (::Type{Trapezoid})(; orientation=nothing, rise_time=nothing, flat_time ...@@ -83,13 +84,13 @@ function (::Type{Trapezoid})(; orientation=nothing, rise_time=nothing, flat_time
group group
) )
apply_simple_constraint!(res.slew_rate, :>=, 0) apply_simple_constraint!(res.slew_rate, :>=, 0)
add_cost_function!(-res.slew_rate)
end end
set_simple_constraints!(res, kwargs) set_simple_constraints!(res, kwargs)
apply_simple_constraint!(res.flat_time, :>=, 0) apply_simple_constraint!(res.flat_time, :>=, 0)
apply_simple_constraint!(res.rise_time, :>=, 0) apply_simple_constraint!(res.rise_time, :>=, 0)
add_cost_function!(-res.slew_rate)
scanner_constraints!(res) scanner_constraints!(res)
return res return res
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment