-
Notifications
You must be signed in to change notification settings - Fork 831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Teambuilder: Add EV optimization checker #2240
Conversation
It’s not necessary to use a brute force approach, or even any kind of iterative approach. The plus, if it moves at all, will always optimally move to the highest raw stat that’s been invested in. The point of moving the plus is to get the highest absolute stat increase from the 10% bonus, regardless of whether that comes from the base stat or EV. The minus, similarly, should only move to the lowest raw stat that’s been invested in to at most what it would be at 252-. Furthermore, the plus can never move from a stat that is boosted further than it could be at 252 neutral (you at least thought of this) while the minus should never move from an uninvested stat as there are no EVs in that stat that can be redistributed for optimization purposes. The focus of this optimizer should be on saving EVs and not on increasing stats. Sometimes improving the stats happens as a bonus when the stat we’re already moving the plus to either happens to be 1 less than a multiple of 11 or is a high base stat that was originally invested to less than what it would be at 0+, but if we can either provide the exact same stat spread for fewer EVs or a slightly stronger spread for the same EVs, we should be giving the spread that uses fewer EVs every time and leaving it up to the user to determine where the remainder goes. After all, once they reinvest their saved EVs after optimizing their spread, the optimizer will automatically run again anyway. |
Yeah I know brute force is inefficient here. If anyone can implement this without brute force that would be cool, I just did this cause it was easier.
Not sure what you mean by this, since I am trying to return the spread that saved the most EVs. Did you find a case where it returned a spread with higher stats instead of more saved EVs? |
Try this set:
The correct output would be this, saving 56 EVs:
This code will instead output this, saving only 28:
This is because if the current nature attempt doesn’t beat the current best in EVs saved, it falls back to checking if it beats that spread in stats, and if it does, it saves that spread as the new one to beat, and all future attempts will have to invest extra EVs to match the higher stats. However, if you only fix that and make it simply discard attempts that have fewer leftover EVs than the current best, it will keep outputting the Brave set because the very first set it generates is this:
The reason these over-invested spreads happen in the first place is that the brute-forcer tries moving the minus off of a stat that was lower than it would be at 0 with a neutral nature, and if that happens to coincide with the plus being moved to the correct stat, it ends up with spare EVs that it can afford to use to shore up the new minus stat to bring it up to 0 neutral level. In this case, the very first nature it tries, Adamant, sets an overly high standard for Special Defense that prevents Naughty, the actual optimal nature, from being selected as it can only match the Adamant spread for exact stats and EV usage. These problems are best avoided by simply not brute forcing in the first place. |
… the same this makes both trapinch and amoonguss work as expected
Good work Karthik and pyuk! |
* Update HiZo Credits (smogon#2223) * Teambuilder: Provide Smogon Dex resources when building teams * Teambuilder: Fix target on Smogon links * Teambuilder: Don't try to load resources when they're already cached * Teambuilder: Cache failures for formats without resources * Modify CSS for accessibility * Rules: Add Korean translation (smogon#2221) Credits to igeu , xerneas9050 and dhwna for the translation, aegii for the formatting. * Remove a certain someone from credits Been spending some time processing the last decade of my life, including reading some old logs from the period where this user was banned, and I've decided that I have to make this commit to be able to move on. * Add package-lock.json * Remove unnecessary jabs at PO, which doesn't even exist anymore * One more * Improve dark mode checkboxes * Let's Go: Support itemless megas (smogon#2233) * Teambuilder: Show Restricted Legendaries for VGC/BSS Reg G (smogon#2239) * Add client support for Random Meta of the Decade * AFD Mode: Fix the ability to turn it off * Add support for adding badges in battle (smogon#2235) * Add support for adding badges in battle * oops Forgot these needed to be below the avatar per latest spec, not above * Move |badge| message handling to battle.ts * Update play.pokemonshowdown.com/src/battle.ts Co-authored-by: Karthik <32044378+Karthik99999@users.noreply.github.com> * Style button on ladder page, also add custom badges for ou/rands * change some badge filename stuff * more css stuff, final version --------- Co-authored-by: Karthik <32044378+Karthik99999@users.noreply.github.com> * Support rematching with custom rules (smogon#2234) * Teambuilder: Add EV optimization checker (smogon#2240) --------- Co-authored-by: pyuk-bot <msaimrkon@gmail.com> * Fix optimizer output when new spread has a 0 (smogon#2241) * Teambuilder: Generate user samples from boxes (smogon#2226) --------- Co-authored-by: Hisuian Zoroark <96159984+HisuianZoroark@users.noreply.github.com> Co-authored-by: Mia <49593536+mia-pi-git@users.noreply.github.com> Co-authored-by: Lionyx <choloux3@gmail.com> Co-authored-by: Christopher Monsanto <chris@monsan.to> Co-authored-by: Guangcong Luo <guangcongluo@gmail.com> Co-authored-by: Karthik <32044378+Karthik99999@users.noreply.github.com> Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com> Co-authored-by: Andrew Werner <HoeenCoder@users.noreply.github.com> Co-authored-by: pyuk-bot <msaimrkon@gmail.com> Co-authored-by: tofa <79044321+im-tofa@users.noreply.github.com>
* Support new ability flags * Update HiZo Credits (smogon#2223) * Teambuilder: Provide Smogon Dex resources when building teams * Teambuilder: Fix target on Smogon links * Teambuilder: Don't try to load resources when they're already cached * Teambuilder: Cache failures for formats without resources * Modify CSS for accessibility * Rules: Add Korean translation (smogon#2221) Credits to igeu , xerneas9050 and dhwna for the translation, aegii for the formatting. * Remove a certain someone from credits Been spending some time processing the last decade of my life, including reading some old logs from the period where this user was banned, and I've decided that I have to make this commit to be able to move on. * Add package-lock.json * Remove unnecessary jabs at PO, which doesn't even exist anymore * One more * Improve dark mode checkboxes * Let's Go: Support itemless megas (smogon#2233) * Teambuilder: Show Restricted Legendaries for VGC/BSS Reg G (smogon#2239) * Add client support for Random Meta of the Decade * AFD Mode: Fix the ability to turn it off * Add support for adding badges in battle (smogon#2235) * Add support for adding badges in battle * oops Forgot these needed to be below the avatar per latest spec, not above * Move |badge| message handling to battle.ts * Update play.pokemonshowdown.com/src/battle.ts Co-authored-by: Karthik <32044378+Karthik99999@users.noreply.github.com> * Style button on ladder page, also add custom badges for ou/rands * change some badge filename stuff * more css stuff, final version --------- Co-authored-by: Karthik <32044378+Karthik99999@users.noreply.github.com> * Support rematching with custom rules (smogon#2234) * Teambuilder: Add EV optimization checker (smogon#2240) --------- Co-authored-by: pyuk-bot <msaimrkon@gmail.com> * Fix optimizer output when new spread has a 0 (smogon#2241) * Teambuilder: Generate user samples from boxes (smogon#2226) * client: escape dots in URL regex (smogon#2243) * Changes for all of the s13 buffs. * Updates for S13 * lots of fixes including for replays which should be moved to the main RPTL branch. * Clarify 2D/3D Model Options (smogon#2244) * Main menu: Add a button to the partner selection input for partner formats * Add SSB client support (smogon#2245) * ssb support * SSB * teehee * poop * more tooltip things * Fix tooltips * ok support * More tooltip updates * last changes * Fix build * Updates fixing announcer and trusted external sites * Fix past gen tooltips (smogon#2247) * CAP: Add Chuggalong minisprite index * SSB: Client-side balance patch changes (smogon#2250) * SSB: Client-side balance patch changes * more changes * oops * Mark more evolution items as bad * Fix tooltips getting cleared when using switch moves (smogon#2251) * Override Fling and Natural Gift data for items in past gens (smogon#2252) * Teambuilder: Update Smogdex links * Add Psychic Noise animation (smogon#2254) * Add Psychic Noise animation * Satisfy linter * Replays: Fix More Replays button on mobile (smogon#2255) * Add Elo filter 1000 (smogon#2249) PR for https://www.smogon.com/forums/threads/give-an-option-for-1000-minimum-elo-in-the-battles-tab-to-filter-out-challenge-battles.3743305/ * Properly display legal egg moves in teambuilder (smogon#2256) * Include smogtours in "server down" message * Add teambuilder support for BW 1 (smogon#2257) * Fix crash in Replays * Fix teambuilder move display for formes (smogon#2258) * Fix teambuilder move display for formes https://www.smogon.com/forums/threads/bug-report-teambuilder.3746541/ This bug was caused by my assumption that the client gets changesFrom the same way the server does. * Update battle-dex-search.ts Linter got upset * Fix Ogerpon mask BP tooltip (smogon#2259) * Fix crash (client) (smogon#2260) * Point bug reports redirect to the subforum * Fix client sending the wrong team to the server in some cases (smogon#2206) * Convert noSketch to move flag (smogon#2261) * Chat: Support nameless /html messages (smogon#2263) * Teambuilder: Don't recommend 0 Atk IVs with Tera Blast * Fix ???-type icon loading on type change animations * Fix getAllyAbility for Gen < 7 (smogon#2264) * Fix paralysis tooltips in Gens I-II * Updates before cleanup. * Removing buffed pokemon --------- Co-authored-by: Karthik99999 <bandagondak0217@gmail.com> Co-authored-by: Leonard Craft III <leonardcraft64@gmail.com> Co-authored-by: Hisuian Zoroark <96159984+HisuianZoroark@users.noreply.github.com> Co-authored-by: Mia <49593536+mia-pi-git@users.noreply.github.com> Co-authored-by: Lionyx <choloux3@gmail.com> Co-authored-by: Christopher Monsanto <chris@monsan.to> Co-authored-by: Guangcong Luo <guangcongluo@gmail.com> Co-authored-by: Karthik <32044378+Karthik99999@users.noreply.github.com> Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com> Co-authored-by: Andrew Werner <HoeenCoder@users.noreply.github.com> Co-authored-by: pyuk-bot <msaimrkon@gmail.com> Co-authored-by: tofa <79044321+im-tofa@users.noreply.github.com> Co-authored-by: Auguste Charpentier <laggron42@gmail.com> Co-authored-by: Distrib <theodelhay@orange.fr> Co-authored-by: Marty-D <Marty-D@users.noreply.github.com> Co-authored-by: shrianshChari <30420527+shrianshChari@users.noreply.github.com> Co-authored-by: dot-Comfey <84290266+dot-Comfey@users.noreply.github.com> Co-authored-by: Earl Joves <278894+earljoves@users.noreply.github.com>
https://www.smogon.com/forums/threads/smart-ev-management-in-the-builder.3736254/