Skip to content

Commit

Permalink
Upgrade to latest version of Petit Poucet and AntRUn
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainhalle committed May 10, 2023
1 parent 9cf8cce commit a0ee7f0
Show file tree
Hide file tree
Showing 22 changed files with 984 additions and 466 deletions.
230 changes: 150 additions & 80 deletions Source/Core/build.xml

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions Source/Core/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
<!-- The project's name -->
<name>Synthia</name>

<!-- The project's version number -->
<version>0.3.2</version>

<!-- The project's package (with a trailing slash) -->
<package>ca/uqac/lif/synthia/</package>

<!-- The project's author. Currently this only
shows up in the footer of the Javadoc documentation. -->
<author>Sylvain Hallé, Marc-Antoine Plourde</author>
Expand All @@ -40,10 +46,11 @@
<libdir>lib</libdir>
<depdir>dep</depdir>
<bindir>bin</bindir>
<docdir>doc</docdir>

<!-- JAR filename -->
<jar>
<filename>../synthia-core.jar</filename>
<filename>../synthia-core</filename>
</jar>

<test>
Expand All @@ -66,7 +73,7 @@
<name>Petit Poucet Core</name>
<classname>ca.uqac.lif.petitpoucet.Part</classname>
<files>
<jar>https://github.com/liflab/petitpoucet/releases/download/v2.2/petitpoucet-core.jar</jar>
<jar>https://github.com/liflab/petitpoucet/releases/download/v2.3/petitpoucet-core-2.3.jar</jar>
</files>
<bundle>true</bundle>
</dependency>
Expand All @@ -77,7 +84,7 @@
<name>Petit Poucet Functions</name>
<classname>ca.uqac.lif.petitpoucet.function.Function</classname>
<files>
<jar>https://github.com/liflab/petitpoucet/releases/download/v2.2/petitpoucet-functions.jar</jar>
<jar>https://github.com/liflab/petitpoucet/releases/download/v2.3/petitpoucet-functions-2.3.jar</jar>
</files>
<bundle>true</bundle>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Synthia, a data structure generator
Copyright (C) 2019-2021 Laboratoire d'informatique formelle
Copyright (C) 2019-2023 Laboratoire d'informatique formelle
Université du Québec à Chicoutimi, Canada
This program is free software: you can redistribute it and/or modify
Expand All @@ -26,6 +26,7 @@
import ca.uqac.lif.petitpoucet.Part;
import ca.uqac.lif.petitpoucet.PartNode;
import ca.uqac.lif.petitpoucet.function.ExplanationQueryable;
import ca.uqac.lif.petitpoucet.function.RelationNodeFactory;
import ca.uqac.lif.petitpoucet.function.vector.NthElement;
import ca.uqac.lif.synthia.CannotShrinkException;
import ca.uqac.lif.synthia.Picker;
Expand Down Expand Up @@ -117,7 +118,7 @@ public ComposeList<T> duplicate(boolean with_state)
@Override
public PartNode getExplanation(Part p)
{
return getExplanation(p, NodeFactory.getFactory());
return getExplanation(p, RelationNodeFactory.getFactory());
}

@Override
Expand All @@ -127,7 +128,7 @@ public String toString()
}

