Skip to content

Commit

Permalink
apply JuliaFormatter
Browse files Browse the repository at this point in the history
  • Loading branch information
dmalyuta committed Jan 19, 2022
1 parent eb71ba4 commit 169426b
Show file tree
Hide file tree
Showing 66 changed files with 7,416 additions and 5,731 deletions.
120 changes: 98 additions & 22 deletions src/SCPToolbox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ export Homotopy
# Sequential convex programming solvers
export SCvx, GuSTO, PTR
export SCPSolution, SCPHistory, SCPParameters
export SCP_SOLVED, SCP_FAILED, SCP_SCALING_FAILED, SCP_GUESS_PROJECTION_FAILED,
SCP_BAD_ARGUMENT, SCP_BAD_PROBLEM
export SCP_SOLVED,
SCP_FAILED,
SCP_SCALING_FAILED,
SCP_GUESS_PROJECTION_FAILED,
SCP_BAD_ARGUMENT,
SCP_BAD_PROBLEM

# Optimization problem (low-level conic form parser)
export ConicProgram
Expand All @@ -47,23 +51,55 @@ export solve!

# Trajectory problem high-level definition
export TrajectoryProblem
export problem_set_dims!, problem_advise_scale!, problem_set_integration_action!,
problem_set_guess!, problem_set_callback!, problem_set_terminal_cost!,
problem_set_running_cost!, problem_set_dynamics!, problem_set_X!, problem_set_U!,
problem_set_s!, problem_set_bc!, problem_add_table_column!, define_conic_constraint!
export problem_set_dims!,
problem_advise_scale!,
problem_set_integration_action!,
problem_set_guess!,
problem_set_callback!,
problem_set_terminal_cost!,
problem_set_running_cost!,
problem_set_dynamics!,
problem_set_X!,
problem_set_U!,
problem_set_s!,
problem_set_bc!,
problem_add_table_column!,
define_conic_constraint!
export FOH, IMPULSE

# Computational functions
export rk4
export linterp, zohinterp, diracinterp, straightline_interpolate, logsumexp, or, squeeze,
convert_units, golden, c2d, trapz, homtransf, hominv, homdisp, homrot
export linterp,
zohinterp,
diracinterp,
straightline_interpolate,
logsumexp,
or,
squeeze,
convert_units,
golden,
c2d,
trapz,
homtransf,
hominv,
homdisp,
homrot
export rpy, slerp_interpolate, Log, skew, rotate, ddq
export sample

# Plotting and printing
export plot_timeseries_bound!, plot_ellipsoids!, plot_prisms!,
plot_convergence, setup_axis!, generate_colormap, rgb, rgb2pyplot,
set_axis_equal, create_figure, save_figure, darken_color
export plot_timeseries_bound!,
plot_ellipsoids!,
plot_prisms!,
plot_convergence,
setup_axis!,
generate_colormap,
rgb,
rgb2pyplot,
set_axis_equal,
create_figure,
save_figure,
darken_color
export test_heading
export Yellow, Red, Blue, DarkBlue, Green

Expand All @@ -78,14 +114,38 @@ import .Utils: Hyperrectangle
const RealValue = Utils.Types.RealTypes

import .Utils: rk4
import .Utils: linterp, zohinterp, diracinterp, straightline_interpolate, logsumexp,
or, squeeze, convert_units, golden, c2d, trapz, homtransf, hominv, homdisp, homrot
import .Utils:
linterp,
zohinterp,
diracinterp,
straightline_interpolate,
logsumexp,
or,
squeeze,
convert_units,
golden,
c2d,
trapz,
homtransf,
hominv,
homdisp,
homrot
import .Utils: ContinuousTimeTrajectory, sample
import .Utils: Homotopy

import .Utils: plot_timeseries_bound!, plot_ellipsoids!, plot_prisms!,
plot_convergence, setup_axis!, generate_colormap, rgb, rgb2pyplot,
set_axis_equal, create_figure, save_figure, darken_color
import .Utils:
plot_timeseries_bound!,
plot_ellipsoids!,
plot_prisms!,
plot_convergence,
setup_axis!,
generate_colormap,
rgb,
rgb2pyplot,
set_axis_equal,
create_figure,
save_figure,
darken_color
import .Utils: test_heading
import .Utils: Yellow, Red, Blue, DarkBlue, Green

Expand All @@ -100,17 +160,33 @@ import .Parser: solve!
### Trajectory problem definition

import .Parser: TrajectoryProblem
import .Parser: problem_set_dims!, problem_advise_scale!, problem_set_integration_action!,
problem_set_guess!, problem_set_callback!, problem_set_terminal_cost!,
problem_set_running_cost!, problem_set_dynamics!, problem_set_X!, problem_set_U!,
problem_set_s!, problem_set_bc!, problem_add_table_column!, define_conic_constraint!
import .Parser:
problem_set_dims!,
problem_advise_scale!,
problem_set_integration_action!,
problem_set_guess!,
problem_set_callback!,
problem_set_terminal_cost!,
problem_set_running_cost!,
problem_set_dynamics!,
problem_set_X!,
problem_set_U!,
problem_set_s!,
problem_set_bc!,
problem_add_table_column!,
define_conic_constraint!
import .Parser: FOH, IMPULSE

### Sequential convex programming solvers

import .Solvers: SCvx, GuSTO, PTR
import .Solvers: SCPSolution, SCPHistory, SCPParameters
import .Solvers: SCP_SOLVED, SCP_FAILED, SCP_SCALING_FAILED, SCP_GUESS_PROJECTION_FAILED,
SCP_BAD_ARGUMENT, SCP_BAD_PROBLEM
import .Solvers:
SCP_SOLVED,
SCP_FAILED,
SCP_SCALING_FAILED,
SCP_GUESS_PROJECTION_FAILED,
SCP_BAD_ARGUMENT,
SCP_BAD_PROBLEM

end
15 changes: 8 additions & 7 deletions src/parser/argument.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export value, name
# Specialize argument blocks to variables and parameters
const VariableArgumentBlock = ArgumentBlock{AtomicVariable}
const ConstantArgumentBlock = ArgumentBlock{AtomicConstant}
const ArgumentBlocks = Vector{ArgumentBlock{T}} where T
const ArgumentBlocks = Vector{ArgumentBlock{T}} where {T}

# ..:: Data structures ::..

Expand Down Expand Up @@ -80,13 +80,14 @@ Iterate over the blocks of an argument.
# Returns
The current block and the next state, or `nothing` if at the end.
"""
function Base.iterate(arg::Argument,
state::Int=1)::Union{
Nothing, Tuple{ArgumentBlock, Int}}
function Base.iterate(
arg::Argument,
state::Int = 1,
)::Union{Nothing,Tuple{ArgumentBlock,Int}}
if state > length(arg)
return nothing
else
return arg.blocks[state], state+1
return arg.blocks[state], state + 1
end
end

Expand All @@ -110,8 +111,8 @@ Append a new block to the end of the argument.
function Base.push!(arg::Argument, name::String, shape::Int...)::ArgumentBlock

# Create the new block
blid = length(arg)+1
elid1 = numel(arg)+1
blid = length(arg) + 1
elid1 = numel(arg) + 1
block = ArgumentBlock(arg, shape, blid, elid1, name)

# Update the arguemnt
Expand Down
Loading

0 comments on commit 169426b

Please sign in to comment.