Skip to content

Instantly share code, notes, and snippets.

#x,f,V are all Expressions
def CheckLyapunov(x, f, V, ball_lb, ball_ub, config):
# ball = ∑xᵢ², lie_derivative_of_V = ∑fᵢ*∂V/∂xᵢ.
ball= Expression(0)
lie_derivative_of_V = Expression(0)
for i in range(len(x)):
ball += x[i]*x[i]
lie_derivative_of_V += f[i]*V.Differentiate(x[i])
ball_in_bound = logical_and(ball_lb*ball_lb <= ball, ball <= ball_ub*ball_ub)
# Constraints: x ∈ Ball → (V(c, x) > 0 ∧ Lie derivative of V <= 0)
@scungao
scungao / problem.sud
Last active September 28, 2017 06:34
run: "python sudoku.py problem.sud"
.27.3....
1......7.
.83.7.24.
.71..5...
.3.....8.
...9..12.
.15.2.49.
.4......8
....1.56.
@scungao
scungao / bench.cpp
Created September 11, 2016 20:03
benchmark generation
#include <iostream>
#include <vector>
#include <assert.h>
#include <chrono>
#include <random>
#include "dreal.h"
using std::chrono::system_clock;
using std::mt19937_64;