--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
This is for large instance. It stalls for very long time after I see this output. I have modeled the constraints only after this stage and it does not build any constraints.
Yes I guess the problem is with the construction of the constraints. Whether I specify the constraints as rules or as constraint list using 'for' lops, it does not help. Thank you.
[ 0.00] Setting up Pyomo environment
[ 0.00] Applying Pyomo preprocessing actions
[ 0.00] Creating model
0 seconds required to construct component=FOOD; 9 indicies total
0 seconds required to construct component=cost; 9 indicies total
0 seconds required to construct component=f_min; 9 indicies total
0 seconds required to construct component=f_max; 9 indicies total
0 seconds required to construct component=NUTR; 7 indicies total
0 seconds required to construct component=n_min; 7 indicies total
0 seconds required to construct component=n_max; 7 indicies total
0 seconds required to construct component=amt_index; 63 indicies total
0 seconds required to construct component=amt; 63 indicies total
0 seconds required to construct component=Buy; 9 indicies total
0 seconds required to construct component=Total_Cost; 1 indicies total
0 seconds required to construct component=Entree; 1 indicies total
0 seconds required to construct component=Side; 1 indicies total
0 seconds required to construct component=Drink; 1 indicies total
0.00 seconds required to construct instance=unknown
0.00 seconds required for problem transformations
[ 0.10] Applying solver
[ 0.13] Processing results
Number of solutions: 1
Solution Information
Gap: 0.0
Status: optimal
Function Value: 2.81
--
You received this message because you are subscribed to a topic in the Google Groups "Pyomo Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyomo-forum/YTPByhZzboA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyomo-forum...@googlegroups.com.
[ 0.00] Setting up Pyomo environment
[ 0.00] Applying Pyomo preprocessing actions
[ 0.01] Creating model
0 seconds required to construct component=GEN; 54 indicies total
0 seconds required to construct component=nodes; 118 indicies total
0 seconds required to construct component=nodes_volt; 117 indicies total
0 seconds required to construct component=lines; 179 indicies total
0 seconds required to construct component=horizon; 1 indicies total
0 seconds required to construct component=hours; 24 indicies total
0 seconds required to construct component=twoplushours; 23 indicies total
0 seconds required to construct component=threeplushours; 22 indicies total
0 seconds required to construct component=variab_cost; 54 indicies total
0 seconds required to construct component=RU_index; 1296 indicies total
0.01 seconds required to construct component=RU; 1296 indicies total
0 seconds required to construct component=RD_index; 1296 indicies total
0.01 seconds required to construct component=RD; 1296 indicies total
0 seconds required to construct component=maxproduce_lim; 54 indicies total
0 seconds required to construct component=minproduce_lim; 54 indicies total
0 seconds required to construct component=line_cap; 179 indicies total
0 seconds required to construct component=bus_gen_matr_index; 6372 indicies total
0.02 seconds required to construct component=bus_gen_matr; 6372 indicies total
0 seconds required to construct component=bus_line_matr_index; 21122 indicies total
0.07 seconds required to construct component=bus_line_matr; 21122 indicies total
0 seconds required to construct component=bl_index; 21122 indicies total
0.07 seconds required to construct component=bl; 21122 indicies total
0 seconds required to construct component=demand_index; 2832 indicies total
0.01 seconds required to construct component=demand; 2832 indicies total
0 seconds required to construct component=unct_nodes; 0 indicies total
0 seconds required to construct component=diagonal_D_index; 32041 indicies total
0.10 seconds required to construct component=diagonal_D; 32041 indicies total
0 seconds required to construct component=shift_factor_index; 21122 indicies total
0.06 seconds required to construct component=shift_factor; 21122 indicies total
0 seconds required to construct component=produce_p_index; 1296 indicies total
0 seconds required to construct component=produce_p; 1296 indicies total
0 seconds required to construct component=line_trans_index; 4296 indicies total
0.01 seconds required to construct component=line_trans; 4296 indicies total
0 seconds required to construct component=theta_index; 2808 indicies total
0 seconds required to construct component=theta; 2808 indicies total
0 seconds required to construct component=pinject_index; 2832 indicies total
0 seconds required to construct component=pinject; 2832 indicies total
0 seconds required to construct component=genstatus_x_index; 1296 indicies total
0 seconds required to construct component=genstatus_x; 1296 indicies total
0 seconds required to construct component=slack_lines_index; 4296 indicies total
0.01 seconds required to construct component=slack_lines; 4296 indicies total
0 seconds required to construct component=slack_demand1; 24 indicies total
0 seconds required to construct component=slack_demand2; 24 indicies total
0 seconds required to construct component=rampup_index; 1296 indicies total
0.02 seconds required to construct component=rampup; 1296 indicies total
0 seconds required to construct component=rampdown_index; 1296 indicies total
0.03 seconds required to construct component=rampdown; 1296 indicies total
0 seconds required to construct component=flow_upper_bound_index; 4296 indicies total
0.07 seconds required to construct component=flow_upper_bound; 4296 indicies total
0 seconds required to construct component=flow_lower_bound_index; 4296 indicies total
0.07 seconds required to construct component=flow_lower_bound; 4296 indicies total
0 seconds required to construct component=gen_upper_bound_index; 1296 indicies total
0.02 seconds required to construct component=gen_upper_bound; 1296 indicies total
0 seconds required to construct component=gen_lower_bound_index; 1296 indicies total
0.02 seconds required to construct component=gen_lower_bound; 1296 indicies total
0.01 seconds required to construct component=energy_conserv; 24 indicies total
0 seconds required to construct component=flow_upper_bound1_index; 4296 indicies total
220.20 seconds required to construct component=flow_upper_bound1; 4296 indicies total
Cloning detected! (clone counters: 217680)
0.07 seconds required to construct component=opt_mincost_mstr; 1 indicies total
Cloning detected! (clone counters: 218976)
220.88 seconds required to construct instance=unknown
0.00 seconds required for problem transformations
[ 222.67] Applying solver
2.13 seconds required to write file
2.14 seconds required for presolve
0.37 seconds required for solver
0.00 seconds required to read logfile
0.20 seconds required to read solution file
0.30 seconds required for postsolve
[ 225.48] Processing results
Number of solutions: 1
Solution Information
Gap: 0.0
Status: optimal
Function Value: 2272732.93679
Solver results file: results.json
[ 225.78] Applying Pyomo postprocessing actions
[ 225.78] Pyomo Finished
Hi Aman,
Would you be willing to share your model, off-forum? Or at least the code associated with flow_upper_bound1? Cloning is the likely culprit, and it should be able to eliminate that by re-working implementation specifics of that rule.
jpw
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I’ll leave it to @Aman as to whether he’s willing to share the model / data. In our off-line discussions, he managed to (largely) mitigate the model creation bottleneck by using sparse representations of what were being represented as dense matrices (with a lot of 0s). So while it would be a good test case for profiling purposes…
jpw
I should also point out that Pyomo 4.0.9638 is 3 years old. There have been numerous improvements over that time. Please upgrade to the current release (Pyomo 5.3) before reporting performance problems.
In particular there is *no* support for PyPy in 4.0. You should be on a 5.x release before even *trying* pypy.
john
From: pyomo...@googlegroups.com [mailto:pyomo...@googlegroups.com]
On Behalf Of Bill Hart
Sent: Wednesday, February 07, 2018 12:54 PM
To: Pyomo Forum <pyomo...@googlegroups.com>
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
Performance can be significantly impacted by the way in which you specify the matrices – constraint coefficients, in particular. If you use what is effectively a dense representation, e.g., with Param(x,y,default=0.0), then you will see very long instantiation times.
If you share the constraint rules and any definitions of associated sets and parameters, we can say more.
jpw
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The problem with your model is that while model.S is stored sparsely, it is technically a dense parameter (there are valid values for all indices). Your constraint is actually working over the dense matrix (twice!).
Something like the following would be faster (but still dense):
def mass_balance(model, i, k, m):
flows = sum(model.S[i, j, k] * model.v[j, k, m] for j in model.J if model.S[i,j,k] != 0)
if flows is 0 or flows is 0.0:
return Constraint.Skip
return (flows, model.b[i, k]) # you could do return flows == model.b[I,k], but it would be slightly slower in the current system
model.mass_balance = Constraint(model.I, model.K, model.M, rule=mass_balance)
def dual_con(model, j, k, m):
return sum(model.lambda1[i, k, m] * model.S[i, j, k] for i in model.I if model.S[i,j,k] != 0) \
+ model.muu[j, k, m] - model.mul[j, k, m] == model.c[j, k, m]
model.dual_con = Constraint(model.J, model.K, model.M, rule=dual_con)
The “right” solution is to use a data structure that directly exposes the relevant sparsity. If you know the sparsity, great! If you need to infer it from the data, then something like this would work (putting it in the model after model.S is declared, of course):
model.SPARSE_IK = Set(model.I, model.K)
model.SPARSE_JK = Set(model.J, model.K)
def detect_sparsity(model):
for i,j,k in model.S.sparse_iterkeys():
model.SPARSE_IK[i,k].add(j)
model.SPARSE_JK[j,k].add(i)
model.detect_sparsity = BuildAction(rule=detect_sparsity)
def mass_balance(model, i, k, m):
if len(model.SPARSE_IK[i,k]) == 0:
return Constraint.Skip
return sum(model.S[i, j, k] * model.v[j, k, m] for j in model.SPARSE_IK[i,k]) == model.b[i,k]
model.mass_balance = Constraint(model.I, model.K, model.M, rule=mass_balance)
def dual_con(model, j, k, m):
return sum(model.lambda1[i, k, m] * model.S[i, j, k] for i in model.SPARSE_JK[j,k]) \
+ model.muu[j, k, m] - model.mul[j, k, m] == model.c[j, k, m]
model.dual_con = Constraint(model.J, model.K, model.M, rule=dual_con)
Assuming I didn’t make any typos, this should scale with the number of nonzeros (and not the size of the indices).
john
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyomo-forum/adc3c3a6-79d3-4f27-a6d8-0817938cf88f%40googlegroups.com.
Cheers,
Dennis Gray
MSc Candidate - Department of Environmental Economics and Resource Sociology
116 st and 85 ave, Edmonton AB Canada, T6G 2R3
C: 780-717-4190