Finite State Abstraction of LTI Systems

prop2part.py — Proposition preserving partition module

Proposition preserving partition module.

class prop2part.PropPreservingPartition(domain=None, num_prop=0, list_region=[], num_regions=0, adj=0, trans=0, list_prop_symbol=None, orig_list_region=None, orig=None, list_subsys=None)[source]

Partition class with following fields

  • domain: the domain we want to partition, type: polytope

  • num_prop: number of propositions

  • list_region: proposition preserving regions, type: list of Region

  • num_regions: length of the above list

  • adj: a matrix showing which regions are adjacent

  • trans: a matrix showing which region is reachable from which region.

    trans[i,j] = 1 means state i is reachable from state j.

  • list_prop_symbol: list of symbols of propositions

  • orig_list_region: original proposition preserving regions

  • orig: list assigning an original proposition preserving region to each

    new region

  • list_subsys: list assigning the subsystem of the picewise affine system that

    is active in that region to each region in ppp

prop2part.prop2part2(state_space, cont_props_dict)[source]

Main function that takes a domain (state_space) and a list of propositions (cont_props), and returns a proposition preserving partition of the state space.

prop2part.prop2partconvex(ppp)[source]

This function takes a proposition preserving partition and generates another proposition preserving partition such that each part in the new partition is a convex polytope

prop2part.pwa_partition(pwa_sys, ppp, abs_tol=1e-05)[source]

This function takes a piecewise affine system pwa_sys and a proposition preserving partition ppp whose domain is a subset of the domain of pwa_sys and returns a refined proposition preserving partition where in each region a unique subsystem of pwa_sys is active.

Modified from Petter Nilsson’s code implementing merge algorithm in Nilsson et al. Temporal Logic Control of Switched Affine Systems with an Application in Fuel Balancing, ACC 2012.

Input:

  • pwa_sys: a PwaSysDyn object
  • ppp: a PropPreservingPartition object

Output:

  • A PropPreservingPartition object with subsystem assignments

discretize.py — Algorithms related to discretization

Algorithms related to discretization containing both MATLAB interface and Python discretization. Input calculation is available in python only but should work also for a state space partition discretized in MATLAB.

Classes:
  • CtsSysDyn
  • PwaSubsysDyn
  • PwaSysDyn
Primary functions:
  • discretize
  • get_input
Helper functions:
  • solveFeasable
  • discretizeM
  • discretizeToMatlab
  • discretizeFromMatlab
  • getInputHelper
  • createLM
  • get_max_extreme
class discretize.CtsSysDyn(A=[], B=[], E=[], K=[], Uset=None, Wset=None)[source]

CtsSysDyn class for specifying the continuous dynamics:

s[t+1] = A*s[t] + B*u[t] + E*d[t] + K u[t] in Uset - polytope object d[t] in Wset - polytope object

A CtsSysDyn object contains the fields A, B, E, K, Uset and Wset as defined above.

Constructor:

CtsSysDyn ([ A = [][, B = [][, E = [][, K = [][, Uset = [][, Wset = []]]]]]])

class discretize.PwaSubsysDyn(A=[], B=[], E=[], K=[], Uset=None, Wset=None, sub_domain=None)[source]

PwaSubsysDyn class for specifying a subsystem of piecewise affine continuous dynamics.

s[t+1] = A_i*s[t] + B_i*u[t] + E_i*d[t] + K_i u[t] in Uset_i - polytope object d[t] in Wset_i - polytope object for H_i*s[t]<=g_i - subdomain, type: polytope object

PwaSubsysDyn class inherits from CtsSysDyn with the additional field:

  • sub_domain: domain with nonempty interior where these dynamics are active, type: polytope
class discretize.PwaSysDyn(list_subsys=[], domain=None)[source]

PwaSysDyn class for specifying a piecewise affine system. A PwaSysDyn object contains the fields:

  • list_subsys: list of PwaSubsysDyn
  • domain: domain over which piecewise affine system is defined, type: polytope

For the system to be well-defined the sub_domains of its subsystems should be mutually exclusive (modulo intersections with empty interior) and cover the domain.

discretize.createLM(ssys, N, list_P, Pk=None, PN=None, disturbance_ind=None)[source]

Compute the components of the polytope L [x(0)’ u(0)’ ... u(N-1)’]’ <= M which stacks the following constraints

  • x(t+1) = A x(t) + B u(t) + E d(t)
  • [u(k); x(k)] in ssys.Uset for all k

If list_P is a Polytope:

  • x(0) in list_P if list_P
  • x(k) in Pk for k= 1,2, .. N-1
  • x(N) in PN

If list_P is a list of polytopes

  • x(k) in list_P[k] for k= 0, 1 ... N

The returned polytope describes the intersection of the polytopes for all possible Input:

  • ssys: CtsSysDyn dynamics

  • N: horizon length

  • list_P: list of Polytopes or Polytope

  • Pk, PN: Polytopes

  • disturbance_ind: list indicating which k’s that disturbance should

    be taken into account. default is [1,2, ... N]

discretize.discretize(part, ssys, N=10, min_cell_volume=0.1, closed_loop=True, use_mpt=False, conservative=True, max_num_poly=5, use_all_horizon=False, trans_length=1, remove_trans=False, abs_tol=1e-07, verbose=0)[source]

Refine the partition and establish transitions based on reachability analysis.

Input:

  • part: a PropPreservingPartition object

  • ssys: a CtsSysDyn or PwaSysDyn object

  • N: horizon length

  • min_cell_volume: the minimum volume of cells in the resulting

    partition.

  • closed_loop: boolean indicating whether the closed loop

    algorithm should be used. default True.

  • use_mpt: if True, use MPT-based abstraction algorithm.

  • conservative: if true, force sequence in reachability analysis

    to stay inside starting cell. If false, safety is ensured by keeping the sequence inside the original proposition preserving cell which needs to be convex. In order to use the value false, ensure to have a convex initial partition or use prop2partconvex to postprocess the proposition preserving partition before calling discretize.

  • max_num_poly: maximum number of polytopes in a region to use in

    reachability analysis.

  • use_all_horizon: in closed loop algorithm: if we should look

    for reach- ability also in less than N steps.

  • trans_length: the number of polytopes allowed to cross in a

    transition. a value of 1 checks transitions only between neighbors, a value of 2 checks neighbors of neighbors and so on.

  • remove_trans: if True, remove found transitions between

    non-neighbors.

  • abs_tol: maximum volume for an “empty” polytope

  • verbose: level of verbosity

Output:

  • A PropPreservingPartition object with transitions
discretize.discretizeFromMatlab(origPart)[source]

Load the data from MATLAB discretize implementation.

Input:

  • origPart: a PropPreservingPartition object
discretize.discretizeM(part, ssys, N=10, auto=True, minCellVolume=0.1, maxNumIterations=5, useClosedLoopAlg=True, useAllHorizonLength=True, useLargeSset=False, timeout=-1, maxNumPoly=5, verbose=2)[source]

Discretize the continuous state space using MATLAB implementation.

Input:

  • part: a PropPreservingPartition object

  • ssys: a CtsSysDyn object

  • N: horizon length

  • auto: a boolean that indicates whether to automatically run

    the MATLAB implementation of discretize.

  • minCellVolume: the minimum volume of cells in the resulting

    partition.

  • maxNumIterations: the maximum number of iterations

  • useClosedLoopAlg: a boolean that indicates whether to use the

    closed loop algorithm. For the difference between the closed loop and the open loop algorithm, see Borrelli, F. Constrained Optimal Control of Linear and Hybrid Systems, volume 290 of Lecture Notes in Control and Information Sciences. Springer. 2003.

  • useAllHorizonLength: a boolean that indicates whether all the

    horizon length up to probStruct.N can be used. This option is relevant only when the closed loop algorithm is used.

  • useLargeSset: a boolean that indicates whether when solving

    the reachability problem between subcells of the original partition, the cell of the original partition should be used for the safe set.

  • timeout: timeout (in seconds) for polytope union operation.

    If negative, the timeout won’t be used. Note that using timeout requires MATLAB parallel computing toolbox.

  • maxNumPoly: the maximum number of polytopes in a region used

    in computing reachability.

  • verbose: level of verbosity

discretize.discretizeToMatlab(part, ssys, N=10, minCellVolume=0.1, maxNumIterations=5, useClosedLoopAlg=True, useAllHorizonLength=True, useLargeSset=False, timeout=-1, maxNumPoly=5, verbose=0)[source]

Generate an input file for MATLAB implementation of discretize.

