private FluentString GetPropReport(ISolver solver, SolverState commandState) { Report.WriteLine("Solver: {0}", SolverHelper.Describe(solver)); var propsReport = new FluentString(); propsReport.Append(solver.TypeDescriptor); try { var typeDescriptorProps = solver.GetTypeDescriptorProps(commandState); if (typeDescriptorProps != null) { foreach (var(name, text) in typeDescriptorProps) { propsReport.AppendLine($"-> {name,20}: {text}"); Report.WriteLine($"-> {name,20}: {text}"); } } } catch (NotSupportedException) { var msg = $"Solver [{solver.GetType().Name}] does not support {typeof(IExtendedFunctionalityDescriptor).Name}"; Report.WriteLine(msg); propsReport.AppendLine(msg); } catch (NotImplementedException) { var msg = $"Solver [{solver.GetType().Name}] does not support {typeof(IExtendedFunctionalityDescriptor).Name}"; Report.WriteLine(msg); propsReport.AppendLine(msg); } return(propsReport); }
public string ToString(bool verbose, bool skipName = false) { var builder = new FluentString() .If(Name != null && !skipName, $"{Name,-40}"); if (DurationInSec <= 0d || TotalNodes <= 0) { return(builder.Append($"{TotalNodes,12:#,##0} nodes")); } builder.When(verbose, then => then.If(TotalDead >= 0, () => $" Dead={TotalDead:#,##0}:{TotalDead * 100 / TotalNodes:0}%") .If(Duplicates >= 0, () => $" Dup={Duplicates:#,##0}:{Duplicates * 100 / TotalNodes:0}%") .If(DepthCurrent >= 0, () => $" Depth={DepthCurrent:#,##0}:{DepthMax:#,##0}") .If(DepthCompleted >= 0, () => $" DepthComplete={DepthCompleted:#,##0}") ) .Append($"{TotalNodes,11:#,##0} nodes at {TotalNodes / DurationInSec,7:#,##0}/s in {Elapsed.Humanize()}"); return(builder); }