Skip to content
/ TTRISK Public

TTRISK algorithm for risk averse optimization with tensor trains

License

Notifications You must be signed in to change notification settings

dolgov/TTRISK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TTRISK: Tensor Train Algorithm for Risk Averse Optimization

Algorithms and numerical examples for the TTRISK paper by Harbir Antil, Sergey Dolgov and Akwum Onwunta. These methods approximate the Conditional Value at Risk (CVaR) by using Tensor Train approximations and adaptively smoothed indicator functions to compute expectations over random variables in CVaR.

Installation

These codes require MATLAB (any version above 2016 should be fine) and TT-Toolbox. Numerical experiment scripts (starting with test_) will try to download the TT-Toolbox and add it to the path automatically using a check_tt function. However, if this procedure fails, you need to download and setup the TT-Toolbox and certain quadrature rules yourself before running these codes.

Contents

Numerical tests

Each script will ask interactively to enter certain parameters (grid size, stopping tolerance, etc.). Default values are advised to reproduce the experiments in the paper and/or reduce the running time.

  • test_1d_elliptic.m One-dimensional elliptic PDE example. Fast enough for playing around.
  • test_2d_elliptic_reduced.m 2D elliptic PDE in the reduced-space formulation. Slow.
  • test_2d_elliptic_lagrangian.m 2D elliptic PDE in the Lagrangian (full-space) formulation. Slow.
  • test_SEIR_det.m Deterministic optimization of the SEIR ODE model. Fast.
  • test_SEIR.m CVaR optimization of the SEIR model. Slow.

Algorithms

  • ttrisk.m TTRISK algorithm in the reduced space formulation. Should be used as a first attempt. The model content is defined in the model structure (see examples above how it can be set up) and the forward solution procedures are defined by a g_grad_fun parameter. Examples of those are provided in g_grad_fun_1d.m and g_grad_fun_2d.m for the elliptic PDEs.
  • ttrisk_lagrangian_uzawa.m TTRISK algorithm in the Lagrangian formulation. More difficult and restrictive to model specifications.
  • amen_cross_s.m Stable rank-adaptive AMEn TT-Cross version for building TT approximations. Forked from TT-IRT.

Model solvers and utilities

1D Elliptic PDE
  • g_grad_fun_1d.m Forward solution function for 1D Elliptic PDE example in the reduced-space formulation
2D Elliptic PDE
  • Elliptic_Example_5_setup.m A function to set up the discretization and model for 2D Elliptic PDE.
  • g_grad_fun_2d.m Forward solution function for 2D Elliptic PDE example in the reduced-space formulation.
  • Anonzeros.m Computes a vector of nonzeros of the stiffness matrix on given TT-Cross samples.
  • Assemble_A.m Assembles the stiffness finite element matrix.
  • Assemble_F.m Assembles the finite element right hand side vector.
  • Dirichlet_BC.m Applies the boundary conditions
  • Solve_FEM.m Solves the forward problem.
  • Ex5model.mat 2D Elliptic PDE model structure (can be regenerated by Elliptic_Example_5_setup.m)
  • mesh_coarse.msh Triangular mesh for the 2D domains.
  • plot_nodalfield.m Aux function to plot the finite element solution.
SEIR
  • SEIRcost.m A function to compute the cost function of SEIR model on given samples
  • SEIRFDGrad.m Finite Difference approximation of the gradient of the SEIR cost.
  • SEIRIEuler.m Implicit Euler method to solve the forward SEIR ODE problem.
  • SEIRData/ Historic England data for SEIR model.

Quadratures in random variables

  • check_quadratures.m will check and if necessary download quadrature rules from external repositories. Those are:
  • lgwt.m Legendre-Gauss Quadrature Weights and Nodes.
  • hermite.m Hermite polynomials from SGLib.
  • gauss_hermite_rule.m Gauss-Hermite quadrature rule from SGLib.

If the automatic download fails, you need to download these quadrature rules yourself before using the other codes.

Smoothing functions

  • logsmooth.m Log-sigmoid smoothing function, applied to data elementwise.
  • grad_logsmooth.m First derivative of Log-sigmoid.
  • hess_logsmooth.m Second derivative of Log-sigmoid.

Additional files

  • cvar_localsolve.m Preconditioned solver for reduced KKT systems in the Lagrangian formulation
  • @lrmatrix A class of low-rank matrices for fast Matrix-Vector products with those.
  • lagrange_interpolant.m A function to interpolate a Lagrangian polynomial.
  • parse_parameter.m A function to read parameters from the keyboard.
  • check_tt.m Check/download/add-to-path for TT-Toolbox.

Additional information is available in the comments in the beginning of each file.

About

TTRISK algorithm for risk averse optimization with tensor trains

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages