A Telegram bot to help you find the best option from a list of commute (or other) options using Thompson Sampling algorithms for Mean-Variance Bandits (paper).
- Create optimizations (scenarios/decision problems) and add variants (options) to them.
- Add observations (sample data) for each variant.
- Use Thompson Sampling to recommend the best variant based on your data.
- All main user flows are available via inline keyboards for ease of use.
- Handles long optimization names and callback data limits.
- All core logic and database operations are covered by tests (92% coverage).
This project is archived and no longer under active development. All planned core features have been implemented:
- Create new optimizations and variants
- Add options/observations via inline keyboard
- Handle callback data length issues
- Core logic for mean-variance bandit and numeric optimizations
- Database schema and migrations for all main entities
- Test coverage for all main modules
- Dockerfile for containerized deployment
- User-friendly error handling and messaging
- Inline keyboard for type selection (numeric/yes-no)
- Binomial (yes/no) optimizations: UI stub, logic in development (not production-ready)
- Binomial (yes/no) optimizations are not fully implemented (UI will inform user)
- No /back navigation or persistent state for user flows
- No persistent selection of optimization between steps
- Help/about messages could be improved for non-technical users
- Some edge cases (e.g., very long names > 280 bytes) may still need handling
-
Clone the repository and install requirements:
pip install -r requirements.txt
-
Set up your Telegram bot token in a
.envfile or via environment variable. -
Run the bot:
python main.py
-
Or build and run with Docker:
docker build -t ksetdekov/trip_choice_optimizer:latest . docker run --env-file .env ksetdekov/trip_choice_optimizer:latest
Run tests and see coverage:
coverage run --source=. -m unittest discover && coverage reportThis bot was created as a practical tool and demo for applying mean-variance bandit algorithms to real-world decision problems. It is now archived and not maintained further. For questions, see the code or contact the author.