24 package org.lightjason.agentspeak.consistency;
26 import org.apache.commons.io.IOUtils;
27 import org.junit.Assume;
28 import org.junit.Before;
29 import org.junit.Test;
47 import javax.annotation.Nonnull;
48 import java.io.InputStream;
49 import java.util.Collection;
50 import java.util.Collections;
52 import java.util.stream.Collectors;
53 import java.util.stream.Stream;
55 import static org.junit.Assert.assertEquals;
87 m_literals = Stream.of(
94 ).collect( Collectors.toSet() );
105 Assume.assumeNotNull( m_literals );
106 Assume.assumeFalse(
"testing literals are empty", m_literals.isEmpty() );
108 "symmetric difference equality",
123 Assume.assumeNotNull( m_literals );
124 Assume.assumeFalse(
"testing literals are empty", m_literals.isEmpty() );
126 "symmetric difference inequality",
129 Stream.concat( m_literals.stream(), Stream.of(
CLiteral.
from(
"diff" ) ) ).collect( Collectors.toSet() ),
141 Assume.assumeNotNull( m_literals );
142 Assume.assumeFalse(
"testing literals are empty", m_literals.isEmpty() );
145 "weight difference equality",
160 Assume.assumeNotNull( m_literals );
161 Assume.assumeFalse(
"testing literals are empty", m_literals.isEmpty() );
164 "weight difference inequality",
168 Stream.concat( m_literals.stream(), Stream.of(
CLiteral.
from(
"diff" ) ) ).collect( Collectors.toSet() ),
185 private void check(
final String p_message,
final IFilter p_filter,
final IMetric p_metric,
final Collection<ILiteral> p_belief1,
186 final Collection<ILiteral> p_belief2,
final double p_excepted,
final double p_delta )
188 final double l_value = p_metric.apply(
189 p_filter.apply(
this.agent( p_belief1 ) ),
190 p_filter.apply(
this.agent( p_belief2 ) )
192 assertEquals( p_message, p_excepted, l_value, p_delta );
204 Assume.assumeNotNull( m_generator );
207 p_literals.forEach( i -> l_agent.
beliefbase().
generate( m_generator, i.functorpath() ).add( i ) );
230 super( p_configuration );
243 CAgentGenerator( @Nonnull
final InputStream p_stream, @Nonnull
final Set<IAction> p_actions )
throws Exception
245 super( p_stream, p_actions );
Set< ILiteral > m_literals
set with testing literals
static final long serialVersionUID
serial id
final void symmetricweightinequality()
test symmetric weight metric inequality
void initialize()
test initialize
CAgent.CAgentGenerator m_agentgenerator
agent generator
filtering interface of agent literal values for metric
base test class with helpers
void check(final String p_message, final IFilter p_filter, final IMetric p_metric, final Collection< ILiteral > p_belief1, final Collection< ILiteral > p_belief2, final double p_excepted, final double p_delta)
runs the check
metric interface of the coherency structure
CAgentGenerator( @Nonnull final InputStream p_stream, @Nonnull final Set< IAction > p_actions)
ctor
CAgent agent(final Collection< ILiteral > p_literals)
generates an agent
filtering for all execution plans & beliefs
view for a beliefbase that creates any access to the underlying data structures
IViewGenerator m_generator
literal view generator
final void symmetricweightequality()
test symmetric weight metric equality
external action interface
CAgent generatesingle(final Object... p_data)
calculates the distance with respect to size of union and intersection of beliefbases.
thread-safe storage of the data of single- and multi-elements
default generic literal class for agent beliefs a literal consists of a functor, an optional list of ...
interface to define the agent configuration
IView generate( @Nonnull final IViewGenerator p_generator, @Nonnull final IPath... p_paths)
generates path structure
interface for generating non-existing beliefbases views
final void weightequality()
test symmetric metric equality
final IView apply(final String p_name, final IView p_parent)
CAgent(final IAgentConfiguration< CAgent > p_configuration)
ctor
static ILiteral from( @Nonnull final String p_functor, @Nullable final ITerm... p_values)
factory
final IView create( @Nonnull final String p_name)
returns a new view of the belief base
final void weightinequality()
test symmetric metric equality
metric on collections returns the size of symmetric difference
beliefbase to generate any event-based data by reference counting
final IAgentConfiguration< T > m_configuration
configuration of an agent