Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Algorithms Library Toolkit Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Algorithms Library Toolkit
Algorithms Library Toolkit Core
Commits
038558a6
Commit
038558a6
authored
6 years ago
by
Tomáš Pecka
Committed by
Tomáš Pecka
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Algo: Compute partitions of undistinguishable states
parent
df4f38be
No related branches found
No related tags found
1 merge request
!79
Dev tp
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
alib2algo/src/automaton/properties/UndistinguishableStates.cpp
+24
-0
24 additions, 0 deletions
...algo/src/automaton/properties/UndistinguishableStates.cpp
alib2algo/src/automaton/properties/UndistinguishableStates.h
+85
-0
85 additions, 0 deletions
alib2algo/src/automaton/properties/UndistinguishableStates.h
with
109 additions
and
0 deletions
alib2algo/src/automaton/properties/UndistinguishableStates.cpp
0 → 100644
+
24
−
0
View file @
038558a6
/*
*
UndistinguishableStates
.
cpp
*
*
Created
on
:
27.
3.
2019
*
Author
:
Tomas
Pecka
*/
#include
"UndistinguishableStates.h"
#include
<registration/AlgoRegistration.hpp>
namespace
automaton
{
namespace
properties
{
auto
UndistinguishableStatesDFA
=
registration
::
AbstractRegister
<
UndistinguishableStates
,
ext
::
set
<
ext
::
set
<
DefaultStateType
>
>
,
const
automaton
::
DFA
<
>
&
>
(
UndistinguishableStates
::
undistinguishable
,
"fsm"
).
setDocumentation
(
"Computes the partitions of undistinguishable states states in given DFA.
\n
\
\
n
\
@
param
dfa
finite
automaton
.
\
n
\
@
return
set
of
blocks
of
undistinguishable
states
" );
}
/* namespace properties */
}
/* namespace automaton */
This diff is collapsed.
Click to expand it.
alib2algo/src/automaton/properties/UndistinguishableStates.h
0 → 100644
+
85
−
0
View file @
038558a6
/*
* UndistinguishableStates.h
*
* This file is part of Algorithms library toolkit.
* Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
* Algorithms library toolkit is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Algorithms library toolkit is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>.
*
* Created on: 27. 3. 2019
* Author: Tomas Pecka
*/
#ifndef DISTINGUISHABLE_STATES_PARTITIONING_H_
#define DISTINGUISHABLE_STATES_PARTITIONING_H_
#include <alib/set>
#include <alib/map>
#include <automaton/FSM/DFA.h>
#include <automaton/Automaton.h>
#include <automaton/properties/DistinguishableStates.h>
namespace automaton {
namespace properties {
/**
* Partition undistinguishable states in automata
*
* @sa DistinguishableStates
*/
class UndistinguishableStates {
public:
/**
* Creates state partitioning of undistinguishable states using DistinguishableStates algorithm
*
* @tparam SymbolType Type for input symbols.
* @tparam StateType Type for states.
* @param dfa automaton which states are to be partitioned
*
* @sa DistinguishableStates
*
* @return state partitioning of undistinguishable states
*/
template < class SymbolType, class StateType >
static ext::set < ext::set < StateType > > undistinguishable ( const automaton::DFA < SymbolType, StateType > & fsm );
};
template < class SymbolType, class StateType >
ext::set < ext::set < StateType > > UndistinguishableStates::undistinguishable ( const automaton::DFA < SymbolType, StateType > & fsm ) {
const ext::set < ext::pair < StateType, StateType > > distinguishable = automaton::properties::DistinguishableStates::distinguishableStates ( fsm );
ext::set < ext::set < StateType > > res;
for ( const StateType & state : fsm.getStates ( ) ) {
ext::set < StateType > partition;
for ( const StateType & other : fsm.getStates ( ) )
if ( distinguishable.count ( ext::make_pair ( state, other ) ) == 0 )
partition.insert ( other );
res.insert ( partition );
}
return res;
}
} /* namespace properties */
} /* namespace automaton */
#endif /* DISTINGUISHABLE_STATES_H_ */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment