Comments (2)
I got the idea that the condition should not be (p, t) in G_PS), which loops in a larger size of elements. The optimal way is by looping p in a list.
from jump.jl.
This is yet another case of #2348 (comment)
Please post on https://discourse.julialang.org/c/domain/opt/13 if you need some suggestions.
I'd probably start with:
z_to_p_list = Dict([p for p in GENS[z] if !is1[p]] for z in ZONES)
@expression(
mod,
Disp[z in ZONES, t in POINTS],
sum(D1[(p, t)] + D2[(p, t)] - D1[(p, t)] * enerload[p] for p in z_to_p_list[z] if (p, t) in G_PS)
)
But it depends on what G_PS
is.
Even something like
z_to_p_list = Dict([p for p in GENS[z] if !is1[p]] for z in ZONES)
t_to_p_set = Dict() # Could be Dict{typeof(t),Set{typeof(p)}} if types are known
for (p, t) in G_PS
if !haskey(t_to_p_set, t)
t_to_p_set[t] = Set()
end
push!(t_to_p_set[t], p)
end
@expression(
mod,
Disp[z in ZONES, t in POINTS],
sum(D1[(p, t)] + D2[(p, t)] - D1[(p, t)] * enerload[p] for p in z_to_p_list[z] if p in t_to_p_set[t])
)
from jump.jl.
Related Issues (20)
- jump.dev is down HOT 1
- Model printing is rather verbose HOT 5
- Diagnostics request: using variable in variable container bounds HOT 4
- && and || do not short-circuit in macros HOT 3
- Add support for MOI.ScalarQuadraticCoefficientChange
- Tools to test JuMP models
- NumFOCUS: GSoC 2024 Update HOT 1
- Error vcat(::NonlinearExpr, ::VariableRef, ::Float64) HOT 5
- Increase performance of SOC constraints HOT 4
- Iterating SparseAxisArray does not preserve order HOT 4
- Coefficients of complex variables created with a GenericModel are always Float64
- LinearAlgebra.hermitian is incorrect
- *(::Real, ::Hermitian) is not hermitian HOT 5
- Cannot `convert` an object of type Float64 to an object of type JuMP.NonlinearExpr HOT 3
- Documentation Request: List whether a solver supports Indicator Constraints HOT 4
- Bullet point alignment in bibliography HOT 9
- Multiplication of matrix expression and variables leads to stack overflow and matmul error HOT 4
- Multiple Ranges for variables HOT 3
- Y' when Y is of type ::Matrix{NonlinearExpr} HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jump.jl.