GithubHelp home page GithubHelp logo

altro.jl's Introduction

CI codecov

Altro.jl

Implementation of the Augmented Lagrangian TRajectory Optimizer (ALTRO) solver, a very fast solver for constrained trajectory optimization problems. ALTRO uses iterative LQR (iLQR) with an augmented Lagrangian framework and can solve problems with nonlinear inequality and equality path constraints and nonlinear dynamics. The key features of the ALTRO solver are:

  • General nonlinear cost functions, including minimum time problems
  • General nonlinear state and input constraints
  • Infeasible state initialization
  • Square-root methods for improved numerical conditioning
  • Active-set projection method for solution polishing

Altro.jl solves trajectory optimization problems set up using TrajectoryOptimization.jl.

For details on the solver, see the original conference paper or related tutorial.

Simple Example

See examples/quickstart.jl for a simple example of solving the canonical cartpole problem with Altro.jl.

Solver Statistics

ALTRO logs intermediate values during the course of the solve. These values are all stored in the SolverStats type, accessible via solver.stats or Altro.stats(solver). This currently stores the following information:

Field Description
iterations Total number of iterations
iterations_outer Number of outer loop (Augmented Lagrangian) iterations
iterations_pn Number of projected newton iterations
iteration Vector of iteration number
iteration_outer Vector of outer loop iteration number
cost Vector of costs
dJ Change in cost
c_max Maximum constrained violation
gradient Approximation of dual optimality residual (2-norm of gradient of the Lagrangian)
penalty_max Maximum penalty parameter

The other fields are used interally by the solver and not important to the end user.

The vector fields of the SolverStats type can be converted to a dictionary via Dict(stats::SolverStats), which can then be cast into a tabular format such as DataFrame from DataFrames.jl.

Solver Options

Like any nonlinear programming solver, ALTRO comes with a host of solver options. While the default values yield good/acceptable performance on many problem, extra performance can always be gained by tuning these parameters. In practice, there are only a few parameters that need to be tuned. See the AL-iLQR Tutorial for more details.

The ALTRO solver is actually a composition of several different solvers with their own options. Early versions of Altro.jl required the user to manipulate a rather confusing heirarchy of solver options. Newer version of Altro.jl provide a single options struct that dramatically simplifies setting and working with the solver parameters.

Setting Solver Options

Solver options can be specified when the solver is instantiated or afterwards using the set_options! command. If we have a previously constructed Problem, this looks like

solver = ALTROSolver(prob, verbose=1, constraint_tolerance=1e-3, square_root=true)

Alternatively, solver options can be set using the set_options! command after the solver has been instantiated:

set_options!(solver, reset_duals=true, penalty_initial=100, penalty_scaling=50)

Querying Solver Options

The options struct for the ALTROSolver can be directly accessed via solver.opts or Altro.options(solver). Options can be directly set or retrieved from this mutable struct.

List of Options

For convenience, we provide a list of options in the ALTRO solver, along with a brief description:

