Functions Used to Manipulate the Discrete Game

finddiscgame
% FINDDISCGAME computes a discrete game abstraction of a PAHS
%
% Usage DGABS=FINDDISCGAME(PAHS)
%
% PAHS is a Piecewise-Affine Hybrid System
% PAHS.MODE
%  MODE.DYNAMICS %Mode wide dynamics (not mandatory)
%  MODE.INPUT    %Mode wide input    (not mandatory)
%  MODE.LOC{}    %Cell Array of locations
%   LOC.S        %The simplex represented by the location
%   LOC.BORD[]   %Array of neigbouring simplices index coorsponds to facet
%  MODE.TRANS{}  %Transitions starting from this mode
%   TRANS.DEST   %Destination mode of the transition
%   TRANS.CTRB   %Controllability of the transition
%
% PAHS.SAMEPART  %Boolean hint set to true if identical partitions is used
%                 in all modes

% Example:

 pahs=demopahs();
 dgabs=finddiscgame(pahs);

% See also FINDDGSOL
finddgsol
% FINDDGSOL finds a winning strategy (if it exists) to a discrete game given a specification.
%
% Usage: [WIN,SOL]=FINDDGSOL(DGABS,SPEC)
%
% DGABS is a discrete game abstraction
% SPEC is a reach/avoid/stay specification
% WIN is a boolean, true if a winning strategy was found
% SOL is a solution implementing the winning strategy
%
% Example:

 pahs=demopahs();
 req=demoreq();
 spec=req2spec(pahs,req);
 dgabs=finddiscgame(pahs);
 [win,sol]=finddgsol(dgabs,spec)

% See also FINDDISCGAME and REQ2SPEC
req2spec
% Converts REACH/AVOID/STAY requirements defined on polytopes to a dgabs spec
%
% REQ.INIT %Initial set
%  INIT{i}.modes[]  %Vector of modes
%  INIT{i}.poly     %Polytope describing the set
%
% REQ.GOAL %Goal set
%  GOAL{i}.modes[]
%  GOAL{i}.poly     %Polytope describing the set
%
% REQ.AVOID %Avoid set
%  AVOID{i}.modes[]
%  AVOID{i}.poly     %Polytope describing the set
%
% Example:

 init.dim=2;
 init.vertices={[0;-1],[0.5;-1],[1;-0.5],[0;-0.5]};
 init.facet{1}.vertices={1,2};
 init.facet{1}.opposit=3;
 init.facet{2}.vertices={2,3};
 init.facet{2}.opposit=4;
 init.facet{3}.vertices={3,4};
 init.facet{3}.opposit=1;
 init.facet{4}.vertices={4,1};
 init.facet{4}.opposit=2;

 avoid.dim=2;
 avoid.vertices={[2.6;0.95],[2.95;0.95],[2.95;0.7],[2.85;0.7]};
 avoid.facet{1}.vertices={1,2};
 avoid.facet{1}.opposit=3;
 avoid.facet{2}.vertices={2,3};
 avoid.facet{2}.opposit=1;
 avoid.facet{3}.vertices={3,4};
 avoid.facet{3}.opposit=2;
 avoid.facet{4}.vertices={4,1};
 avoid.facet{4}.opposit=2;

 goal.dim=2;
 goal.vertices={[2;0.5],[3;0.5],[3;-0.5],[2;-.5]};
 goal.facet{1}.vertices={1,2};
 goal.facet{1}.opposit=3;
 goal.facet{2}.vertices={2,3};
 goal.facet{2}.opposit=1;
 goal.facet{3}.vertices={3,4};
 goal.facet{3}.opposit=2;
 goal.facet{4}.vertices={4,1};
 goal.facet{4}.opposit=2;

 req.init{1}.modes=[1 2];
 req.init{1}.poly=init;

 req.goal{1}.modes=[1 2];
 req.goal{1}.poly=goal;

 req.avoid{1}.modes=2;
 req.avoid{1}.poly=avoid;

 spec=req2spec(pahs,req);


% See also FINDDGSOL and PLOTPAHS