Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Add a time-depended upper bound for the output of a component #65
For the investment I added an extra function block. I made some test and I couldn't see a time difference if I used the second block for all components. That means that I could remove all the if-clauses and just use it every time, but i didn't have the guts to do it. If it is okay for you I will. The code will be clearer and easier to read.
# constraint for additional capacity def add_output_rule(block, e, t): lhs = model.w[e, model.O[e], t] rhs = ub_out[e][model.O[e]][t] + block.add_out[e] return(lhs <= rhs) # constraint for additional capacity def add_output_rule_time_depended_bound(block, e, t): lhs = model.w[e, model.O[e], t] rhs = ub_out[e][model.O[e]][t] * ( 1 + block.add_out[e] / out_max[e][model.O[e]]) return(lhs <= rhs) if exist_ub_out: block.output_bound = po.Constraint( block.indexset, rule=add_output_rule_time_depended_bound) else: block.output_bound = po.Constraint( block.indexset, rule=add_output_rule)
I just thought we could remove one if clause and make the code cleaner but I'm okay with leaving it as it is.
So far you can find an example in the reegis_hp repository but examples and test is something that we need to discuss.