Attributes: class_vars: The names of classvars defined on the model. private_attributes: Metadata about the private attributes of the model. signature: The signature for instantiating the model.
__pydantic_complete__: Whether model building is completed, or if there are still undefined fields.
__pydantic_core_schema__: The pydantic-core schema used to build the SchemaValidator and SchemaSerializer.
__pydantic_custom_init__: Whether the model has a custom `__init__` function.
__pydantic_decorators__: Metadata containing the decorators defined on the model.
This replaces `Model.__validators__` and `Model.__root_validators__` from Pydantic V1.
__pydantic_generic_metadata__: Metadata for generic models; contains data used for a similar purpose to
__args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
__pydantic_parent_namespace__: Parent namespace of the model, used for automatic rebuilding of models.
__pydantic_post_init__: The name of the post-init method for the model, if defined.
__pydantic_root_model__: Whether the model is a `RootModel`.
__pydantic_serializer__: The pydantic-core SchemaSerializer used to dump instances of the model.
__pydantic_validator__: The pydantic-core SchemaValidator used to validate instances of the model.
__pydantic_extra__: An instance attribute with the values of extra fields from validation when
`model_config['extra'] == 'allow'`.
__pydantic_fields_set__: An instance attribute with the names of fields explicitly set.
__pydantic_private__: Instance attribute with the values of private attributes set on the model instance.
使用例
data = Data(dtype ="demand", amount =100., std =10.)data
計画期間 = 0 1
Welcome to the CBC MILP Solver
Version: 2.10.3
Build Date: Dec 15 2019
command line - /Users/mikiokubo/Documents/dev/scmopt2/env/lib/python3.10/site-packages/pulp/solverdir/cbc/osx/64/cbc /var/folders/c0/1l3dlhys02nbkv4fyj9pkm680000gn/T/9f201fdedcfd49d19c61de181a863b07-pulp.mps timeMode elapsed branch printingOptions all solution /var/folders/c0/1l3dlhys02nbkv4fyj9pkm680000gn/T/9f201fdedcfd49d19c61de181a863b07-pulp.sol (default strategy 1)
At line 2 NAME MODEL
At line 3 ROWS
At line 26 COLUMNS
At line 139 RHS
At line 161 BOUNDS
At line 198 ENDATA
Problem MODEL has 21 rows, 36 columns and 60 elements
Coin0008I MODEL read with 0 errors
Option for timeMode changed from cpu to elapsed
Continuous objective value is 820 - 0.00 seconds
Cgl0004I processed model has 7 rows, 22 columns (2 integer (2 of which binary)) and 32 elements
Cbc0038I Initial state - 0 integers unsatisfied sum - 0
Cbc0038I Solution found of 820
Cbc0038I Relaxing continuous gives 820
Cbc0038I Before mini branch and bound, 2 integers at bound fixed and 15 continuous
Cbc0038I Mini branch and bound did not improve solution (0.00 seconds)
Cbc0038I After 0.00 seconds - Feasibility pump exiting with objective of 820 - took 0.00 seconds
Cbc0012I Integer solution of 820 found by feasibility pump after 0 iterations and 0 nodes (0.00 seconds)
Cbc0001I Search completed - best objective 820, took 0 iterations and 0 nodes (0.00 seconds)
Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost
Cuts at root node changed objective from 820 to 820
Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Result - Optimal solution found
Objective value: 820.00000000
Enumerated nodes: 0
Total iterations: 0
Time (CPU seconds): 0.00
Time (Wallclock seconds): 0.00
Option for printingOptions changed from normal to all
Total time (CPU seconds): 0.00 (Wallclock seconds): 0.00
Opt. Val= 820.0
# g, bom = visualize(model, size=20)# g
Example: Fixed Charge Multicommodity Network Flow
多品種流問題に枝上の固定費用 \(F: E \rightarrow \mathbf{R}_+\) をつけた問題を,多品種ネットワーク設計問題(multi-commodity network design problem)とよぶ. この問題は,\(NP\)-困難であり,しかも以下の通常の定式化だと小規模の問題例しか解けない.実務的には,パス型の定式化や列生成法を用いることが推奨される.
計画期間 = 0 1
Welcome to the CBC MILP Solver
Version: 2.10.3
Build Date: Dec 15 2019
command line - /Users/mikiokubo/Documents/dev/scmopt2/env/lib/python3.10/site-packages/pulp/solverdir/cbc/osx/64/cbc /var/folders/c0/1l3dlhys02nbkv4fyj9pkm680000gn/T/77240d856e0c4406822031ba7c89b49c-pulp.mps timeMode elapsed branch printingOptions all solution /var/folders/c0/1l3dlhys02nbkv4fyj9pkm680000gn/T/77240d856e0c4406822031ba7c89b49c-pulp.sol (default strategy 1)
At line 2 NAME MODEL
At line 3 ROWS
At line 2405 COLUMNS
At line 16902 RHS
At line 19303 BOUNDS
At line 23072 ENDATA
Problem MODEL has 2400 rows, 3768 columns and 8952 elements
Coin0008I MODEL read with 0 errors
Option for timeMode changed from cpu to elapsed
Continuous objective value is 30357.3 - 0.00 seconds
Cgl0004I processed model has 672 rows, 2040 columns (24 integer (24 of which binary)) and 5496 elements
Cbc0038I Initial state - 17 integers unsatisfied sum - 4.85333
Cbc0038I Pass 1: suminf. 0.00000 (0) obj. 3.54028e+08 iterations 321
Cbc0038I Solution found of 3.54028e+08
Cbc0038I Relaxing continuous gives 3.18026e+08
Cbc0038I Before mini branch and bound, 7 integers at bound fixed and 1891 continuous
Cbc0038I Full problem 672 rows 2040 columns, reduced to 26 rows 40 columns
Cbc0038I Mini branch and bound improved solution from 3.18026e+08 to 30860 (0.03 seconds)
Cbc0038I Round again with cutoff of 30809.7
Cbc0038I Pass 2: suminf. 1.13333 (3) obj. 30809.7 iterations 400
Cbc0038I Pass 3: suminf. 0.49733 (1) obj. 30809.7 iterations 241
Cbc0038I Pass 4: suminf. 0.42000 (1) obj. 30809.7 iterations 101
Cbc0038I Pass 5: suminf. 1.86667 (5) obj. 30809.7 iterations 201
Cbc0038I Pass 6: suminf. 1.45333 (4) obj. 30809.7 iterations 98
Cbc0038I Pass 7: suminf. 2.48000 (7) obj. 30809.7 iterations 153
Cbc0038I Pass 8: suminf. 1.80000 (5) obj. 30809.7 iterations 114
Cbc0038I Pass 9: suminf. 2.98000 (9) obj. 30809.7 iterations 211
Cbc0038I Pass 10: suminf. 1.89333 (5) obj. 30809.7 iterations 155
Cbc0038I Pass 11: suminf. 0.49733 (1) obj. 30809.7 iterations 211
Cbc0038I Pass 12: suminf. 0.42000 (1) obj. 30809.7 iterations 46
Cbc0038I Pass 13: suminf. 1.28667 (3) obj. 30809.7 iterations 195
Cbc0038I Pass 14: suminf. 1.28667 (3) obj. 30809.7 iterations 0
Cbc0038I Pass 15: suminf. 1.62000 (5) obj. 30809.7 iterations 159
Cbc0038I Pass 16: suminf. 1.61333 (4) obj. 30809.7 iterations 35
Cbc0038I Pass 17: suminf. 2.28000 (7) obj. 30809.7 iterations 107
Cbc0038I Pass 18: suminf. 1.18667 (3) obj. 30809.7 iterations 141
Cbc0038I Pass 19: suminf. 0.49733 (1) obj. 30809.7 iterations 118
Cbc0038I Pass 20: suminf. 0.42000 (1) obj. 30809.7 iterations 64
Cbc0038I Pass 21: suminf. 2.25333 (6) obj. 30809.7 iterations 286
Cbc0038I Pass 22: suminf. 1.72666 (5) obj. 30809.7 iterations 103
Cbc0038I Pass 23: suminf. 2.78666 (8) obj. 30809.7 iterations 141
Cbc0038I Pass 24: suminf. 2.38666 (6) obj. 30809.7 iterations 136
Cbc0038I Pass 25: suminf. 1.42000 (4) obj. 30809.7 iterations 80
Cbc0038I Pass 26: suminf. 0.49733 (1) obj. 30809.7 iterations 113
Cbc0038I Pass 27: suminf. 0.42000 (1) obj. 30809.7 iterations 44
Cbc0038I Pass 28: suminf. 2.23333 (6) obj. 30809.7 iterations 292
Cbc0038I Pass 29: suminf. 1.70000 (4) obj. 30809.7 iterations 74
Cbc0038I Pass 30: suminf. 2.31333 (6) obj. 30809.7 iterations 54
Cbc0038I Pass 31: suminf. 2.14667 (5) obj. 30809.7 iterations 3
Cbc0038I No solution found this major pass
Cbc0038I Before mini branch and bound, 3 integers at bound fixed and 1775 continuous
Cbc0038I Full problem 672 rows 2040 columns, reduced to 71 rows 106 columns
Cbc0038I Mini branch and bound did not improve solution (0.14 seconds)
Cbc0038I After 0.14 seconds - Feasibility pump exiting with objective of 30860 - took 0.12 seconds
Cbc0012I Integer solution of 30860 found by feasibility pump after 0 iterations and 0 nodes (0.15 seconds)
Cbc0038I Full problem 672 rows 2040 columns, reduced to 672 rows 2033 columns - 14 fixed gives 672, 2019 - still too large
Cbc0031I 25 added rows had average density of 11.64
Cbc0013I At root node, 42 cuts changed objective from 30357.333 to 30860 in 6 passes
Cbc0014I Cut generator 0 (Probing) - 76 row cuts average 2.0 elements, 0 column cuts (0 active) in 0.002 seconds - new frequency is 1
Cbc0014I Cut generator 1 (Gomory) - 37 row cuts average 317.1 elements, 0 column cuts (0 active) in 0.002 seconds - new frequency is 1
Cbc0014I Cut generator 2 (Knapsack) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.003 seconds - new frequency is -100
Cbc0014I Cut generator 3 (Clique) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0014I Cut generator 4 (MixedIntegerRounding2) - 55 row cuts average 9.4 elements, 0 column cuts (0 active) in 0.001 seconds - new frequency is 1
Cbc0014I Cut generator 5 (FlowCover) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.002 seconds - new frequency is -100
Cbc0014I Cut generator 6 (TwoMirCuts) - 64 row cuts average 32.4 elements, 0 column cuts (0 active) in 0.002 seconds - new frequency is 1
Cbc0001I Search completed - best objective 30860, took 343 iterations and 0 nodes (0.18 seconds)
Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost
Cuts at root node changed objective from 30357.3 to 30860
Probing was tried 6 times and created 76 cuts of which 0 were active after adding rounds of cuts (0.002 seconds)
Gomory was tried 6 times and created 37 cuts of which 0 were active after adding rounds of cuts (0.002 seconds)
Knapsack was tried 6 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.003 seconds)
Clique was tried 6 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
MixedIntegerRounding2 was tried 6 times and created 55 cuts of which 0 were active after adding rounds of cuts (0.001 seconds)
FlowCover was tried 6 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.002 seconds)
TwoMirCuts was tried 6 times and created 64 cuts of which 0 were active after adding rounds of cuts (0.002 seconds)
ZeroHalf was tried 1 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Result - Optimal solution found
Objective value: 30860.00000000
Enumerated nodes: 0
Total iterations: 343
Time (CPU seconds): 0.19
Time (Wallclock seconds): 0.19
Option for printingOptions changed from normal to all
Total time (CPU seconds): 0.19 (Wallclock seconds): 0.20
Opt. Val= 30860.0
T= 8
計画期間 = 1 8
Welcome to the CBC MILP Solver
Version: 2.10.3
Build Date: Dec 15 2019
command line - /Users/mikiokubo/Documents/dev/scmopt2/env/lib/python3.10/site-packages/pulp/solverdir/cbc/osx/64/cbc /var/folders/c0/1l3dlhys02nbkv4fyj9pkm680000gn/T/adec1d2053e149c2ba4735a0c318a047-pulp.mps timeMode elapsed branch printingOptions all solution /var/folders/c0/1l3dlhys02nbkv4fyj9pkm680000gn/T/adec1d2053e149c2ba4735a0c318a047-pulp.sol (default strategy 1)
At line 2 NAME MODEL
At line 3 ROWS
At line 208 COLUMNS
At line 1325 RHS
At line 1529 BOUNDS
At line 1837 ENDATA
Problem MODEL has 203 rows, 307 columns and 627 elements
Coin0008I MODEL read with 0 errors
Option for timeMode changed from cpu to elapsed
Continuous objective value is 2490.76 - 0.00 seconds
Cgl0003I 0 fixed, 0 tightened bounds, 42 strengthened rows, 0 substitutions
Cgl0003I 0 fixed, 0 tightened bounds, 1 strengthened rows, 0 substitutions
Cgl0004I processed model has 160 rows, 237 columns (84 integer (84 of which binary)) and 511 elements
Cbc0038I Initial state - 48 integers unsatisfied sum - 6.59365
Cbc0038I Pass 1: suminf. 0.34286 (2) obj. 1.50001e+08 iterations 56
Cbc0038I Solution found of 1.50001e+08
Cbc0038I Relaxing continuous gives 1.50001e+08
Cbc0038I Before mini branch and bound, 35 integers at bound fixed and 70 continuous
Cbc0038I Full problem 160 rows 237 columns, reduced to 80 rows 103 columns
Cbc0038I Mini branch and bound improved solution from 1.50001e+08 to 4555 (0.02 seconds)
Cbc0038I Round again with cutoff of 4360.55
Cbc0038I Pass 2: suminf. 5.66031 (40) obj. 4360.55 iterations 51
Cbc0038I Pass 3: suminf. 5.50475 (39) obj. 4360.55 iterations 1
Cbc0038I Pass 4: suminf. 2.40407 (21) obj. 4360.55 iterations 45
Cbc0038I Pass 5: suminf. 2.38733 (14) obj. 4360.55 iterations 37
Cbc0038I Pass 6: suminf. 1.55124 (10) obj. 4360.55 iterations 12
Cbc0038I Pass 7: suminf. 1.27950 (10) obj. 4360.55 iterations 1
Cbc0038I Pass 8: suminf. 1.15876 (8) obj. 4360.55 iterations 6
Cbc0038I Pass 9: suminf. 1.15876 (8) obj. 4360.55 iterations 0
Cbc0038I Pass 10: suminf. 1.15876 (8) obj. 4360.55 iterations 2
Cbc0038I Pass 11: suminf. 1.15876 (8) obj. 4360.55 iterations 0
Cbc0038I Pass 12: suminf. 1.15876 (8) obj. 4360.55 iterations 2
Cbc0038I Pass 13: suminf. 3.60267 (21) obj. 4360.55 iterations 40
Cbc0038I Pass 14: suminf. 3.30968 (21) obj. 4360.55 iterations 2
Cbc0038I Pass 15: suminf. 2.13019 (15) obj. 4360.55 iterations 16
Cbc0038I Pass 16: suminf. 2.13019 (15) obj. 4360.55 iterations 0
Cbc0038I Pass 17: suminf. 1.80162 (12) obj. 4360.55 iterations 6
Cbc0038I Pass 18: suminf. 1.80162 (12) obj. 4360.55 iterations 0
Cbc0038I Pass 19: suminf. 1.80162 (12) obj. 4360.55 iterations 2
Cbc0038I Pass 20: suminf. 1.80162 (12) obj. 4360.55 iterations 0
Cbc0038I Pass 21: suminf. 2.00162 (13) obj. 4360.55 iterations 14
Cbc0038I Pass 22: suminf. 2.05552 (12) obj. 4360.55 iterations 3
Cbc0038I Pass 23: suminf. 1.58203 (12) obj. 4360.55 iterations 1
Cbc0038I Pass 24: suminf. 2.05552 (12) obj. 4360.55 iterations 1
Cbc0038I Pass 25: suminf. 2.90590 (16) obj. 4360.55 iterations 17
Cbc0038I Pass 26: suminf. 2.90590 (16) obj. 4360.55 iterations 0
Cbc0038I Pass 27: suminf. 1.88733 (13) obj. 4360.55 iterations 7
Cbc0038I Pass 28: suminf. 1.88733 (13) obj. 4360.55 iterations 0
Cbc0038I Pass 29: suminf. 1.88733 (13) obj. 4360.55 iterations 2
Cbc0038I Pass 30: suminf. 1.88733 (13) obj. 4360.55 iterations 0
Cbc0038I Pass 31: suminf. 1.88733 (13) obj. 4360.55 iterations 2
Cbc0038I No solution found this major pass
Cbc0038I Before mini branch and bound, 7 integers at bound fixed and 71 continuous
Cbc0038I Full problem 160 rows 237 columns, reduced to 106 rows 121 columns - 6 fixed gives 95, 114 - still too large
Cbc0038I Full problem 160 rows 237 columns, reduced to 57 rows 73 columns
Cbc0038I Mini branch and bound did not improve solution (0.04 seconds)
Cbc0038I After 0.04 seconds - Feasibility pump exiting with objective of 4555 - took 0.04 seconds
Cbc0012I Integer solution of 4555 found by feasibility pump after 0 iterations and 0 nodes (0.04 seconds)
Cbc0038I Full problem 160 rows 237 columns, reduced to 113 rows 163 columns - 1 fixed gives 113, 162 - still too large
Cbc0038I Full problem 160 rows 237 columns, reduced to 113 rows 162 columns - too large
Cbc0031I 72 added rows had average density of 32.902778
Cbc0013I At root node, 72 cuts changed objective from 2610.5238 to 4403.656 in 100 passes
Cbc0014I Cut generator 0 (Probing) - 17 row cuts average 2.0 elements, 0 column cuts (49 active) in 0.069 seconds - new frequency is -100
Cbc0014I Cut generator 1 (Gomory) - 1905 row cuts average 122.2 elements, 0 column cuts (0 active) in 0.028 seconds - new frequency is 1
Cbc0014I Cut generator 2 (Knapsack) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.012 seconds - new frequency is -100
Cbc0014I Cut generator 3 (Clique) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.001 seconds - new frequency is -100
Cbc0014I Cut generator 4 (MixedIntegerRounding2) - 370 row cuts average 9.0 elements, 0 column cuts (0 active) in 0.029 seconds - new frequency is 1
Cbc0014I Cut generator 5 (FlowCover) - 11 row cuts average 3.7 elements, 0 column cuts (0 active) in 0.024 seconds - new frequency is -100
Cbc0014I Cut generator 6 (TwoMirCuts) - 223 row cuts average 33.9 elements, 0 column cuts (0 active) in 0.006 seconds - new frequency is 1
Cbc0010I After 0 nodes, 1 on tree, 4555 best solution, best possible 4403.656 (0.39 seconds)
Cbc0038I Full problem 160 rows 237 columns, reduced to 95 rows 142 columns - 1 fixed gives 94, 141 - still too large
Cbc0038I Full problem 160 rows 237 columns, reduced to 94 rows 141 columns - too large
Cbc0016I Integer solution of 4545 found by strong branching after 6131 iterations and 63 nodes (0.63 seconds)
Cbc0016I Integer solution of 4530 found by strong branching after 6132 iterations and 64 nodes (0.63 seconds)
Cbc0012I Integer solution of 4527.5 found by rounding after 6293 iterations and 68 nodes (0.63 seconds)
Cbc0004I Integer solution of 4525 found after 6507 iterations and 77 nodes (0.64 seconds)
Cbc0038I Full problem 160 rows 237 columns, reduced to 71 rows 114 columns
Cbc0004I Integer solution of 4505 found after 6986 iterations and 94 nodes (0.68 seconds)
Cbc0012I Integer solution of 4495 found by rounding after 7743 iterations and 115 nodes (0.74 seconds)
Cbc0016I Integer solution of 4490 found by strong branching after 7752 iterations and 118 nodes (0.75 seconds)
Cbc0001I Search completed - best objective 4489.999999999959, took 8573 iterations and 134 nodes (0.78 seconds)
Cbc0032I Strong branching done 1774 times (15375 iterations), fathomed 23 nodes and fixed 103 variables
Cbc0035I Maximum depth 13, 212 variables fixed on reduced cost
Cuts at root node changed objective from 2610.52 to 4403.66
Probing was tried 100 times and created 17 cuts of which 49 were active after adding rounds of cuts (0.069 seconds)
Gomory was tried 380 times and created 2302 cuts of which 0 were active after adding rounds of cuts (0.049 seconds)
Knapsack was tried 100 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.012 seconds)
Clique was tried 100 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.001 seconds)
MixedIntegerRounding2 was tried 380 times and created 803 cuts of which 0 were active after adding rounds of cuts (0.055 seconds)
FlowCover was tried 100 times and created 11 cuts of which 0 were active after adding rounds of cuts (0.024 seconds)
TwoMirCuts was tried 380 times and created 317 cuts of which 0 were active after adding rounds of cuts (0.018 seconds)
ZeroHalf was tried 1 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Result - Optimal solution found
Objective value: 4490.00000000
Enumerated nodes: 134
Total iterations: 8573
Time (CPU seconds): 0.77
Time (Wallclock seconds): 0.78
Option for printingOptions changed from normal to all
Total time (CPU seconds): 0.77 (Wallclock seconds): 0.79
Opt. Val= 4505.0