Bravos-Power / pyoframe

Rapidly formulate huge optimization models
https://bravos-power.github.io/pyoframe/
MIT License
2 stars 1 forks source link

Implemented base62 encoding of variable ID integer #26

Closed kjartan-at-bravos closed 5 months ago

kjartan-at-bravos commented 5 months ago

Added a new VariableMapping that maps variable IDs (UInt32) to a base 52 representation using letters a-zA-Z. This way, the representation is a valid variable name in the lp file. Possibly the idea can be taken even further, using more characters, since other characters are also allowed in the variable names. This would be straightforward to do, should we feel for it.

kjartan-at-bravos commented 5 months ago

I noticed a problem with the proposed mapping. For large problems, it will generate any combination of letters, including keywords of the lp-format. I see no other way around this than to add a prefix "x" to each variable name.

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.50%. Comparing base (dbffbcb) to head (5683135).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #26 +/- ## ========================================== + Coverage 94.35% 94.50% +0.15% ========================================== Files 13 13 Lines 797 819 +22 ========================================== + Hits 752 774 +22 Misses 45 45 ``` | [Flag](https://app.codecov.io/gh/Bravos-Power/pyoframe/pull/26/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Bravos-Power) | Coverage Δ | | |---|---|---| | [smart-tests](https://app.codecov.io/gh/Bravos-Power/pyoframe/pull/26/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Bravos-Power) | `94.50% <100.00%> (+0.15%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Bravos-Power#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.