Option Description Importance Default
constraint_tolerance All constraint violations must be below this value. High 1e-6
cost_tolerance The difference in costs between subsequent iterations must be below this value. High 1e-4
cost_tolerance_intermediate Cost tolerance for intermediate iLQR solves. Can speed up convergence by increase to 10-100x the cost_tolerance. Med 1e-4
gradient_tolerance Tolerance for 2-norm of primal optimality residual. Low 1
gradient_tolerance_intermediate Primal optimality residual tolerance for intermediate solve. Low 10
iterations_inner Max iLQR iterations per iLQR solve. Med 300
dJ_counter_limit Max number of times iLQR can fail to make progress before exiting. Low 10
square_root Enable the square root backward pass for improved numerical conditioning (WIP). Med false
line_search_lower_bound Lower bound for Armijo line search. Low 1e-8
line_search_upper_bound Upper bound for Armijo line search. Low 10.0
iterations_linesearch Max number of backtracking steps in iLQR line search Low 20
max_cost_value Maximum cost value. Will terminate solve if cost exeeds this limit. Low 1e8
max_state_value Maximum value of any state. Will terminate solve if any state exeeds this limit. Low 1e8
max_control_value Maximum value of any control. Will terminate solve if any control exeeds this limit. Low 1e8
static_bp Enable the static backward pass. Only advisable for state + control dimensions < 20. Turn off if compile time is exessive. Low true
save_S Save the intermediate cost-to-go expansions in the iLQR backward pass. Low false
bp_reg Enable iLQR backward pass regularization (WIP). Med false
bp_reg_initial Initial backward pass regularization. Low 0.0
bp_reg_increase_factor Multiplicative factor by which the regularization is increased. Low 1.6
bp_reg_max Maximum regularization. Low 1e8
bp_reg_min Minimum regularization. Low 1e-8
bp_reg_fp Amount of regularization added when foward pass fails Low 10.0
penalty_initial Initial penalty term on all constraints. Set low if the unconstrained solution is a good approximate solution to the constrained problem, and high if the initial guess provided is a good esimate. If NaN uses values in each constraint param, which defaults to 1.0. Very High NaN
penalty_scaling Multiplicative factor by which the penalty is increased each outer loop iteration. High values can speed up convergence but quickly lead to poor numerical conditioning on difficult problems. Start with small values and then increase.If NaN defaults to 10 in the per-constraint parameter. Very High NaN
iterations_outer Max number of outer loop (Augmented Lagrangian) iterations. Med 30
verbose_pn Turn on printing in the projected newton solver. Low false
n_steps Maximum number of projected newton steps. Low 2
projected_newton_tolerance Constraint tolerance at which the solver will exit the Augmented Lagrangian solve and start the projected newton solve. Typically sqrt(constraint_tolerance) High 1e-3
active_set_tolerance_pn Tolerance for the active constraints during the projected newton solve. Includes some barely satisfied constraints into the active set. Can fix singularity issues during projected newton solve. Med 1e-3
multiplier_projected Enable updating the dual variables during the projected newton solve. Also provides a calculation of the optimality residual in the stats output. Low true
ρ_chol Regularization on the projected newton Cholesky solve. Med 1e-2
ρ_primal Regularization on the primal variables during the projected newton solve. Required if cost Hessian is positive-semi-definite. Low 1e-8
ρ_dual Regularization on the dual variables during the multiplier projection step. Low 1e-8
r_threshold Improvement ratio threshold for projected newton solve. If the ratio of constraint violations between subsequent steps is less than this value, it will update the cost and constraint expansions Low 1.1
projected_newton Enable projected newton solve. If enabled, projected_newton_solve is used as the constraint_tolerance for the AL-iLQR solve. Projected newton solve is still a WIP and not very robust. High true
iterations Max number of total iterations (iLQR + projected newton). Med 1000
verbose Controls output during solve. 0 is zero output, 1 outputs AL iterations, and 2 outputs both AL and iLQR iterations Low 0

altro.jl's People

Contributors

bjack205 avatar github-actions[bot] avatar janbruedigam avatar thowell avatar tpunnoose avatar zacmanchester avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

altro.jl's Issues

model = DubinsCar() ERROR: MethodError: Cannot `convert` an object of type

ERROR: MethodError: Cannot `convert` an object of type FiniteDiff.JacobianCache{Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, UnitRange{Int64}, Nothing, Val{:forward}(), Float64} to an object of type FiniteDiff.JacobianCache{Vector{Float64}, Vector{Float64}, Vector{Float64}, UnitRange{Int64}, Nothing, Val{:forward}(), Float64} Closest candidates are: convert(::Type{T}, ::T) where T at D:\Programs\Julia-1.7.3\share\julia\base\essentials.jl:218 Stacktrace: [1] DubinsCar() @ Main C:\Users\94052\.julia\packages\RobotDynamics\xW4Xp\src\jacobian_gen.jl:763 [2] top-level scope @ d:\Desktop\using Altro.jl:48