@Override
public PartNode getExplanation(Part p, NodeFactory f)
public PartNode getExplanation(Part p, RelationNodeFactory f)
{
PartNode root = f.getPartNode(p, this);
AndNode and = f.getAndNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
import ca.uqac.lif.dag.NestedNode.NestedNodeCrawler;
import ca.uqac.lif.dag.Node;
import ca.uqac.lif.dag.Pin;
import ca.uqac.lif.petitpoucet.NodeFactory;
import ca.uqac.lif.petitpoucet.Part;
import ca.uqac.lif.petitpoucet.PartNode;
import ca.uqac.lif.petitpoucet.function.ExplanationQueryable;
import ca.uqac.lif.petitpoucet.function.RelationNodeFactory;
import ca.uqac.lif.synthia.Picker;

/**
Expand All @@ -43,7 +43,7 @@ public class Explanation
{
public static PartNode explain(Part part, Picker<?> picker)
{
NodeFactory factory = NodeFactory.getFactory().getFactory(part, picker);
RelationNodeFactory factory = RelationNodeFactory.getFactory().getFactory(part, picker);
Queue<PartNode> to_visit = new ArrayDeque<PartNode>();
PartNode root = factory.getPartNode(part, picker);
to_visit.add(root);
Expand Down
12 changes: 8 additions & 4 deletions Source/Core/src/ca/uqac/lif/synthia/random/RandomPicker.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
/*
Synthia, a data structure generator
Copyright (C) 2019-2021 Laboratoire d'informatique formelle
Copyright (C) 2019-2023 Laboratoire d'informatique formelle
Université du Québec à Chicoutimi, Canada
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ca.uqac.lif.synthia.random;

import ca.uqac.lif.petitpoucet.NodeFactory;
import ca.uqac.lif.petitpoucet.Part;
import ca.uqac.lif.petitpoucet.PartNode;
import ca.uqac.lif.petitpoucet.function.ExplanationQueryable;
import ca.uqac.lif.petitpoucet.function.RelationNodeFactory;
import ca.uqac.lif.synthia.Picker;
import ca.uqac.lif.synthia.Seedable;

Expand Down Expand Up @@ -73,11 +77,11 @@ public void reset()
@Override
public PartNode getExplanation(Part p)
{
return getExplanation(p, NodeFactory.getFactory());
return getExplanation(p, RelationNodeFactory.getFactory());
}

@Override
public PartNode getExplanation(Part p, NodeFactory f)
public PartNode getExplanation(Part p, RelationNodeFactory f)
{
return f.getPartNode(p, this);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Synthia, a data structure generator
Copyright (C) 2019-2020 Laboratoire d'informatique formelle
Copyright (C) 2019-2023 Laboratoire d'informatique formelle
Université du Québec à Chicoutimi, Canada
This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -171,6 +171,11 @@ public T pick()
*/
protected int selectTransition(float p)
{
if (!m_transitions.containsKey(m_currentState))
{
// No transition defined
return -1;
}
List<Transition> transitions = m_transitions.get(m_currentState);
float sum_prob = 0f;
int last_state = -1;
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/src/ca/uqac/lif/synthia/sequence/Playback.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Synthia, a data structure generator
Copyright (C) 2019-2021 Laboratoire d'informatique formelle
Copyright (C) 2019-2023 Laboratoire d'informatique formelle
Université du Québec à Chicoutimi, Canada
This program is free software: you can redistribute it and/or modify
Expand All @@ -25,10 +25,10 @@

import ca.uqac.lif.synthia.relative.PickSmallerComparable;
import ca.uqac.lif.petitpoucet.ComposedPart;
import ca.uqac.lif.petitpoucet.NodeFactory;
import ca.uqac.lif.petitpoucet.Part;
import ca.uqac.lif.petitpoucet.PartNode;
import ca.uqac.lif.petitpoucet.function.ExplanationQueryable;
import ca.uqac.lif.petitpoucet.function.RelationNodeFactory;
import ca.uqac.lif.petitpoucet.function.vector.NthElement;
import ca.uqac.lif.synthia.Bounded;
import ca.uqac.lif.synthia.NoMoreElementException;
Expand Down Expand Up @@ -250,11 +250,11 @@ public Shrinkable<T> shrink(T o, Picker<Float> decision, float m)
@Override
public PartNode getExplanation(Part p)
{
return getExplanation(p, NodeFactory.getFactory());
return getExplanation(p, RelationNodeFactory.getFactory());
}

@Override
public PartNode getExplanation(Part p, NodeFactory f)
public PartNode getExplanation(Part p, RelationNodeFactory f)
{
PartNode root = f.getPartNode(p, this);
int index = -1;
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/src/ca/uqac/lif/synthia/sequence/Record.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Synthia, a data structure generator
Copyright (C) 2019-2021 Laboratoire d'informatique formelle
Copyright (C) 2019-2023 Laboratoire d'informatique formelle
Université du Québec à Chicoutimi, Canada
This program is free software: you can redistribute it and/or modify
Expand All @@ -22,10 +22,10 @@
import java.util.Collections;
import java.util.List;

import ca.uqac.lif.petitpoucet.NodeFactory;
import ca.uqac.lif.petitpoucet.Part;
import ca.uqac.lif.petitpoucet.PartNode;
import ca.uqac.lif.petitpoucet.function.ExplanationQueryable;
import ca.uqac.lif.petitpoucet.function.RelationNodeFactory;
import ca.uqac.lif.synthia.Bounded;
import ca.uqac.lif.synthia.Picker;
import ca.uqac.lif.synthia.SequenceShrinkable;
Expand Down Expand Up @@ -145,11 +145,11 @@ public T pick()
@Override
public PartNode getExplanation(Part p)
{
return getExplanation(p, NodeFactory.getFactory());
return getExplanation(p, RelationNodeFactory.getFactory());
}

@Override
public PartNode getExplanation(Part p, NodeFactory f)
public PartNode getExplanation(Part p, RelationNodeFactory f)
{
PartNode root = f.getPartNode(p, this);
int index = -1;
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/src/ca/uqac/lif/synthia/util/Freeze.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Synthia, a data structure generator
Copyright (C) 2019-2020 Laboratoire d'informatique formelle
Copyright (C) 2019-2023 Laboratoire d'informatique formelle
Université du Québec à Chicoutimi, Canada
This program is free software: you can redistribute it and/or modify
Expand All @@ -18,10 +18,10 @@
*/
package ca.uqac.lif.synthia.util;

import ca.uqac.lif.petitpoucet.NodeFactory;
import ca.uqac.lif.petitpoucet.Part;
import ca.uqac.lif.petitpoucet.PartNode;
import ca.uqac.lif.petitpoucet.function.ExplanationQueryable;
import ca.uqac.lif.petitpoucet.function.RelationNodeFactory;
import ca.uqac.lif.synthia.Picker;
import ca.uqac.lif.synthia.Shrinkable;
import ca.uqac.lif.synthia.explanation.NthSuccessiveOutput;
Expand Down Expand Up @@ -120,11 +120,11 @@ public Shrinkable<T> shrink(T o, Picker<Float> decision, float m)
@Override
public PartNode getExplanation(Part p)
{
return getExplanation(p, NodeFactory.getFactory());
return getExplanation(p, RelationNodeFactory.getFactory());
}

@Override
public PartNode getExplanation(Part p, NodeFactory f)
public PartNode getExplanation(Part p, RelationNodeFactory f)
{
PartNode root = f.getPartNode(p, this);
PartNode child = f.getPartNode(NthSuccessiveOutput.replaceOutIndexBy(p, 0), m_innerPicker);
Expand Down
7 changes: 4 additions & 3 deletions Source/Core/src/ca/uqac/lif/synthia/util/Mutator.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Synthia, a data structure generator
Copyright (C) 2019-2021 Laboratoire d'informatique formelle
Copyright (C) 2019-2023 Laboratoire d'informatique formelle
Université du Québec à Chicoutimi, Canada
This program is free software: you can redistribute it and/or modify
Expand All @@ -21,6 +21,7 @@
import ca.uqac.lif.petitpoucet.NodeFactory;
import ca.uqac.lif.petitpoucet.Part;
import ca.uqac.lif.petitpoucet.PartNode;
import ca.uqac.lif.petitpoucet.function.RelationNodeFactory;
import ca.uqac.lif.synthia.Picker;
import ca.uqac.lif.synthia.explanation.NthSuccessiveOutput;

Expand Down Expand Up @@ -66,10 +67,10 @@ public void reset()

public PartNode getExplanation(Part p)
{
return getExplanation(p, NodeFactory.getFactory());
return getExplanation(p, RelationNodeFactory.getFactory());
}

public PartNode getExplanation(Part p, NodeFactory f)
public PartNode getExplanation(Part p, RelationNodeFactory f)
{
int index = NthSuccessiveOutput.mentionedOutput(p);
if (index < 0)
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/src/ca/uqac/lif/synthia/util/NothingPicker.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Synthia, a data structure generator
Copyright (C) 2019-2021 Laboratoire d'informatique formelle
Copyright (C) 2019-2023 Laboratoire d'informatique formelle
Université du Québec à Chicoutimi, Canada
This program is free software: you can redistribute it and/or modify
Expand All @@ -18,10 +18,10 @@
*/
package ca.uqac.lif.synthia.util;

import ca.uqac.lif.petitpoucet.NodeFactory;
import ca.uqac.lif.petitpoucet.Part;
import ca.uqac.lif.petitpoucet.PartNode;
import ca.uqac.lif.petitpoucet.function.ExplanationQueryable;
import ca.uqac.lif.petitpoucet.function.RelationNodeFactory;
import ca.uqac.lif.synthia.NoMoreElementException;
import ca.uqac.lif.synthia.Picker;
import ca.uqac.lif.synthia.Shrinkable;
Expand Down Expand Up @@ -70,11 +70,11 @@ public Picker<T> duplicate(boolean with_state)
@Override
public PartNode getExplanation(Part p)
{
return getExplanation(p, NodeFactory.getFactory());
return getExplanation(p, RelationNodeFactory.getFactory());
}

@Override
public PartNode getExplanation(Part p, NodeFactory arg1)
public PartNode getExplanation(Part p, RelationNodeFactory arg1)
{
// Nothing is the end of the chain
return null;
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/src/ca/uqac/lif/synthia/util/Tick.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Synthia, a data structure generator
Copyright (C) 2019-2020 Laboratoire d'informatique formelle
Copyright (C) 2019-2023 Laboratoire d'informatique formelle
Université du Québec à Chicoutimi, Canada
This program is free software: you can redistribute it and/or modify
Expand All @@ -19,10 +19,10 @@
package ca.uqac.lif.synthia.util;

import ca.uqac.lif.petitpoucet.AndNode;
import ca.uqac.lif.petitpoucet.NodeFactory;
import ca.uqac.lif.petitpoucet.Part;
import ca.uqac.lif.petitpoucet.PartNode;
import ca.uqac.lif.petitpoucet.function.ExplanationQueryable;
import ca.uqac.lif.petitpoucet.function.RelationNodeFactory;
import ca.uqac.lif.synthia.Picker;
import ca.uqac.lif.synthia.explanation.NthSuccessiveOutput;
import ca.uqac.lif.synthia.random.RandomFloat;
Expand Down Expand Up @@ -208,11 +208,11 @@ public String toString()
@Override
public PartNode getExplanation(Part p)
{
return getExplanation(p, NodeFactory.getFactory());
return getExplanation(p, RelationNodeFactory.getFactory());
}

@Override
public PartNode getExplanation(Part p, NodeFactory f)
public PartNode getExplanation(Part p, RelationNodeFactory f)
{
PartNode root = f.getPartNode(p, this);
int index = NthSuccessiveOutput.mentionedOutput(p);
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/src/ca/uqac/lif/synthia/vector/PrismPicker.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Synthia, a data structure generator
Copyright (C) 2019-2021 Laboratoire d'informatique formelle
Copyright (C) 2019-2023 Laboratoire d'informatique formelle
Université du Québec à Chicoutimi, Canada
This program is free software: you can redistribute it and/or modify
Expand All @@ -19,10 +19,10 @@
package ca.uqac.lif.synthia.vector;

import ca.uqac.lif.petitpoucet.AndNode;
import ca.uqac.lif.petitpoucet.NodeFactory;
import ca.uqac.lif.petitpoucet.Part;
import ca.uqac.lif.petitpoucet.PartNode;
import ca.uqac.lif.petitpoucet.function.ExplanationQueryable;
import ca.uqac.lif.petitpoucet.function.RelationNodeFactory;
import ca.uqac.lif.petitpoucet.function.vector.NthElement;
import ca.uqac.lif.synthia.Picker;
import ca.uqac.lif.synthia.explanation.NthSuccessiveOutput;
Expand Down Expand Up @@ -97,11 +97,11 @@ public int getDimension()
@Override
public PartNode getExplanation(Part p)
{
return getExplanation(p, NodeFactory.getFactory());
return getExplanation(p, RelationNodeFactory.getFactory());
}

@Override
public PartNode getExplanation(Part p, NodeFactory f)
public PartNode getExplanation(Part p, RelationNodeFactory f)
{
int index = NthSuccessiveOutput.mentionedOutput(p), part_index = NthElement.mentionedElement(p);
PartNode root = f.getPartNode(p, this);
Expand Down
Loading

0 comments on commit a0ee7f0

Please sign in to comment.