Dynamic programming · weighted intervals
Some choices fit.
Which fit best?
Give each activity a time window and a value. Compare taking it with leaving it out, then follow the table back to one best schedule.
One resource. Fixed times. Additive values.
- Choose compatible activities.
- Compare two smaller problems.
- Reconstruct the choices.
01 / set up
Your activities
Up to eight activities. Times 0–24, values 0–99, all whole numbers.
Touching is allowed. An activity ending at 4 can be followed by one starting at 4. The notation is [start, end). These are abstract time units.
02 / compare
Read the table
Finish order, then start, then ID. Row 0 is the empty prefix.
No activities considered yet.
An empty schedule is allowed.
Two alternatives for each row
| Row | Activity | p(j) | Take | Skip | OPT(j) | Decision |
|---|
p(j) is the last compatible earlier row, or 0. Equal take and skip values keep the skip alternative. Choose a row to inspect that prefix.
03 / reconstruct
Follow the choices back
Start at the row under inspection. A take jumps to p(j); a skip moves back one row.
Compare with earliest finish
Greedy value: · Best prefix value:
The file keeps these inputs, the full table, both schedules and the inspected prefix. It is a record to read, not a saved-session importer.
Keep learning
Twelve questions. Worked explanations.
Bring the original lesson into RecallWeave. Answer in your own order of discovery, review the explanations, retry missed connections and keep your study notes.
In the learner, choose the downloaded file under “Bring your own lesson”, review its preview, then select “Start this deck”. The links above use the project folder; the downloads work when this page is copied by itself.
Change one thing, then explain it.
- In the first example, lower D's value from 10 to 7. Which full schedule wins now?
- Load “Touching endpoints”. Move B's start from 2 to 1. Which compatibility link disappears?
- Give every activity value 0. Why can an empty schedule still be optimal?
Assumptions, tie rules and what the model leaves out
Activities have fixed start/end times, require one shared resource, and contribute independent nonnegative values. You can select any compatible subset, including none. There are no setup gaps, dependencies, multiple rooms or uncertain durations. The page maximizes the stated sum of values, rather than the number of activities or time occupied.
Rows are ordered by end, start and exact ID. When take and skip are equal, the current row is skipped. This returns one deterministic optimum; another schedule can have the same best value. The earliest-finish schedule is shown as a comparison heuristic for total value and may tie or fall short. The full algorithm uses sorting and predecessor search; this explorer caps inputs at eight activities to keep every step readable.
Everything runs in this page. Fields stay in tab memory and are not saved automatically. Downloads are explicit local files. This original teaching example does not establish learning efficacy or supply an external scheduling service.