When I was following the Get Started Tutorial and running model = DubinsCar(), I encountered this error. It seems like a type converting error. I have tried different versions of Altro, but still get this error. Sorry I'm not familiar with julia, maybe the cause is my miss operation ?

Re-implement multiplier projection in PN solver

Re-implement the multiplier projection in the projected newton solver, making sure it converges to the right duals. Consider copying the multiplier over from the AL solver. Log dual feasibility as the gradient calculation.

status bound constrasints

thank you for offer this package,
i'd like to know, could altro handle status bound constraints ,like ip-ddp?

CircleConstraint ignored

Hi,

Thanks for making all these packages freely available, they're amazing.

I've starting looking through the code to get an idea of how to use it. The idea is to eventually solve a minimum time maneuvering problem with a bicycle model going through the a race track. For now, I've started looking at the various examples/problems scripts changing things to get an idea of how the different pieces fit together. However, I'm having an issue were a set of CircleConstraint items get ignored and the solver's solution goes right through the obstacle.

I use this function to generate the obstacles

function make_constraints(n)
    # constraints
    r = 0.1
    s1 = 10

    circles_escape = NTuple{3,Float64}[]
    for y in range(2,stop=3,length=s1)
        push!(circles_escape,(5.,y,r))
    end

    n_circles_escape = length(circles_escape)

    circles_escape
    x,y,r = collect(zip(circles_escape...))
    x = SVector{n_circles_escape}(x)
    y = SVector{n_circles_escape}(y)
    r = SVector{n_circles_escape}(r)

    return CircleConstraint(n,x,y,r)
end

and this to generate the optimization problem:

function BicycleCar(scenario=:parallel_park, ;N=101)
    # Model
    model = RobotZoo.BicycleModel()
    n,m = size(model)

    opts = SolverOptions(
        iterations=5000,
        penalty_initial=1e3,
    )

    # Scenario
    tf = 1.0
    x0 = SA_F64[2.5, 2.5, 0, 0]
    xf = SA_F64[7.5, 2.5, 0, 0]

    # Objective
    Q = Diagonal(SA[1,1,1e-2,1e-2])
    R = Diagonal(SA[1e0,1e0])
    Qf = Diagonal(SA_F64[1,1,1,1])*100
    obj = LQRObjective(Q,R,Qf,xf,N)

    # Collision constraints
    obs = make_constraints(n)

    # Constraints
    bnd = [ 20, 20, Inf, deg2rad(180)]
    bnd = BoundConstraint(n, m, x_min=-bnd, x_max=bnd)

    cons = ConstraintList(n,m,N)
    add_constraint!(cons, obs, 2:N-1)
    add_constraint!(cons, bnd, 1:N-1)
    add_constraint!(cons, GoalConstraint(xf), N)

    # Problem
    prob = Problem(model, obj, xf, tf, x0=x0, constraints=cons)
    initial_controls!(prob, SA[-0.1,0.0])
    rollout!(prob)

    return prob, opts
end

and then to solve and plot the results:

prob, opts = BicycleCar()
altro = ALTROSolver(prob, opts, infeasible=false)
solve!(altro)

Everything works fine, the solver converges and find a solution that matches the goal and start states, but it ignores the boundaries completely:

SOLVE COMPLETED
 solved using the ALTRO Solver,
 part of the Altro.jl package developed by the REx Lab at Stanford and Carnegie Mellon Universities

  Solve Statistics
    Total Iterations: 16
    Solve Time: 2.929289 (ms)

  Covergence
    Terminal Cost: 17.16872651645381
    Terminal dJ: 8.698917989846677e-5
    Terminal gradient: 9.356137321932584e-5
    Terminal constraint violation: 7.453802197687764e-7
    Solve Status: SOLVE_SUCCEEDED

image

Am I missing something in how to add this kind of constraints to the problem, or is there some option in the solver that I should be changing?

Any help would be greatly appreciated!

status bound constraint

thank you for provide this package,
does it provide a current interface of set a status bound constraint like goal constraint and control constraint?

Functionality for storing intermediate solver states

Hi, thanks for providing these packages! I was working with the Altro solver on some optimization problems, and I was wondering if there was any functionality built in to allow intermediate solver states to be stored and to save intermediate controls, costs, etc. For example, does this support a function to callback each iteration? It would be helpful to be able to visualize the process of solving the optimization problem and to analyze what progress the solver is making at each iteration. Thank you!

Using discrete dynamics throws error

Hi, thanks for making his package available!

When trying to use the solvers with discrete dynamics, an error is thrown.
Complaining it doesn't have RobotDynamics.discrete_dynamics(model::Cartpole,x,u,t) in the line altro = ALTROSolver(prob, opts).

Kind regards.

using TrajectoryOptimization
using RobotDynamics
using StaticArrays
using Altro
using LinearAlgebra

## Setting up the dynamics model
struct Cartpole{T} <: TrajectoryOptimization.AbstractModel
    mc::T
    mp::T
    l::T
    g::T
end

Cartpole() = Cartpole(1.0, 0.2, 0.5, 9.81)

function RobotDynamics.discrete_dynamics(::Type{PassThrough}, model::Cartpole,
        x::StaticVector, u::StaticVector, t, dt)

    mc = model.mc   # mass of the cart in kg (10)
    mp = model.mp   # mass of the pole j(point mass at the end) in kg
    l = model.l     # length of the pole in m
    g = model.g     # gravity m/s^2

    q  = x[SA[1,2]]
    qd = x[SA[3,4]]

    s = sin(q[2])
    c = cos(q[2])

    H = SA[mc+mp mp*l*c; mp*l*c mp*l^2]
    C = SA[0 -mp*qd[2]*l*s; 0 0]
    G = SA[0, mp*g*l*s]
    B = SA[1, 0]

    qdd = -H\(C*qd + G - B*u[1])
    xdot = [qd; qdd]
    return x + xdot * dt  # simple Euler integration
end

RobotDynamics.state_dim(::Cartpole) = 4
RobotDynamics.control_dim(::Cartpole) = 1

## Setting up the objective function
model = Cartpole()
n,m = size(model)
N = 51   # number of knot points
tf = 5.0  # final time
x0 = @SVector [0, 0, 0, 0.]  # initial state
xf = @SVector [0, π, 0, 0.]  # goal state (i.e. swing up)

Q = Diagonal(@SVector fill(0.1,n))
R = Diagonal(@SVector fill(0.1,m))
Qf = Diagonal(@SVector fill(1000.,n))
obj = LQRObjective(Q, R, Qf, xf, N)

## Adding constraints
cons = ConstraintList(n,m,N)
goalcon = GoalConstraint(xf)
add_constraint!(cons, goalcon, N)  # add to the last time step
ubnd = 3
bnd = BoundConstraint(n,m, u_min=-ubnd, u_max=ubnd)
add_constraint!(cons, bnd, 1:N-1)  # add to all but the last time step

## Setting up the problem
prob = Problem(model, obj, xf, tf, constraints=cons, x0=x0, integration=PassThrough)


## Solving the problem
opts = SolverOptions(
    penalty_scaling=10.,
    penalty_initial=1.0
)
altro = ALTROSolver(prob, opts)
@time Altro.solve!(altro)

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

ALconset.jl required

Hi,

The ALconset.jl file was removed from TrajectoryOptimization, to be added to Altro (according to this commit), but no changes were made to Altro and it errors when it tries to import ALconset from TrajectoryOptimization. Is there a commit in progress to fix this?

Error precompiling Altro: LoadError: UndefVarError: QuadraticObjective not defined

