Skip to content
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

Introduction to ScheduledProject #61

Merged
merged 3 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion examples/generator_scenarios.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import random
from itertools import chain

from sampo.generator import SimpleSynthetic, get_contractor_by_wg
from matplotlib import pyplot as plt

from sampo.generator.base import SimpleSynthetic
from sampo.generator.environment.contractor_by_wg import get_contractor_by_wg
from sampo.generator.pipeline.extension import extend_names, extend_resources
from sampo.scheduler.heft.base import HEFTScheduler
from sampo.schemas.graph import WorkGraph
Expand Down
141 changes: 66 additions & 75 deletions examples/local_optimization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"metadata": {
"collapsed": true,
"ExecuteTime": {
"start_time": "2023-07-01T21:15:24.697601Z",
"end_time": "2023-07-01T21:15:25.125812Z"
"end_time": "2023-10-31T08:06:06.215669600Z",
"start_time": "2023-10-31T08:06:05.535679400Z"
}
},
"outputs": [],
Expand Down Expand Up @@ -53,8 +53,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"start_time": "2023-07-01T21:15:25.122811Z",
"end_time": "2023-07-01T21:15:25.154843Z"
"end_time": "2023-10-31T08:06:06.275585700Z",
"start_time": "2023-10-31T08:06:06.215669600Z"
}
}
},
Expand Down Expand Up @@ -86,13 +86,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Swapped 1 times!\n",
"Swapped 1 times!\n"
"Swapped 0 times!\n"
]
},
{
"data": {
"text/plain": "8661"
"text/plain": "1194"
},
"execution_count": 3,
"metadata": {},
Expand All @@ -104,20 +103,20 @@
"\n",
"local_optimizer = SwapOrderLocalOptimizer()\n",
"\n",
"schedule = SchedulingPipeline.create() \\\n",
"project = SchedulingPipeline.create() \\\n",
" .wg(simple_wg) \\\n",
" .contractors(contractors) \\\n",
" .optimize_local(local_optimizer, range(0, 10)) \\\n",
" .schedule(scheduler) \\\n",
" .finish()\n",
"\n",
"schedule.execution_time"
"project.schedule.execution_time"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"start_time": "2023-07-01T21:15:27.212547Z",
"end_time": "2023-07-01T21:15:27.796855Z"
"end_time": "2023-10-31T08:06:06.450877800Z",
"start_time": "2023-10-31T08:06:06.365998300Z"
}
}
},
Expand All @@ -135,16 +134,9 @@
"cell_type": "code",
"execution_count": 4,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Found! finish of project finish of project\n"
]
},
{
"data": {
"text/plain": "8661"
"text/plain": "1194"
},
"execution_count": 4,
"metadata": {},
Expand All @@ -157,20 +149,20 @@
"\n",
"local_optimizer = ParallelizeScheduleLocalOptimizer(JustInTimeTimeline)\n",
"\n",
"schedule = SchedulingPipeline.create() \\\n",
"project = SchedulingPipeline.create() \\\n",
" .wg(simple_wg) \\\n",
" .contractors(contractors) \\\n",
" .schedule(scheduler) \\\n",
" .optimize_local(local_optimizer, range(0, 5)) \\\n",
" .finish()\n",
"\n",
"schedule.execution_time"
"project.schedule.execution_time"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"start_time": "2023-07-01T21:15:28.199018Z",
"end_time": "2023-07-01T21:15:28.861640Z"
"end_time": "2023-10-31T08:06:06.635515100Z",
"start_time": "2023-10-31T08:06:06.465560600Z"
}
}
},
Expand All @@ -193,18 +185,16 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Swapped 27 times!\n",
"Swapped 33 times!\n",
"Swapped 13 times!\n",
"Swapped 14 times!\n",
"Swapped 26 times!\n",
"Swapped 32 times!\n",
"Found! temporary road engineering preparation\n",
"Found! finish of project elem of pipe_network\n",
"Found! finish of project elem of pipe_network\n",
"Found! finish of project elem of pipe_network\n",
"Found! finish of project elem of pipe_network\n",
"Found! final road elem of pipe_network\n",
"Found! final road elem of pipe_network\n",
"Found! final road elem of pipe_network\n",
"Found! final road elem of pipe_network\n",
"Found! pipe drainage tank\n",
"Found! pipe KTP and NEP\n",
"Found! finish of project high power line\n",
"Found! final road high power line\n",
"Found! pipe block local automation\n",
"Found! pipe metering installation\n",
"Found! pipe block dosage inhibitor\n",
Expand All @@ -214,41 +204,39 @@
"Found! pipe block water distribution\n",
"Found! pipe drainage tank\n",
"Found! pipe firewall tank\n",
"Found! finish of project elem of pipe_network\n",
"Found! finish of project elem of pipe_network\n",
"Found! finish of project elem of pipe_network\n",
"Found! finish of project mast\n",
"Found! finish of project mast\n",
"Found! finish of project power network\n",
"Found! finish of project pipe\n",
"Found! finish of project pipe\n",
"Found! finish of project power line\n",
"Found! finish of project power line\n",
"Found! finish of project pipe\n",
"Found! finish of project looping\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project borehole\n",
"Found! finish of project node\n",
"Found! finish of project node\n",
"Found! finish of project node\n",
"Found! finish of project final road\n",
"Found! cluster handing finish of project\n",
"Found! final road elem of pipe_network\n",
"Found! final road elem of pipe_network\n",
"Found! final road elem of pipe_network\n",
"Found! final road mast\n",
"Found! final road mast\n",
"Found! final road power network\n",
"Found! final road pipe\n",
"Found! final road pipe\n",
"Found! final road power line\n",
"Found! final road power line\n",
"Found! final road pipe\n",
"Found! final road looping\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road borehole\n",
"Found! final road node\n",
"Found! final road node\n",
"Found! final road node\n",
"Found! engineering preparation temporary road\n",
"Found! final road engineering preparation\n",
"Found! node final road\n",
Expand All @@ -273,7 +261,6 @@
"Found! node elem of pipe_network\n",
"Found! node elem of pipe_network\n",
"Found! node elem of pipe_network\n",
"Found! node elem of pipe_network\n",
"Found! node mast\n",
"Found! node mast\n",
"Found! node mast\n",
Expand Down Expand Up @@ -319,7 +306,7 @@
},
{
"data": {
"text/plain": "8661"
"text/plain": "1240"
},
"execution_count": 5,
"metadata": {},
Expand All @@ -332,7 +319,7 @@
"order_optimizer = SwapOrderLocalOptimizer()\n",
"schedule_optimizer = ParallelizeScheduleLocalOptimizer(JustInTimeTimeline)\n",
"\n",
"schedule = SchedulingPipeline.create() \\\n",
"project = SchedulingPipeline.create() \\\n",
" .wg(simple_wg) \\\n",
" .contractors(contractors) \\\n",
" .optimize_local(order_optimizer, range(0, simple_wg.vertex_count // 2)) \\\n",
Expand All @@ -342,23 +329,27 @@
" .optimize_local(schedule_optimizer, range(simple_wg.vertex_count // 2, simple_wg.vertex_count)) \\\n",
" .finish()\n",
"\n",
"schedule.execution_time"
"project.schedule.execution_time"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"start_time": "2023-07-01T21:15:30.679374Z",
"end_time": "2023-07-01T21:15:31.396371Z"
"end_time": "2023-10-31T08:06:06.860829700Z",
"start_time": "2023-10-31T08:06:06.690476Z"
}
}
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-10-31T08:06:06.870912400Z",
"start_time": "2023-10-31T08:06:06.855820800Z"
}
}
}
],
Expand Down
Loading