Visual Studio Code Printer
Pieter P
This is a simple tool for printing code with line numbers and syntax highlighting.
By default, lines of code that only contain comments with lines (
- Select and copy the code in VSCode
- Paste the code in the “Raw HTML code” field
- Emphasize some lines or add line breaks if you want to (see below)
- Add a title and author to be included with the generated HTML
- Click “Print” to print the code, or copy the generated HTML
Emphasize code
You can use this tool to emphasize certain lines. Other lines will be grayed out.- Add three asterisks (***) before the lines you want to emphasize
- Check the box below
Add page breaks
You can add a page break after a line by adding three dashes (---) at the end of the line.By default, lines of code that only contain comments with lines (
//---
or //===
or //___
) will be replaced by page breaks as well.
Settings
Title: | |
Author: |
Raw HTML code
Formatted HTML code
Result
import alpaqa
# Generate and compile the optimized C code for the problem
prob = alpaqa.generate_and_compile_casadi_problem(cost_function, constr_function)
prob.C.lowerbound = [-1.5, -0.5] # -1.5 <= x <= 1.5
prob.C.upperbound = [1.5, 2.5] # -0.5 <= y <= 2.5
prob.D.lowerbound = [-np.inf, -np.inf] # g_c <= 0
prob.D.upperbound = [0, 0] # g_l <= 0
# Construct a PANOC instance to serve as the inner solver
innersolver = alpaqa.StructuredPANOCLBFGSSolver() # (with default parameters)
# Make an ALM solver with default parameters, using the PANOC solver
solver = alpaqa.ALMSolver(alpaqa.ALMParams(), innersolver)
# Solve the problem for the given parameter value
prob.param = [100.]
x_sol, y_sol, stats = solver(prob)