public void TieBreakAudioFileOptions(SearchMethodType searchMethod) { FilterBetterAccuracyScores(); if (searchMethod == SearchMethodType.Forwards) { TieBreakerBestTrackPoints(); TieBreakerBestArtistAlbumPoints(); } else if (searchMethod == SearchMethodType.Backwards) { TieBreakerBestArtistAlbumPoints(); TieBreakerBestTrackPoints(); } TieBreakerBestTotalPoints(); TieBreakerAccuracyScore(); //Since we now have a manual version in place, we are going to keep the 'Duplicate Options' for manual choice later (they will be marked as "High Risk" because final options pool is > 1). //RemoveDuplicateFileOptions(); //RemoveDuplicateHighAccuracyScoreOptions(); }
public void Start(GoBoard goBoard, Color playerToMove, SearchOptions searchOptions, SearchMethodType searchMethodType, OnCompletion onCompletion) { // stop existing search, if any if (SearchInterface != null) Stop(); if (SearchMethodType != searchMethodType) { SearchMethodType = searchMethodType; SearchInterface = SearchMethodFactory.CreateFactory(searchMethodType); } // make a private copy of the board Board = goBoard.Clone(); // make a private copy of the search options SearchOptions = searchOptions.Clone(); // set player to move PlayerToMove = playerToMove; // set the Nag Coordinator SearchInterface.SetNagCoordinator(NagCoordinator); // initialize the search parameters SearchInterface.Initialize(Board, PlayerToMove, SearchOptions, onCompletion); // start search SearchThread = new Thread(this.StartThread); SearchThread.Start(); }
/// <summary> /// Initializes a new instance of the <see cref="MultiSearcherEventArgs"/> class. /// </summary> /// <param name="indexNames">Names of the indexes that are being searched.</param> /// <param name="methodType">The search method type that is being used.</param> /// <param name="location">The location within the method body where this event was fired from.</param> /// <param name="result">The search result was found, otherwise null.</param> public MultiSearcherEventArgs(string[] indexNames, SearchMethodType methodType, SearchMethodLocation location, SearchResult result) { this.indexNames = indexNames; this.SearchMethodType = methodType; this.SearchMethodLocation = location; this.SearchResult = result; }
public void Start(GoBoard goBoard, Color playerToMove, SearchOptions searchOptions, SearchMethodType searchMethodType, OnCompletion onCompletion) { // stop existing search, if any if (SearchInterface != null) { Stop(); } if (SearchMethodType != searchMethodType) { SearchMethodType = searchMethodType; SearchInterface = SearchMethodFactory.CreateFactory(searchMethodType); } // make a private copy of the board Board = goBoard.Clone(); // make a private copy of the search options SearchOptions = searchOptions.Clone(); // set player to move PlayerToMove = playerToMove; // set the Nag Coordinator SearchInterface.SetNagCoordinator(NagCoordinator); // initialize the search parameters SearchInterface.Initialize(Board, PlayerToMove, SearchOptions, onCompletion); // start search SearchThread = new Thread(this.StartThread); SearchThread.Start(); }
/// <summary> /// Initializes a new instance of the <see cref="MultiSearcherEventArgs"/> class. /// </summary> /// <param name="indexNames">Names of the indexes that are being searched.</param> /// <param name="methodType">The search method type that is being used.</param> /// <param name="location">The location within the method body where this event was fired from.</param> /// <param name="result">The search result was found, otherwise null.</param> public MultiSearcherEventArgs(string[] indexNames, SearchMethodType methodType, SearchMethodLocation location, SearchResult result) { this.indexNames = indexNames; this.SearchMethodType = methodType; this.SearchMethodLocation = location; this.SearchResult = result; }
/// <summary> /// Initializes a new instance of the <see cref="SearcherEventArgs"/> class. /// </summary> /// <param name="indexName">Name of the index that is being searched.</param> /// <param name="structure">The structure of the index that is being searched.</param> /// <param name="methodType">The search method type that is being used.</param> /// <param name="location">The location within the method body where this event was fired from.</param> /// <param name="result">The search result was found.</param> public SearcherEventArgs(string indexName, IndexType structure, SearchMethodType methodType, SearchMethodLocation location, SearchResult result) { this.indexName = indexName; this.structure = structure; this.SearchMethodType = methodType; this.SearchMethodLocation = location; this.SearchResult = result; }
/// <summary> /// Initializes a new instance of the <see cref="SearcherEventArgs"/> class. /// </summary> /// <param name="indexName">Name of the index that is being searched.</param> /// <param name="structure">The structure of the index that is being searched.</param> /// <param name="methodType">The search method type that is being used.</param> /// <param name="location">The location within the method body where this event was fired from.</param> /// <param name="result">The search result was found.</param> public SearcherEventArgs(string indexName, IndexType structure, SearchMethodType methodType, SearchMethodLocation location, SearchResult result) { this.indexName = indexName; this.structure = structure; this.SearchMethodType = methodType; this.SearchMethodLocation = location; this.SearchResult = result; }
public void FinishCollection(SearchMethodType winningMethod) { _WinningMethod = winningMethod; if (_WinningMethod == SearchMethodType.Forwards) { if (_ForwardsFinalPass != null) { _BestOption = _ForwardsFinalPass.GetCandidateOption(); _ChosenFinalPassCount = _ForwardsFinalPassCount; _ForwardsPass1.ShrinkOptionsListForPrinting(_BestOption); _ForwardsPass2.ShrinkOptionsListForPrinting(_BestOption); _ForwardsFinalPass.ShrinkOptionsListForPrinting(_BestOption); _ForwardsPass1.FinishAllOptions(); //Not necessary to finish pass1 options until now _IsCollectionFinished = true; } if (_BackwardsFinalPass != null) //Backwards method was used also { _BackwardsPass1.ShrinkOptionsListForPrinting(); _BackwardsPass2.ShrinkOptionsListForPrinting(); _BackwardsFinalPass.ShrinkOptionsListForPrinting(); _BackwardsPass1.FinishAllOptions(); //Not necessary to finish pass1 options until now } } else if (_WinningMethod == SearchMethodType.Backwards) { if (_BackwardsFinalPass != null) { _BestOption = _BackwardsFinalPass.GetCandidateOption(); _ChosenFinalPassCount = _BackwardsFinalPassCount; _BackwardsPass1.ShrinkOptionsListForPrinting(_BestOption); _BackwardsPass2.ShrinkOptionsListForPrinting(_BestOption); _BackwardsFinalPass.ShrinkOptionsListForPrinting(_BestOption); _BackwardsPass1.FinishAllOptions(); //Not necessary to finish pass1 options until now _IsCollectionFinished = true; } if (_ForwardsFinalPass != null) //Forwards method was used also { _ForwardsPass1.ShrinkOptionsListForPrinting(); _ForwardsPass2.ShrinkOptionsListForPrinting(); _ForwardsFinalPass.ShrinkOptionsListForPrinting(); _ForwardsPass1.FinishAllOptions(); //Not necessary to finish pass1 options until now } } }
/// <summary> /// Initializes a new instance of the <see cref="SearchInfo"/> class. /// </summary> /// <param name="indexName">Name of the index.</param> /// <param name="query">The query.</param> /// <param name="methodType">Type of the method.</param> /// <param name="totalResultsFound">The total results found.</param> /// <param name="wasCanceled">if set to <c>true</c> [was canceled].</param> /// <param name="createTime">The create time.</param> public SearchInfo(string indexName, string query, SearchMethodType methodType, int totalResultsFound, bool wasCanceled, DateTime createTime) { this.searchMethodType = methodType; this.totalResultsFound = totalResultsFound; this.query = query; this.canceled = wasCanceled; this.createdTime = createTime; this.indexName = indexName; }
/// <summary> /// Initializes a new instance of the <see cref="MultiSearcherEventArgs"/> class. /// </summary> /// <param name="indexNames">Names of the indexes that are being searched.</param> /// <param name="methodType">The search method type that is being used.</param> /// <param name="location">The location within the method body where this event was fired from.</param> /// <param name="field">The field name to create a SearchResult instance from.</param> /// <param name="value">The value of the field to create a SearchResult instance from.</param> /// <param name="boost">The amount of relevance applied to the search result.</param> internal MultiSearcherEventArgs(string[] indexNames, SearchMethodType methodType, SearchMethodLocation location, string field, string value, float boost) { this.indexNames = indexNames; this.SearchMethodType = methodType; this.SearchMethodLocation = location; Dictionary<string, string> values = new Dictionary<string, string>(); values.Add(field, value); this.SearchResult = new SearchResult(values, string.Join(", ", indexNames), boost); }
/// <summary> /// Initializes a new instance of the <see cref="SearchInfo"/> class. /// </summary> /// <param name="indexName">Name of the index.</param> /// <param name="query">The query.</param> /// <param name="methodType">Type of the method.</param> /// <param name="totalResultsFound">The total results found.</param> /// <param name="wasCanceled">if set to <c>true</c> [was canceled].</param> /// <param name="createTime">The create time.</param> public SearchInfo(string indexName, string query, SearchMethodType methodType, int totalResultsFound, bool wasCanceled, DateTime createTime) { this.searchMethodType = methodType; this.totalResultsFound = totalResultsFound; this.query = query; this.canceled = wasCanceled; this.createdTime = createTime; this.indexName = indexName; }
/// <summary> /// Initializes a new instance of the <see cref="MultiSearcherEventArgs"/> class. /// </summary> /// <param name="indexNames">Names of the indexes that are being searched.</param> /// <param name="methodType">The search method type that is being used.</param> /// <param name="location">The location within the method body where this event was fired from.</param> /// <param name="field">The field name to create a SearchResult instance from.</param> /// <param name="value">The value of the field to create a SearchResult instance from.</param> /// <param name="boost">The amount of relevance applied to the search result.</param> internal MultiSearcherEventArgs(string[] indexNames, SearchMethodType methodType, SearchMethodLocation location, string field, string value, float boost) { this.indexNames = indexNames; this.SearchMethodType = methodType; this.SearchMethodLocation = location; Dictionary <string, string> values = new Dictionary <string, string>(); values.Add(field, value); this.SearchResult = new SearchResult(values, string.Join(", ", indexNames), boost); }
/// <summary> /// Initializes a new instance of the <see cref="SearcherEventArgs"/> class. /// </summary> /// <param name="indexName">Name of the index that is being searched.</param> /// <param name="structure">The structure of the index that is being searched.</param> /// <param name="methodType">The search method type that is being used.</param> /// <param name="location">The location within the method body where this event was fired from.</param> /// <param name="field">The field name to create a SearchResult instance from.</param> /// <param name="value">The value of the field to create a SearchResult instance from.</param> /// <param name="boost">The amount of relevance applied to the search result.</param> internal SearcherEventArgs(string indexName, IndexType structure, SearchMethodType methodType, SearchMethodLocation location, string field, string value, float boost) { this.indexName = indexName; this.structure = structure; this.SearchMethodType = methodType; this.SearchMethodLocation = location; Dictionary<string, string> values = new Dictionary<string, string>(); values.Add(field, value); this.SearchResult = new SearchResult(values, this.indexName, boost); }
public void ScoreTrackNumberTrackPoints(SearchMethodType searchType) { //Track Tokens------------------------------------------------------------------------- foreach (string trackToken in _LSRTokens.TrackTokens.GetTokens) { ScoreTrackPoints(trackToken, _LibraryFile.NormalizedFilename); } //Track Number Tokens------------------------------------------------------------------ if (_LibraryFile.IsTrackNumberDetected) { foreach (string trackNumberToken in _LSRTokens.TrackNumberTokens.GetTokens) { ScoreTrackNumberPoints(trackNumberToken, _LibraryFile.TrackNumber, _LSRTokens.SearchStrategy); } } else //Track# might not be in its standard position at beginning of filename (so try anywhere in filename) { foreach (string trackNumberToken in _LSRTokens.TrackNumberTokens.GetTokens) { ScoreTrackNumberPoints(trackNumberToken, _LibraryFile.NormalizedFilenameNoCycleCodes, _LSRTokens.SearchStrategy); //Make sure trackNumber tokens don't score inside of any cycle codes } } if (_LSRTokens.SearchStrategy == SearchStrategyType.CD) { if (_ScoringTrackTokens.Count > 0 && _ScoringTrackTokens.First() == _LSRTokens.TrackTokens.GetTokens.First()) { if (_HasScoredTrackNumber) { string dynamicBonusToken = _ScoringTrackNumberTokens.First() + _ScoringTrackTokens.First(); ScoreDynamicBonusPoints(dynamicBonusToken, _LibraryFile.NormalizedFilename); } } } if (_HasScoredTrackNumber && _ScoringTrackNumberTokens.Count < _LSRTokens.TrackNumberTokens.GetTokens.Count) //Track# tokens have scored, but not all of the track# tokens have scored { List <string> notScoringTrackNumberTokens = _LSRTokens.TrackNumberTokens.GetTokens.Except(_ScoringTrackNumberTokens).ToList(); //Some trackNumber tokens are padded with leading zeros and they might not score, but the non-padded one did (or vice-versus). We can treat them as all having scored in this case. foreach (string notScoringTrackNumberToken in notScoringTrackNumberTokens) { _ScoringTrackNumberTokens.Add(notScoringTrackNumberToken); _ScoringTokenCount += 1; } } if (searchType == SearchMethodType.Backwards && _LSRTokens.SearchStrategy == SearchStrategyType.OTHER) { ScoreCyclePoints(_LibraryFile.NormalizedFilenameNoTrackNumber); //make sure cycle tokens don't score on the tracknumber } }
/// <summary> /// Initializes a new instance of the <see cref="SearcherEventArgs"/> class. /// </summary> /// <param name="indexName">Name of the index that is being searched.</param> /// <param name="structure">The structure of the index that is being searched.</param> /// <param name="methodType">The search method type that is being used.</param> /// <param name="location">The location within the method body where this event was fired from.</param> /// <param name="field">The field name to create a SearchResult instance from.</param> /// <param name="value">The value of the field to create a SearchResult instance from.</param> /// <param name="boost">The amount of relevance applied to the search result.</param> internal SearcherEventArgs(string indexName, IndexType structure, SearchMethodType methodType, SearchMethodLocation location, string field, string value, float boost) { this.indexName = indexName; this.structure = structure; this.SearchMethodType = methodType; this.SearchMethodLocation = location; Dictionary <string, string> values = new Dictionary <string, string>(); values.Add(field, value); this.SearchResult = new SearchResult(values, this.indexName, boost); }
public static SearchMethodType ToType(string name) { SearchMethodType lSearchMethodType = SearchMethodType.Unassigned; if (!Instance.Dictionary.TryGetValue(name.Trim().ToLower(), out lSearchMethodType)) { return(SearchMethodType.Unassigned); } return(lSearchMethodType); }
public static ISearchMethodInterface CreateFactory(SearchMethodType searchType) { switch (searchType) { case SearchMethodType.MinMax: return(new SearchMethodMinMax(new SearchStandard())); case SearchMethodType.AlphaBeta: return(new SearchMethodAlphaBeta(new SearchStandard())); case SearchMethodType.AlphaBeta_ID_PVS: return(new SearchMethodAB_ID_PVS(new SearchStandard())); case SearchMethodType.AlphaBeta_ID_TT_PVS: return(new SearchMethodAB_ID_TT_PVS(new SearchStandard())); case SearchMethodType.AlphaBeta_ID_TT: return(new SearchMethodAB_ID_TT(new SearchStandard())); case SearchMethodType.AlphaBeta_NAG_ID_TT: return(new SearchMethodAB_NAG_ID_TT(new SearchStandard())); default: return(new SearchMethodAB_ID_TT(new SearchStandard())); } }
public bool IsOptionQuickSearchElligible(AudioFileOption candidateOption, SearchMethodType method, int accuracyThreshold) { if (!_IsCollectionFinished) { if (method == SearchMethodType.Forwards) { _ChosenFinalPassCount = _ForwardsFinalPassCount; } if (method == SearchMethodType.Backwards) { _ChosenFinalPassCount = _BackwardsFinalPassCount; } _BestOption = candidateOption; } if (candidateOption.AccuracyScore < accuracyThreshold) { return(false); } if (_ChosenFinalPassCount > 1) { return(false); } SuggestedAudioFile suggestedFile = new SuggestedAudioFile(this); if (suggestedFile.AccuracyType != AccuracyType.Accurate) //SafetyNetChecks() in SuggestedAudioFile could mark it as 'Questionable' { return(false); } return(true); }
/// <summary> /// Initializes a new instance of the <see cref="MultiSearcherEventArgs"/> class. /// </summary> /// <param name="indexNames">Names of the indexes that are being searched.</param> /// <param name="methodType">The search method type that is being used.</param> /// <param name="location">The location within the method body where this event was fired from.</param> public MultiSearcherEventArgs(string[] indexNames, SearchMethodType methodType, SearchMethodLocation location) : this(indexNames, methodType, location, null) { }
protected void Add(string typeName, SearchMethodType searchType) { Dictionary.Add(typeName, searchType); }
/// <summary> /// Initializes a new instance of the <see cref="MultiSearcherEventArgs"/> class. /// </summary> /// <param name="indexNames">Names of the indexes that are being searched.</param> /// <param name="methodType">The search method type that is being used.</param> /// <param name="location">The location within the method body where this event was fired from.</param> public MultiSearcherEventArgs(string[] indexNames, SearchMethodType methodType, SearchMethodLocation location) : this(indexNames, methodType, location, null) { }
/// <summary> /// Initializes a new instance of the <see cref="SearcherEventArgs"/> class. /// </summary> /// <param name="indexName">Name of the index that is being searched.</param> /// <param name="structure">The structure of the index that is being searched.</param> /// <param name="methodType">The search method type that is being used.</param> /// <param name="location">The location within the method body where this event was fired from.</param> public SearcherEventArgs(string indexName, IndexType structure, SearchMethodType methodType, SearchMethodLocation location) : this(indexName, structure, methodType, location, null) { }
public void SetSearchMethod(SearchMethodType searchMethodType) { SearchMethodType = searchMethodType; }
protected void Add(string typeName, SearchMethodType searchType) { Dictionary.Add(typeName, searchType); }
/// <summary> /// Initializes a new instance of the <see cref="SearchInfo"/> class. /// </summary> /// <param name="query">The query.</param> /// <param name="indexName">Name of the index.</param> /// <param name="methodType">Type of the method.</param> /// <param name="totalResultsFound">The total results found.</param> /// <param name="wasCanceled">if set to <c>true</c> [was canceled].</param> public SearchInfo(string indexName, string query, SearchMethodType methodType, int totalResultsFound, bool wasCanceled) : this(indexName, query, methodType, totalResultsFound, wasCanceled, DateTime.Now) { }
/// <summary> /// Initializes a new instance of the <see cref="SearchInfo"/> class. /// </summary> /// <param name="query">The query.</param> /// <param name="indexName">Name of the index.</param> /// <param name="methodType">Type of the method.</param> /// <param name="totalResultsFound">The total results found.</param> /// <param name="wasCanceled">if set to <c>true</c> [was canceled].</param> public SearchInfo(string indexName, string query, SearchMethodType methodType, int totalResultsFound, bool wasCanceled) : this(indexName, query, methodType, totalResultsFound, wasCanceled, DateTime.Now) { }
public static ISearchMethodInterface CreateFactory(SearchMethodType searchType) { switch (searchType) { case SearchMethodType.MinMax: return new SearchMethodMinMax(new SearchStandard()); case SearchMethodType.AlphaBeta: return new SearchMethodAlphaBeta(new SearchStandard()); case SearchMethodType.AlphaBeta_ID_PVS: return new SearchMethodAB_ID_PVS(new SearchStandard()); case SearchMethodType.AlphaBeta_ID_TT_PVS: return new SearchMethodAB_ID_TT_PVS(new SearchStandard()); case SearchMethodType.AlphaBeta_ID_TT: return new SearchMethodAB_ID_TT(new SearchStandard()); case SearchMethodType.AlphaBeta_NAG_ID_TT: return new SearchMethodAB_NAG_ID_TT(new SearchStandard()); default: return new SearchMethodAB_ID_TT(new SearchStandard()); } }
public void SetSearchMethod(SearchMethodType searchMethodType) { SearchMethodType = searchMethodType; }
/// <summary> /// Initializes a new instance of the <see cref="SearcherEventArgs"/> class. /// </summary> /// <param name="indexName">Name of the index that is being searched.</param> /// <param name="structure">The structure of the index that is being searched.</param> /// <param name="methodType">The search method type that is being used.</param> /// <param name="location">The location within the method body where this event was fired from.</param> public SearcherEventArgs(string indexName, IndexType structure, SearchMethodType methodType, SearchMethodLocation location) : this(indexName, structure, methodType, location, null) { }