When try to precompile Altro (that is run "using Altro") I get the error message below. Do you have any suggestion on what I should do?

┌ Info: Precompiling Altro [5dcf52e5-e2fb-48e0-b826-96f46d2e3e73]
└ @ Base loading.jl:1278
ERROR: LoadError: UndefVarError: QuadraticObjective not defined
Stacktrace:
[1] include(::Function, ::Module, ::String) at .\Base.jl:380
[2] include(::Module, ::String) at .\Base.jl:368
[3] top-level scope at none:2
[4] eval at .\boot.jl:331 [inlined]
[5] eval(::Expr) at .\client.jl:467
[6] top-level scope at .\none:3
in expression starting at C:\Users\esteng.julia\packages\Altro\ZbP1c\src\Altro.jl:29
Failed to precompile Altro [5dcf52e5-e2fb-48e0-b826-96f46d2e3e73] to C:\Users\esteng.julia\compiled\v1.5\Altro\GnnwV_2aMzp.ji.

Stacktrace:
[1] error(::String) at .\error.jl:33
[2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1305
[3] _require(::Base.PkgId) at .\loading.jl:1030
[4] require(::Base.PkgId) at .\loading.jl:928
[5] require(::Module, ::Symbol) at .\loading.jl:923
[6] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091

Installation fails

Hi,
Currently, installing Altro via the package manager is not working. In a new environment, pkg>add Altro leads to an error during compilation (LoadError: UndefVarError: ``QuatRotation`` not defined).
The dependency on Rotations.jl probably causes this error. I see that this is currently being worked on. I think a quick fix in the meantime would be to use RobotDynamics = “=0.4.7” in Project.toml. If [email protected] is used instead of @0.4.8 the compilation error does not occur.
Thanks,
Robert

Query solver success

First of all, thank you for sharing your code for Altro.jl. I am really excited to have a fast pure Julia solver for trajectory opimization.

I set up a simple toy example with TrajectoryOptimizaiton.jl of a RobotZoo.DubinsCar trying to reach the origin (code below).
The run of Altro.solve! reports SOLVE_SUCCEDED. At the same time, however, the terminal constraint violation is quite high and the resulting path does not seem dynamically feasible (see first trajectory below). Since I have the default solver.opts.constraint_tolerance == 1.0e-6, I am surprised that the solver claims that the solve was successful. I guess that the BoundsConstraint that I set above renders the problem infeasible; at least with relaxed bounds yield a more realistic trajectory. (see second trajectory below). Thus, I don't expect ALTRO to be able to solve this problem, I only need to know that it was not able to solve it.

TL;DR How can I query the solution success in the sense of KKT conditions?


import Altro
import Random
import RobotZoo
using LinearAlgebra: Diagonal
using TrajectoryOptimization:
    BoundConstraint, ConstraintList, GoalConstraint, LQRObjective, Problem, add_constraint!
using StaticArrays: SA
using Altro: ALTROSolver
using VegaLite: @vlplot

model = RobotZoo.DubinsCar()
n, m = size(model)
N = 20
tf = 1.0

x0 = SA[1.0, 1.0, 0.0]
xf = SA[0.0, 0.0, 0.0]

Q = Diagonal(SA[1.0, 1.0, 1.0])
R = Diagonal(SA[1.0, 1.0])

objective = LQRObjective(Q, R, Q, xf, N)
constraints = ConstraintList(n, m, N)
add_constraint!(constraints, GoalConstraint(xf), N)
add_constraint!(constraints, BoundConstraint(n, m; u_min = -1, u_max = 1), 1:(N - 1))

problem = Problem(model, objective, xf, tf; x0, constraints)
solver = ALTROSolver(problem)

Altro.solve!(solver)

X = Altro.states(solver)
U = Altro.controls(solver)

[(; x = x[1], y = x[2], heading = x[3]) for x in X] |>
@vlplot(
    width = 800,
    height = 800,
    x = "x:q",
    y = "y:q",
    angle = {"heading:q", scale = {domain = [-pi, pi], range = [270, -90]}}
) +
@vlplot(mark = {:line, point = true}) +
@vlplot(mark = {:point, shape = :wedge, color = :red})

Trajectory for tight bounds on u

SOLVE COMPLETED
 solved using the ALTRO Solver,
 part of the Altro.jl package developed by the REx Lab at Stanford and Carnegie Mellon Universities

  Solve Statistics
    Total Iterations: 41
    Solve Time: 10.220067 (ms)

  Covergence
    Terminal Cost: 1.4219497031315713
    Terminal dJ: -0.00017837842054335695
    Terminal gradient: 2.1440340016395658e-10
    Terminal constraint violation: 0.033280018914020215
    Solve Status: SOLVE_SUCCEEDED

image

Trajectory for relaxed bounds on u (abs(u) <= 10)

  Solve Statistics
    Total Iterations: 27
    Solve Time: 0.819603 (ms)

  Covergence
    Terminal Cost: 4.218872417412097
    Terminal dJ: -2.056174750464379e-7
    Terminal gradient: 0.0023927528035217935
    Terminal constraint violation: 9.743034595527823e-10
    Solve Status: SOLVE_SUCCEEDED

image

minimum time problem

I can't find the minimum time example problem in this repo, could you tell me or provide a minimum time trajectory optimization example.

I have read the article of altro: a time-penalized problem is formulated by modifying the dynamics by adding time step as new state.

However, when I try to formulate such problem, the new state $\tau_k$ always equals to the $\tau_0$ in initial state $x_0$.

Sluggish ALTROSolver function

It was odd that this command takes a long time to execute fully and make the solver object.
I was wondering if there is a way to make this command to be executed faster.
@bjack205
What are the critical factors determining the speed of this command?

Many thanks,

BoundsError when solving trajectory

When I define a trajectory optimization problem and pass it into Altro, the solver ends up throwing a BoundsError. I think it's happening when the solver tries to verify the constraints haven't been violated at the end of the solution. I say this because I played around with it a bit by changing the iterations_outer parameter to make the solver stop before it encountered the bug (it had been consistently crashing at iteration 17, so I set iterations_outer=15), and the bug continued to appear when iterations_outer had been reached. I've included the entire stack trace below, let me know if I can provide any more information:

ERROR: LoadError: BoundsError: attempt to access 693×273 SparseArrays.SparseMatrixCSC{Float64,Int64} at index [StaticArrays.StaticIndexing{SArray{Tuple{14},Int64,1,14}}([680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693]), StaticArrays.StaticIndexing{SArray{Tuple{14},Int64,1,14}}([267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280])]
Stacktrace:
 [1] throw_boundserror(::SparseArrays.SparseMatrixCSC{Float64,Int64}, ::Tuple{StaticArrays.StaticIndexing{SArray{Tuple{14},Int64,1,14}},StaticArrays.StaticIndexing{SArray{Tuple{14},Int64,1,14}}}) at ./abstractarray.jl:541
 [2] checkbounds at ./abstractarray.jl:506 [inlined]
 [3] view at ./subarray.jl:158 [inlined]
 [4] maybeview at ./views.jl:133 [inlined]
 [5] dotview at ./broadcast.jl:1160 [inlined]
 [6] copy_jacobian!(::SparseArrays.SparseMatrixCSC{Float64,Int64}, ::TrajectoryOptimization.ConVal{BoundConstraint{14,14,Float64},MArray{Tuple{14},Float64,1,14},SizedArray{Tuple{14,14},Float64,2,2},SubArray{Float64,2,SizedArray{Tuple{14,14},Float64,2,2},Tuple{Base.Slice{SOneTo{14}},UnitRange{Int64}},true}}, ::Array{SArray{Tuple{14},Int64,1,14},1}, ::Array{SArray{Tuple{7},Int64,1,7},1}, ::Array{SArray{Tuple{7},Int64,1,7},1}) at /home/sam/.julia/packages/Altro/scOHW/src/direct/copy_blocks.jl:59
 [7] copy_jacobians!(::SparseArrays.SparseMatrixCSC{Float64,Int64}, ::Altro.ProjectedNewtonSolver{Float64,7,7,14}) at /home/sam/.julia/packages/Altro/scOHW/src/direct/copy_blocks.jl:102
 [8] copy_jacobians! at /home/sam/.julia/packages/Altro/scOHW/src/direct/pn_methods.jl:249 [inlined]
 [9] solve!(::Altro.ProjectedNewtonSolver{Float64,7,7,14}) at /home/sam/.julia/packages/Altro/scOHW/src/direct/pn_methods.jl:8
 [10] solve!(::ALTROSolver{Float64,iLQRSolver{Float64,RK3,Kuka,Altro.ALObjective{Float64,Objective{GeneralCost{7,7}}},7,7,7,14}}) at /home/sam/.julia/packages/Altro/scOHW/src/altro/altro_solver.jl:99
 [11] main() at /home/sam/comoto/src/comoto.jl:438
 [12] top-level scope at /home/sam/comoto/src/comoto.jl:444
 [13] include(::Function, ::Module, ::String) at ./Base.jl:380
 [14] include(::Module, ::String) at ./Base.jl:368
 [15] exec_options(::Base.JLOptions) at ./client.jl:296
 [16] _start() at ./client.jl:506
in expression starting at /home/sam/comoto/src/comoto.jl:444

add Altro ERROR

I am new to julia, when I tried to add Altro.jl, I got the error as shown below:

(@JuliaPro_v1.5.2-1) pkg> add Altro
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package Rotations [6038ab10]:
Rotations [6038ab10] log:
├─possible versions are: [0.7.2, 0.8.0, 0.9.0-0.9.2, 0.10.0, 0.11.0-0.11.1, 0.12.0-0.12.1, 0.13.0, 1.0.0-1.0.1] or uninstalled
├─restricted to versions * by an explicit requirement, leaving only versions [0.7.2, 0.8.0, 0.9.0-0.9.2, 0.10.0, 0.11.0-0.11.1, 0.12.0-0.12.1, 0.13.0, 1.0.0-1.0.1]
├─restricted by compatibility requirements with Altro [5dcf52e5] to versions: 1.0.0-1.0.1
│ └─Altro [5dcf52e5] log:
│ ├─possible versions are: [0.1.0, 0.2.0] or uninstalled
│ └─restricted to versions * by an explicit requirement, leaving only versions [0.1.0, 0.2.0]
└─restricted by compatibility requirements with RigidBodyDynamics [366cf18f] to versions: [0.7.2, 0.8.0, 0.9.0-0.9.2, 0.10.0, 0.11.0-0.11.1, 0.12.0-0.12.1, 0.13.0] — no versions left
└─RigidBodyDynamics [366cf18f] log:
├─possible versions are: [0.0.1-0.0.6, 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0, 0.6.0-0.6.1, 0.7.0, 0.8.0, 0.9.0, 1.0.0-1.0.2, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 2.0.0, 2.1.0-2.1.1, 2.2.0] or uninstalled
├─restricted to versions * by an explicit requirement, leaving only versions [0.0.1-0.0.6, 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0, 0.6.0-0.6.1, 0.7.0, 0.8.0, 0.9.0, 1.0.0-1.0.2, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 2.0.0, 2.1.0-2.1.1, 2.2.0]
├─restricted by compatibility requirements with MechanismGeometries [931e9471] to versions: [0.5.0, 0.6.0-0.6.1, 0.7.0, 0.8.0, 0.9.0, 1.0.0-1.0.2, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 2.0.0, 2.1.0-2.1.1, 2.2.0]
│ └─MechanismGeometries [931e9471] log:
│ ├─possible versions are: [0.1.0-0.1.2, 0.2.0, 0.3.0, 0.4.0-0.4.1, 0.5.0] or uninstalled
│ └─restricted to versions * by an explicit requirement, leaving only versions [0.1.0-0.1.2, 0.2.0, 0.3.0, 0.4.0-0.4.1, 0.5.0]
├─restricted by compatibility requirements with RigidBodySim [e61f16d8] to versions: [0.6.0-0.6.1, 0.7.0, 0.8.0, 0.9.0, 1.0.0-1.0.2, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 2.0.0, 2.1.0-2.1.1, 2.2.0]
│ └─RigidBodySim [e61f16d8] log:
│ ├─possible versions are: [0.3.0, 1.0.0, 1.1.0, 1.2.0, 1.3.0] or uninstalled
│ └─restricted to versions * by an explicit requirement, leaving only versions [0.3.0, 1.0.0, 1.1.0, 1.2.0, 1.3.0]
└─restricted by compatibility requirements with StaticArrays [90137ffa] to versions: [1.2.0, 1.3.0, 1.4.0, 2.0.0, 2.1.0-2.1.1, 2.2.0] or uninstalled, leaving only versions: [1.2.0, 1.3.0, 1.4.0, 2.0.0, 2.1.0-2.1.1, 2.2.0]
└─StaticArrays [90137ffa] log:
├─possible versions are: [0.8.0-0.8.3, 0.9.0-0.9.2, 0.10.0, 0.10.2-0.10.3, 0.11.0-0.11.1, 0.12.0-0.12.5] or uninstalled
├─restricted to versions * by an explicit requirement, leaving only versions [0.8.0-0.8.3, 0.9.0-0.9.2, 0.10.0, 0.10.2-0.10.3, 0.11.0-0.11.1, 0.12.0-0.12.5]
└─restricted by compatibility requirements with Altro [5dcf52e5] to versions: 0.12.0-0.12.5
└─Altro [5dcf52e5] log: see above

StaticArrays not installed while installing Altro

After installing Altro into a clean environment (adding manually just RobotZoo to run the example), it appears that StaticArrays is not added automatically even though it is stated in Altro's Project.tom, .

(trying) pkg> status
Status `~/ownCloud/julia/pokus2/Project.toml`
  [5dcf52e5] Altro v0.2.0
  [74be38bb] RobotZoo v0.1.2
julia> using StaticArrays
ERROR: ArgumentError: Package StaticArrays not found in current path:
- Run `import Pkg; Pkg.add("StaticArrays")` to install the StaticArrays package.

Stacktrace:
 [1] require(::Module, ::Symbol) at ./loading.jl:893

I am still not quite fluent with Julia's Pkg system. Do I understand it incorrectly that if a package is mentioned in the Project.toml, then it is automatically installed? Here in order to get the Altro example going, I had to add StaticArrays manually.

Including gauge degrees of freedom

Hi!

I'm exploring using ALTRO for quantum dynamics control, as inspired by https://github.com/SchusterLab/rbqoc

I'm wondering if there's anyway to handle gauge degrees of freedom.

For example, we may try to optimize controls that bring us from [1, 0] to [1/sqrt(2), 1/sqrt(2)]. In this case, controls that bring us from [1, 0] to [im/sqrt(2), im/sqrt(2)] would also suffice, as we don't care about global phase for quantum states.

We have a method to deal with it by including a global phase control degree of freedom at each time step. This, however, adds 1000 control variables, if we have 1000 time steps. In reality, we only need one global phase degree of freedom variable between the final state and the target state.

Global phase is one of several gauge degrees of freedom we would like to include, so it would be great to find a scalable solution for this issue.

Is there already something built up to handle this?

If not, one potential solution may be the option to treat the dynamics at the final time step differently, and allow for control variables that only affect that final time step.

Thanks so much!

cc: @bobisnot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.