Skip to content

Commit

Permalink
Finish adding 'interface' mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisJefferson committed Aug 26, 2024
1 parent fb8b821 commit ceeae0e
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 17 deletions.
8 changes: 8 additions & 0 deletions gap/interface.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DeclareGlobalFunction( "GB_SimpleSearch" );

DeclareGlobalFunction( "GB_SimpleSinglePermSearch" );

DeclareGlobalFunction( "GB_SimpleAllPermSearch" );

DeclareGlobalFunction( "GB_CheckInitialGroup" );
DeclareGlobalFunction( "GB_CheckInitialCoset" );
66 changes: 66 additions & 0 deletions gap/interface.gi
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
InstallGlobalFunction( GB_SimpleSearch,
{ps, conlist, conf...} -> _BTKit.SimpleSearch(_GB.BuildProblem(ps, conlist, conf)));

InstallGlobalFunction( GB_SimpleSinglePermSearch,
function(ps, conlist, conf...)
local ret;
ret := _BTKit.SimpleSinglePermSearch(_GB.BuildProblem(ps, conlist, conf), true);
if IsEmpty(ret) then
return fail;
else
return ret[1];
fi;
end);

InstallGlobalFunction( GB_SimpleAllPermSearch,
{ps, conlist, conf...} -> _BTKit.SimpleSinglePermSearch(_GB.BuildProblem(ps, conlist, conf), false));

#! Build the initial graph stack, and return the automorphisms
#! of this graph stack. second argument is if this is the solution
#! (if not it will be a super-group of the solutions).
InstallGlobalFunction( GB_CheckInitialGroup,
function(ps, conlist)
local state, tracer, sols, saved, gens, ret;
state := _GB.BuildProblem(ps, conlist,[]);
tracer := RecordingTracer();
saved := SaveState(state);
InitialiseConstraints(state, tracer, true);

sols := _GB.AutoAndCanonical(state!.ps, state!.graphs);
gens := GeneratorsOfGroup(sols.grp);
gens := List(gens, x -> PermList(ListPerm(x, PS_Points(state!.ps))));

ret := ForAll(gens, p -> BTKit_CheckSolution(p, state!.conlist));

RestoreState(state, saved);
return rec(gens := gens, answer := ret);
end);


InstallGlobalFunction( GB_CheckInitialCoset,
function(ps, conlist)
local state, tracer, rbase, sols1, sols2, saved, autgraph1, autgraph2;
state := _GB.BuildProblem(ps, conlist,[]);
tracer := RecordingTracer();
saved := SaveState(state);
InitialiseConstraints(state, tracer, true);

sols1 := _GB.AutoAndCanonical(state!.ps, state!.graphs);

RestoreState(state, saved);

rbase := BuildRBase(state, state!.config.cellSelector);
FinaliseRBaseForConstraints(state, rbase);

tracer := RecordingTracer();
saved := SaveState(state);
InitialiseConstraints(state, tracer, false);

sols2 := _GB.AutoAndCanonical(state!.ps, state!.graphs);

RestoreState(state, saved);

autgraph1 := [OnDigraphs(sols1.graph[1], sols1.canonicalperm), List(sols1.graph[2], x -> OnSets(x, sols1.canonicalperm))];
autgraph2 := [OnDigraphs(sols2.graph[1], sols2.canonicalperm), List(sols2.graph[2], x -> OnSets(x, sols2.canonicalperm))];
return rec(graph1 := autgraph1, graph2 := autgraph2, equal := autgraph1 = autgraph2);
end);
11 changes: 8 additions & 3 deletions init.g
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
# Reading the declaration part of the package.
#

if not IsBound(_BT_SKIP_INTERFACE) then

if not IsBound(_BT_SKIP_INTERFACE) and not IsBound(_BTKit.InitInterfaceGB) then
_BTKit.InitInterfaceGB := true;
ReadPackage( "GraphBacktracking", "gap/interface.gd");
fi;

ReadPackage( "GraphBacktracking", "gap/GraphBacktracking.gd");
ReadPackage( "GraphBacktracking", "gap/Equitable.gd");
if not IsBound(_BTKit.FilesInitGB) then
_BTKit.FilesInitGB := true;
ReadPackage( "GraphBacktracking", "gap/GraphBacktracking.gd");
ReadPackage( "GraphBacktracking", "gap/Equitable.gd");
fi;
32 changes: 18 additions & 14 deletions read.g
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,26 @@
# Reading the implementation part of the package.
#

if not IsBound(_BTKit.FilesReadGB) then
_GB := AtomicRecord(rec());
fi;

# Private methods of package
_GB := AtomicRecord(rec());

if not IsBound(_BT_SKIP_INTERFACE) then
if not IsBound(_BT_SKIP_INTERFACE) and not IsBound(_BTKit.ReadInterfaceGB) then
_BTKit.ReadInterfaceGB := true;
ReadPackage( "GraphBacktracking", "gap/interface.gi");
fi;

ReadPackage( "GraphBacktracking", "gap/GraphBacktracking.gi");
ReadPackage( "GraphBacktracking", "gap/Equitable.gi");
ReadPackage( "GraphBacktracking", "gap/constraints/simpleconstraints.g");
ReadPackage( "GraphBacktracking", "gap/constraints/normaliser.g");
ReadPackage( "GraphBacktracking", "gap/constraints/canonicalconstraints.g");
ReadPackage( "GraphBacktracking", "gap/constraints/conjugacy.g");
ReadPackage( "GraphBacktracking", "gap/constraints/digraphs.g");
ReadPackage( "GraphBacktracking", "gap/refiners.gi");
if not IsBound(_BTKit.FilesReadGB) then
_BTKit.FilesReadGB := true;
ReadPackage( "GraphBacktracking", "gap/GraphBacktracking.gi");
ReadPackage( "GraphBacktracking", "gap/Equitable.gi");
ReadPackage( "GraphBacktracking", "gap/constraints/simpleconstraints.g");
ReadPackage( "GraphBacktracking", "gap/constraints/normaliser.g");
ReadPackage( "GraphBacktracking", "gap/constraints/canonicalconstraints.g");
ReadPackage( "GraphBacktracking", "gap/constraints/conjugacy.g");
ReadPackage( "GraphBacktracking", "gap/constraints/digraphs.g");
ReadPackage( "GraphBacktracking", "gap/refiners.gi");

Perform(["GB_Con", "_GB"],
SetNamesForFunctionsInRecord);
Perform(["GB_Con", "_GB"],
SetNamesForFunctionsInRecord);
fi;

0 comments on commit ceeae0e

Please sign in to comment.