Input:

  • part: a PropPreservingPartition object
  • ssys: a CtsSysDyn object
  • N: horizon length
  • minCellVolume: the minimum volume of cells in the resulting partition
  • maxNumIterations: the maximum number of iterations
  • useClosedLoopAlg: a boolean that indicates whether to use the closed loop algorithm. For the difference between the closed loop and the open loop algorithm, see Borrelli, F. Constrained Optimal Control of Linear and Hybrid Systems, volume 290 of Lecture Notes in Control and Information Sciences. Springer. 2003.
  • useAllHorizonLength: a boolean that indicates whether all the horizon length up to probStruct.N can be used. This option is relevant only when the closed loop algorithm is used.
  • useLargeSset: a boolean that indicates whether when solving the reachability problem between subcells of the original partition, the cell of the original partition should be used for the safe set.
  • timeout: timeout (in seconds) for polytope union operation. If negative, the timeout won’t be used. Note that using timeout requires MATLAB parallel computing toolbox.
  • maxNumPoly: the maximum number of polytopes in a region used in computing reachability.
  • verbose: level of verbosity
discretize.discretize_overlap(part, ssys, N=10, min_cell_volume=0.1, closed_loop=False, conservative=False, max_num_poly=5, use_all_horizon=False, abs_tol=1e-07, verbose=0)[source]

Refine the partition and establish transitions based on reachability analysis.

Input:

  • part: a PropPreservingPartition object

  • ssys: a CtsSysDyn object

  • N: horizon length

  • min_cell_volume: the minimum volume of cells in the resulting

    partition.

  • closed_loop: boolean indicating whether the closed loop

    algorithm should be used. default False.

  • conservative: if true, force sequence in reachability analysis

    to stay inside starting cell. If false, safety is ensured by keeping the sequence inside the original proposition preserving cell.

  • max_num_poly: maximum number of polytopes in a region to use

    in reachability analysis.

  • use_all_horizon: in closed loop algorithm: if we should look

    for reach- ability also in less than N steps.

  • abs_tol: maximum volume for an “empty” polytope

Output:

  • A PropPreservingPartition object with transitions
discretize.getInputHelper(x0, ssys, P1, P3, N, R, r, Q, closed_loop=True)[source]

Calculates the sequence u_seq such that - x(t+1) = A x(t) + B u(t) + K - x(k) in P1 for k = 0,...N - x(N) in P3 - [u(k); x(k)] in PU

and minimizes x’Rx + 2*r’x + u’Qu

discretize.get_cellID(x0, part)[source]

Return an integer specifying in which discrete state the continuous state x0 belongs to.

Input: - x0: initial continuous state - part: PropPreservingPartition object specifying the state space partition

Output: - cellID: int specifying the discrete state in part x0 belongs to, -1 if x0 does not belong to any discrete state.

Note1: If there are overlapping partitions (i.e., x0 can belong to more than one discrete state), this just returns the first ID

discretize.get_input(x0, ssys, part, start, end, N, R=[], r=[], Q=[], mid_weight=0.0, conservative=True, closed_loop=True, test_result=False)[source]

Calculate an input signal sequence taking the plant from state start to state end in the partition part, such that f(x,u) = x’Rx + r’x + u’Qu + mid_weight*|xc-x(0)|_2 is minimal. xc is the chebyshev center of the final cell. If no cost parameters are given, Q = I and mid_weight=3 are used.

Input:

  • x0: initial continuous state

  • ssys: CtsSysDyn object specifying system dynamics

  • part: PropPreservingPartition object specifying the state

    space partition.

  • start: int specifying the number of the initial state in part

  • end: int specifying the number of the end state in part

  • N: the horizon length

  • R: state cost matrix for x = [x(1)’ x(2)’ .. x(N)’]’,

    size (N*xdim x N*xdim). If empty, zero matrix is used.

  • r: cost vector for x = [x(1)’ x(2)’ .. x(N)’]’, size (N*xdim x 1)

  • Q: input cost matrix for u = [u(0)’ u(1)’ .. u(N-1)’]’,

    size (N*udim x N*udim). If empty, identity matrix is used.

  • mid_weight: cost weight for |x(N)-xc|_2

  • conservative: if True, force plant to stay inside initial

    state during execution. if False, plant is forced to stay inside the original proposition preserving cell.

  • closed_loop: should be True if closed loop discretization has

    been used.

  • test_result: performs a simulation (without disturbance) to

    make sure that the calculated input sequence is safe.

Output: - A (N x m) numpy array where row k contains u(k) for k = 0,1 ... N-1.

Note1: The same horizon length as in reachability analysis should be used in order to guarantee feasibility.

Note2: If the closed loop algorithm has been used to compute reachability the input needs to be recalculated for each time step (with decreasing horizon length). In this case only u(0) should be used as a control signal and u(1) ... u(N-1) thrown away.

Note3: The “conservative” calculation makes sure that the plants remains inside the convex hull of the starting region during execution, i.e. x(1), x(2) ... x(N-1) are in conv_hull(starting region). If the original proposition preserving partition is not convex, safety can not be guaranteed.

discretize.get_max_extreme(G, D, N)[source]

Calculate the array d_hat such that d_hat = max(G*DN_extreme), where DN_extreme are the vertices of the set D^N.

This is used to describe the polytope L*x <= M - G*d_hat. Calculating d_hat is equivalen to taking the intersection of the polytopes L*x <= M - G*d_i for every possible d_i in the set of extreme points to D^N.

Input:

  • G: The matrix to maximize with respect to
  • D: Polytope describing the disturbance set
  • N: Horizon length

Output: - d_hat: Array describing the maximum possible effect from disturbance

discretize.is_seq_inside(x0, u_seq, ssys, P0, P1)[source]

Checks if the plant remains inside P0 for time t = 1, ... N-1 and that the plant reaches P1 for time t = N. Used to test a computed input sequence. No disturbance is taken into account.

Input:

  • x0: initial point for execution
  • u_seq: (N x m) array where row k is input for t = k
  • ssys: CtsSysDyn dynamics
  • P0: Polytope where we want x(k) to remain for k = 1, ... N-1

Output: - True if x(k) in P0 for k = 1, .. N-1 and x(N) in P1. False otherwise

discretize.solveFeasable(P1, P2, ssys, N, max_cell=10, closed_loop=True, use_all_horizon=False, trans_set=None, max_num_poly=5)[source]

Computes the subset x0 of `P1’ from which `P2’ is reachable in horizon `N’, with respect to system dynamics `ssys’. The closed loop algorithm solves for one step at a time, which keeps the dimension of the polytopes down.

Input:

  • P1: A Polytope or Region object

  • P2: A Polytope or Region object

  • ssys: A CtsSysDyn object

  • N: The horizon length

  • closed_loop: If true, take 1 step at the time. This keeps down

    polytope dimension and handles disturbances better. Default: True.

  • use_all_horizon: Used for closed loop algorithm. If true,

    allow reachability also in less than N steps.

  • trans_set: If specified, force transitions to be in this

    set. If empty, P1 is used

Output: x0: A Polytope or Region object defining the set in P1 from which

P2 is reachable

polytope — Polytope computations and plotting

A computational geometry module for polytope computations. The module can be accessed by writing

> import tulip.polytope as pc

Primary functions:
  • is_adjacent
  • reduce
  • is_fulldim
  • intersect
  • mldivide
  • cheby_ball
  • union
  • volume
  • projection
  • is_inside
  • envelope
  • extreme
Classes:
  • Region
  • Polytope
class polytope.polytope.Polytope(A=array([], dtype=float64), b=array([], dtype=float64), minrep=False, chebR=0, chebX=None, fulldim=None, volume=None, vertices=None, normalize=True)[source]

Polytope class with following fields

  • A: a numpy array for the hyperplane normals in hyperplane

    representation of a polytope

  • b: a numpy array for the hyperplane offsets in hyperplane

    representation of a polytope

  • array: python array in the case of a union of convex polytopes

  • chebXc: coordinates of chebyshev center (if calculated)

  • chebR: chebyshev radius (if calculated)

  • bbox: bounding box (if caluclated)

  • minrep: if polytope is in minimal representation (after

    running reduce)

  • normalize: if True (default), normalize given A and b arrays;

    else, use A and b without modification.

copy()[source]

Return copy of this Polytope.

class polytope.polytope.Region(list_poly=[], list_prop=[])[source]

Class for lists of convex polytopes

Contains the following fields:

  • list_poly: list of Polytope objects

  • list_prop: list of propositions inside region

  • bbox: if calculated, bounding box of region (see bounding_box)

  • fulldim: if calculated, boolean indicating whether region is

    fully dimensional

  • volume: if calculated, volume of region

  • chebXc: coordinates of maximum chebyshev center (if calculated)

  • chebR: maximum chebyshev radius (if calculated)

copy()[source]

Return copy of this Region.

polytope.polytope.bounding_box(polyreg)[source]

Compute the smallest hyperbox containing the polytope or region

polytope.polytope.cheby_ball(poly1)[source]

Calculate the Chebyshev radius and center for a polytope.

If input is a region the largest Chebyshev ball is returned.

Input: poly1: A Polytope object

Output:

rc,xc: Chebyshev radius rc (float) and center xc (numpy array)

N.B., this function will return whatever it finds in attributes chebR and chbXc if not None, without (re)computing the Chebyshev ball.

Example (low dimension):

r1,x1 = cheby_ball(P, [1]) calculates the center and half the length of the longest line segment along the first coordinate axis inside polytope P

polytope.polytope.dimension(polyreg)[source]

Get the dimension of a polytope or region.

Input: polyreg: Polytope or Region object

Output: dim: Dimension of input

polytope.polytope.envelope(reg, abs_tol=1e-07)[source]

Compute envelope of a region.

The envelope is the polytope defined by all “outer” inequalities a x < b such that {x | a x < b} intersection P = P for all polytopes P in the region. In other words we want to find all “outer” equalities of the region.

If envelope can’t be computed an empty polytope is returned

Input: polyreg: Polytope or Region abs_tol: Absolute tolerance for calculations

Output: envelope: Envelope of input

polytope.polytope.extreme(poly1)[source]

Compute the extreme points of a _bounded_ polytope

Input: - poly1: Polytope in dimension d

Output: - A (N x d) numpy array containing the N vertices of poly1

polytope.polytope.intersect(poly1, poly2, abs_tol=1e-07)[source]

Compute the intersection between two polytopes or regions

Input: - poly1,`poly2`: Polytopes to intersect

Output: - Intersection described by a polytope

polytope.polytope.is_adjacent(poly1, poly2, overlap=False, abs_tol=1e-07)[source]

Checks if two polytopes or regions are adjacent by enlarging both slightly and checking the intersection

Input: - poly1,poly2: Polytopes or Regions to check - abs_tol: absolute tolerance - overlap: used for overlapping polytopes, functions returns

True if polytopes are neighbors OR overlap

Output: True if polytopes are adjacent, False otherwise

polytope.polytope.is_convex(reg, abs_tol=1e-07)[source]

Check if a region is convex.

Input: reg: Region object

Output: result,envelope: result indicating if convex. if found to be

convex the envelope describing the convex polytope is returned.
polytope.polytope.is_empty(polyreg)[source]

Check if the description of a polytope is empty

Input: polyreg: Polytope or Region instance

Output: result: Boolean indicating whether polyreg is empty

polytope.polytope.is_fulldim(polyreg, abs_tol=1e-07)[source]

Check if a polytope or region has inner points.

Input: - polyreg: Polytope or Region instance

Output:

  • result: Boolean that is True if inner points found, False

    otherwise.

polytope.polytope.is_inside(poly1, p0, abs_tol=1e-07)[source]

Checks if the point p0 satisfies all the inequalities of poly1.

Input: poly1: Polytope or Region object.

Output: result: Boolean being True or False

polytope.polytope.mldivide(poly1, poly2)[source]

Compute a set difference poly1 poly2 between two regions or polytopes

Input:

  • poly1: Starting polytope
  • poly2: Polytope to subtract

Output: - region: Region describing the set difference

polytope.polytope.num_bin(N, places=8)[source]

Return N as list of bits, zero-filled to places.

E.g., given N=7, num_bin returns [1, 1, 1, 0, 0, 0, 0, 0].

polytope.polytope.projection(poly1, dim, solver=None, abs_tol=1e-07, verbose=0)[source]

Projects a polytope onto lower dimensions.

Input:

  • poly1: Polytope to project

  • dim: Dimensions on which to project

  • solver: A solver can be specified, if left blank an attempt is

    made to choose the most suitable solver.

  • verbose: if positive, print solver used in case of guessing;

    default is 0 (be silent).

Available solvers are:

  • “esp”: Equality Set Projection;
  • “exthull”: vertex projection;
  • “fm”: Fourier-Motzkin projection;
  • “iterhull”: iterative hull method.

Output: - Projected polytope in lower dimension

