xiaohongshu
xiaohongshu
create-playground
Create and maintain the interactive Streamlit playground for learning VRP-Toolkit through hands-on exploration. Use this skill when adding playground features, integrating new algorithms, or enhancing the learning experience.
Full skill instructions
Create and maintain an interactive Streamlit playground that enables "learn by playing" instead of "learn by reading code."
Build and evolve a web-based playground where users can:
Following the vision in playground/VISION.md:
Understand what the user wants to learn or build:
Questions to ask:
Common requests:
Choose appropriate Streamlit components:
Reference: references/ui_components.md for patterns
Component selection guide:
st.slider, st.number_input, st.selectboxst.file_uploader, st.radio, st.multiselectst.pyplot, st.plotly_chart, st.mapst.dataframe, st.metric, st.jsonst.columns, st.tabs, st.expanderProgressive disclosure:
st.expander("Advanced")Map playground interactions to toolkit APIs:
Reference: references/integration_patterns.md for examples
Integration checklist:
from vrp_toolkit.problems import ...)Key integration points:
PDPTWInstance, VRPProblem, etc.ALNSSolver, ALNSConfig, etc.OrderGenerator, DemandGenerator, RealMapPDPTWVisualizer, route plottingMake algorithm behavior visible:
Visualization types:
Best practices:
vrp_toolkit.visualization modules when possibleEnsure playground behavior matches actual code:
Reference: Create tests in contracts/ directory
Critical contracts to test:
Reproducibility: Same seed + same config → same result
def test_reproducibility():
config = {...}
result1 = run_with_seed(config, seed=42)
result2 = run_with_seed(config, seed=42)
assert result1 == result2
Feasibility: Playground claims "feasible" → solution actually feasible
def test_feasibility_contract():
solution = playground_run(...)
if playground_says_feasible(solution):
assert actually_feasible(solution)
Evaluation consistency: Playground displays correct objective value
def test_objective_value_contract():
solution = playground_run(...)
displayed_cost = playground_display_cost(solution)
actual_cost = solution.objective_value
assert displayed_cost == actual_cost
Parameter validation: Invalid inputs rejected with clear messages
def test_parameter_validation():
with pytest.raises(ValueError, match="num_vehicles must be positive"):
playground_run(num_vehicles=-1)
Keep documentation synchronized with playground features:
Files to update:
playground/README.md - User-facing usage guide
playground/FEATURES.md - Feature tracking
playground/ARCHITECTURE.md - Technical documentation
CHANGELOG_LEARNINGS.md (if bugs fixed)
Organize playground code for maintainability:
playground/
├── app.py # Main entry point (home page)
├── pages/ # Multi-page app sections
│ ├── 1_Problem_Definition.py
│ ├── 2_Algorithm_Config.py
│ └── 3_Experiments.py
├── components/ # Reusable UI components
│ ├── instance_viewer.py # Display instance details
│ ├── route_visualizer.py # Plot routes on map
│ ├── convergence_plot.py # Show cost over iterations
│ └── metrics_dashboard.py # Display KPIs
├── utils/ # Helper functions
│ ├── state_manager.py # Session state management
│ ├── export_utils.py # Save/load experiments
│ └── validation.py # Input validation
├── README.md # Usage guide
├── FEATURES.md # Feature tracking
├── ARCHITECTURE.md # Technical docs
└── requirements.txt # Streamlit + dependencies
Timeline: 1-2 evenings Goal: Get something playable
Features:
Deliverables:
Timeline: 2-3 evenings Goal: Make learning actionable
Features:
Deliverables:
Timeline: Future iterations Goal: Self-driven learning
Features:
import streamlit as st
def render_algorithm_config():
"""Render ALNS parameter configuration UI."""
st.subheader("ALNS Configuration")
# Core parameters (always visible)
max_iterations = st.slider("Max Iterations", 100, 10000, 1000, step=100)
start_temp = st.number_input("Start Temperature", 0.1, 100.0, 10.0)
# Advanced parameters (in expander)
with st.expander("Advanced Parameters"):
cooling_rate = st.slider("Cooling Rate", 0.90, 0.99, 0.95)
segment_length = st.number_input("Segment Length", 10, 200, 100)
# Create config object
from vrp_toolkit.algorithms.alns import ALNSConfig
config = ALNSConfig(
max_iterations=max_iterations,
start_temp=start_temp,
cooling_rate=cooling_rate,
segment_length=segment_length
)
return config
import json
from datetime import datetime
from pathlib import Path
def save_experiment(config, solution, metrics):
"""Save experiment to runs/ directory."""
timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
run_dir = Path(f"runs/{timestamp}")
run_dir.mkdir(parents=True, exist_ok=True)
# Save config
with open(run_dir / "config.json", "w") as f:
json.dump(config, f, indent=2)
# Save solution
with open(run_dir / "solution.json", "w") as f:
json.dump(solution.to_dict(), f, indent=2)
# Save metrics
with open(run_dir / "metrics.json", "w") as f:
json.dump(metrics, f, indent=2)
st.success(f"Experiment saved to {run_dir}")
return run_dir
def run_algorithm_with_feedback():
"""Run algorithm with user-friendly error handling."""
try:
solution = solver.solve(instance)
st.success("✅ Algorithm completed successfully")
return solution
except ValueError as e:
st.error(f"❌ Invalid input: {e}")
st.info("💡 Hint: Check that all parameters are positive")
return None
except Exception as e:
st.error(f"❌ Unexpected error: {e}")
st.warning("🐛 This might be a bug. Please report it.")
return None
Before marking a playground feature as "complete":
Works with:
Maintains:
references/streamlit_guide.md - Streamlit basics and best practicesreferences/ui_components.md - Common UI component patternsreferences/integration_patterns.md - How to integrate vrp-toolkit modulesplayground/VISION.md - Design philosophy and principlesRemember: The goal is learning through interaction, not building a production app. Prioritize clarity and educational value over performance optimization.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience