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

Add a time-depended upper bound for the output of a component #65

Merged
merged 10 commits into from Jan 27, 2016

Conversation

Projects
None yet
2 participants
@uvchik
Copy link
Member

uvchik commented Jan 25, 2016

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][0], t]
                rhs = ub_out[e][model.O[e][0]][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][0], t]
                rhs = ub_out[e][model.O[e][0]][t] * (
                    1 + block.add_out[e] / out_max[e][model.O[e][0]])
                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)

@uvchik uvchik merged commit d032f8d into dev Jan 27, 2016

@uvchik

This comment has been minimized.

Copy link
Member Author

uvchik commented Jan 27, 2016

I merged the branch for another reason.

@simonhilpert : What do think we should about the constraints above?

@simnh

This comment has been minimized.

Copy link
Member

simnh commented Jan 28, 2016

If it's merged and it works as intended, I say we keep it this way. Did you example apps ?

@uvchik

This comment has been minimized.

Copy link
Member Author

uvchik commented Jan 28, 2016

If it's merged and it works as intended, I say we keep it this way.

I just thought we could remove one if clause and make the code cleaner but I'm okay with leaving it as it is.

Did you example apps ?

So far you can find an example in the reegis_hp repository but examples and test is something that we need to discuss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment