public Task(TModel src, TModel tgt) { if (tgt.R == 0) { tgt = TModel.MakeEmpty(src.Name, src.R); } if (src.R == 0) { src = TModel.MakeEmpty(tgt.Name, tgt.R); } Src = src; Tgt = tgt; }
private static void Main(string[] args) { var modelName = "FR001"; //var modelName = "FA001"; var srcModel = new TModel($"Data/Problems/{modelName}_src.mdl"); var tgtModel = new TModel($"Data/Problems/{modelName}_tgt.mdl"); //var srcModel = TModel.MakeEmpty(tgtModel.Name, tgtModel.R); //var tgtModel = TModel.MakeEmpty(srcModel.Name, srcModel.R); void TestStrategy(IStrategy strategy, bool saveTrace = false) { Console.WriteLine($"=== {strategy.Name}"); try { var trace = strategy.MakeTrace(srcModel, tgtModel); if (saveTrace) { File.WriteAllBytes("trace.nbt", TraceSerializer.Serialize(trace)); } if (trace == null) { Console.WriteLine(" empty trace"); return; } var state = new TState(srcModel); var reader = new TCommandsReader(trace); while (!reader.AtEnd()) { state.Step(reader); } Console.WriteLine(state.HasValidFinalState(tgtModel)); Console.WriteLine(state.Energy); } catch (Exception e) { Console.Write($"BROKENL {e}"); } } //TestStrategy(new DumpCubeStrategy()); //TestStrategy(new DumpCubeStrategy(), true); TestStrategy(new TTraceReaderStrategy($"data/DefaultTraces")); TestStrategy(new BfsStrategy(), true); }
private List <KeyValuePair <TModel, TModel> > LoadReassemblyModels(string modelsDirectory) { List <KeyValuePair <TModel, TModel> > result = new List <KeyValuePair <TModel, TModel> >(); foreach (var file in Directory.EnumerateFiles(modelsDirectory)) { string name = Path.GetFileNameWithoutExtension(file); if (!name.Contains("FR") || !name.Contains("_tgt")) { continue; } string srcPath = file.Replace("_tgt", "_src"); TModel srcModel = new TModel(srcPath); TModel tgtModel = new TModel(file); result.Add(new KeyValuePair <TModel, TModel>(srcModel, tgtModel)); } result.Reverse(); return(result); }