Example: To project the polytope P onto the first three dimensions, use

>>> P_proj = projection(P, [1,2,3])
polytope.polytope.projection_esp(poly1, keep_dim, del_dim)[source]

Helper function implementing “Equality set projection”. Very buggy.

polytope.polytope.projection_exthull(poly1, new_dim)[source]

Help function implementing vertex projection. Efficient in low dimensions.

polytope.polytope.projection_fm(poly1, new_dim, del_dim, abs_tol=1e-07)[source]

Help function implementing Fourier Motzkin projection. Should work well for eliminating few dimensions.

polytope.polytope.projection_iterhull(poly1, new_dim, max_iter=1000, verbose=0, abs_tol=1e-07)[source]

Helper function implementing the “iterative hull” method. Works best when projecting _to_ lower dimensions.

polytope.polytope.qhull(vertices, abs_tol=1e-07)[source]

Use quickhull to compute a convex hull.

Input: - vertices: A N x d array containing N vertices in dimension d

Output: - Polytope describing the convex hull

polytope.polytope.reduce(poly, nonEmptyBounded=1, abs_tol=1e-07)[source]

Removes redundant inequalities in the hyperplane representation of the polytope with the algorithm described at http://www.ifor.math.ethz.ch/~fukuda/polyfaq/node24.html by solving one LP for each facet

Warning: - nonEmptyBounded == 0 case is not tested much.

Input: poly: Polytope or Region object

Output: poly_red: Reduced Polytope or Region object

polytope.polytope.region_diff(poly, reg, abs_tol=1e-07, intersect_tol=1e-07)[source]

Subtract a region from a polytope

Input: - poly: polytope from which to subtract a region - reg: region which should be subtracted - abs_tol: absolute tolerance

Output: - polytope or region containing non-overlapping polytopes

polytope.polytope.separate(reg1, abs_tol=1e-07)[source]

Divide a region into several regions such that they are all connected.

Input: - reg1: Region object - abs_tol: Absolute tolerance

Output: List [] of connected Regions

polytope.polytope.union(polyreg1, polyreg2, check_convex=False)[source]

Compute the union of polytopes or regions

Input: - polyreg1, polyreg2: polytopes or regions - check_convex: if True, look for convex unions and simplify

Output: - region of non-overlapping polytopes describing the union

polytope.polytope.volume(polyreg)[source]

Approximately compute the volume of a Polytope or Region.

A randomized algorithm is used.

Input: - polyreg: Polytope or Region

Output: - Volume of input

Plotting

Functions for plotting Polytopes and Partitions. The functions can be accessed by

> from tulip.polytope.plot import *

Functions:

  • get_patch
  • plot
  • plot_partition
  • plot_trajectory
polytope.plot.get_patch(poly1, color='blue')[source]

Takes a Polytope and returns a Matplotlib Patch Polytope that can be added to a plot

Example:

> # Plot Polytope objects poly1 and poly2 in the same plot
> import matplotlib.pyplot as plt
> fig = plt.figure()
> ax = fig.add_subplot(111)
> p1 = get_patch(poly1, color="blue")
> p2 = get_patch(poly2, color="yellow")
> ax.add_patch(p1)
> ax.add_patch(p2)
> ax.set_xlim(xl, xu) # Optional: set axis max/min
> ax.set_ylim(yl, yu) 
> plt.show()
polytope.plot.plot(poly1, show=True)[source]

Plots a 2D polytope or a region using matplotlib.

Input: - poly1: Polytope or Region

polytope.plot.plot_partition(ppp, plot_transitions=False, plot_numbers=True, show=True)[source]

Plots a 2D PropPreservingPartition object using matplotlib

Input:

  • ppp: A PropPreservingPartition object

  • plot_transitions: If True, represent transitions in ppp with arrows.

    Requires transitions to be stored in ppp.

  • plot_numbers: If True, plot the number of the Region in the center of

    each Region.

  • show: If True, show the plot. Otherwise return axis object. Axis object is good

    for creating custom plots.

polytope.plot.plot_trajectory(ppp, x0, u_seq, ssys)[source]

Plots a PropPreservingPartition and the trajectory generated by x0 input sequence u_seq.

Input:

  • ppp: a PropPreservingPartition object
  • x0: initial state
  • u_seq: matrix where each row contains an input
  • ssys: system dynamics
  • show: if True, show plot. if false, return axis object