Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6'
- 'nightly'
- '1.11'
- '1.12'
os:
- ubuntu-latest
arch:
Expand All @@ -33,10 +33,4 @@ jobs:
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v2
with:
files: lcov.info
- uses: julia-actions/julia-uploadcoveralls@v1
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
/tmp
/.vscode
/Result_Plots
*.log
*.log
AGENTS/*
.agent/*
scripts/*
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "AGENTS"]
path = AGENTS
url = git@github.com:avinashresearch1/AGENTS.git
1 change: 1 addition & 0 deletions AGENTS
Submodule AGENTS added at 09ca23
24 changes: 24 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Procedure for all cases:
1. Research:
- Read this folder and all files in it in depth, understand how it works deeply, what it does and all its specificities. when that’s done, write a detailed report of your learnings and findings in research.md
2. Planning:
- For the prompt given, write a detailed plan.md document outlining how to implement this. include code snippets. read source files before suggesting changes, base the plan on the actual codebase.
3. Implementation:
- implement it all. when you’re done with a task or phase, mark it as completed in the plan document. do not stop until all tasks and phases are completed.
- For each function you add or modify. Add detailed but concise documentation on what you have done. A developer and reviewer should be able to read the code and understand what was removed, modified and added and why.


# How to run Julia Code (relevant for Julia only)
- For Julia work, use a single DaemonMode server per Julia project to avoid repeated precompile costs.
- Start (or ensure) the daemon from the target Julia project directory (the one with `Project.toml`) before running any Julia code: `bash scripts/julia-daemon-start`.
- Run files via the daemon: `bash scripts/julia-daemon-run path/to/file.jl [args...]`.
- Run ad-hoc expressions via the daemon: `bash scripts/julia-daemon-expr 'expr'`.
- Avoid calling `julia` directly unless explicitly requested.
- Stop the daemon when asked: `bash scripts/julia-daemon-stop`.
- If working in a subproject, set `workdir` to that project's root or set `JULIA_PROJECT_DIR` to the project path.
- Port is stored in `.agent/julia-daemon.port` (default 3000); override with `JULIA_DAEMON_PORT`.
- **IMPORTANT**: All Julia commands require `all` permissions because the `juliaup` launcher needs write access to `~/.julia/juliaup/` (lockfile) which is outside the workspace sandbox.
- You must never directly run `julia` commands. Always use the Julia daemon server and client.

You should never need to create a new Julia depot anywhere. Inform the user if you are stuck.
You should never need to install another Julia version. Always ask for permission if you think you do.
Binary file added Combinatorial mCp generator.pdf
Binary file not shown.
23 changes: 10 additions & 13 deletions Examples/XLSX_interface/ClassicHENSProblem/6_Stream/6_stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
using Plots
using JuMP
using HiGHS
using Ipopt
using MathOptInterface
using Test

using BARON

exportall(CompHENS)
const MOI = MathOptInterface

# 2. Specify path to xlsx file
file_path_xlsx = joinpath(@__DIR__, "CompHENS_interface_SimpleExample.xlsx")
Expand All @@ -20,13 +19,10 @@ prob = ClassicHENSProblem(file_path_xlsx; ΔT_min = 20.0, verbose = true)

@time solve_minimum_utilities_subproblem!(prob)
print_min_utils_pinch_points(prob)
@test prob.pinch_points == [(517.0, 497.0)]
@test isapprox(prob.hot_utilities_dict["ST"].Q, 244.13; atol = 1)
@test isapprox(prob.cold_utilities_dict["CW"].Q, 172.6; atol = 1)

# 5. Solve the minimum number of units subproblem:
@time solve_minimum_units_subproblem!(prob)
@test prob.min_units == 8
@test prob.min_units == 5

# 6. Generate stream matches
EMAT = 2.5
Expand All @@ -35,11 +31,14 @@ EMAT = 2.5
# 7. Network generation:
# Specify which superstructure to use for each stream
obj_func = CostScaledPaterson()
overall_network = merge(construct_superstructure(prob.stream_names, FloudasCiricGrossmann(), prob), construct_superstructure(prob.utility_names, ParallelSplit(), prob))
overall_network = merge(construct_superstructure(prob.stream_names, FloudasCiricGrossmann(), prob), construct_superstructure(prob.utility_names, FloudasCiricGrossmann(), prob))
cost_coeff, scaling_coeff = 670, 0.83
optimizer = BARON.Optimizer
optimizer = optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0, "max_iter" => 5000, "tol" => 1e-6)

generate_network!(prob, EMAT, overall_network; obj_func = CostScaledPaterson(), optimizer = optimizer, verbose = true, cost_coeff = cost_coeff, scaling_coeff = scaling_coeff)
generate_network!(prob, EMAT; overall_network = overall_network, obj_func = obj_func, optimizer = optimizer, verbose = true, cost_coeff = cost_coeff, scaling_coeff = scaling_coeff, save_model = true)
model = prob.results_dict[:network_gen_model]
@test termination_status(model) in [MOI.LOCALLY_SOLVED, MOI.OPTIMAL, MOI.ALMOST_LOCALLY_SOLVED, MOI.ALMOST_OPTIMAL]
@test primal_status(model) == MOI.FEASIBLE_POINT

#=
using Alpine
Expand All @@ -62,5 +61,3 @@ const alpine = JuMP.optimizer_with_attributes(
"partition_scaling_factor" => 10,
)
=#


Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
using Plots
using JuMP
using HiGHS
using Ipopt
using MathOptInterface
using Test

using BARON

exportall(CompHENS)
const MOI = MathOptInterface

# 2. Specify path to xlsx file
file_path_xlsx = joinpath(@__DIR__, "CompHENS_interface_ColbergMorari.xlsx")
Expand Down Expand Up @@ -39,17 +38,15 @@ prob.results_dict[:Q]
obj_func = CostScaledPaterson()
overall_network = merge(construct_superstructure(prob.stream_names, FloudasCiricGrossmann(), prob), construct_superstructure(prob.utility_names, FloudasCiricGrossmann(), prob))
base_cost, cost_coeff, scaling_coeff = 8600, 670, 0.83
optimizer = BARON.Optimizer
optimizer = optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0, "max_iter" => 5000, "tol" => 1e-6)

generate_network!(prob, EMAT; overall_network = overall_network, obj_func = obj_func, optimizer = optimizer, verbose = true, cost_coeff = cost_coeff, scaling_coeff = scaling_coeff, base_cost = base_cost, save_model = true, time_limit = 20.0)
generate_network!(prob, EMAT; overall_network = overall_network, obj_func = obj_func, optimizer = optimizer, verbose = true, cost_coeff = cost_coeff, scaling_coeff = scaling_coeff, base_cost = base_cost, save_model = true)
model = prob.results_dict[:network_gen_model]
#print(model)
file_name = "/home/avinash/Desktop/COMPHENS/CompHENS.jl/Result_Plots/Colberg_Morari.pdf"

plot_HEN_streamwise(prob, model, overall_network, file_name; digits = 1)
#stream = "C2"
#CompHENS.print_stream_results(stream, prob, model, overall_network[stream])
@test termination_status(model) in [MOI.LOCALLY_SOLVED, MOI.OPTIMAL, MOI.ALMOST_LOCALLY_SOLVED, MOI.ALMOST_OPTIMAL]
@show termination_status(model)
@test primal_status(model) == MOI.FEASIBLE_POINT
# print(model)
value.(model[:ΔT_upper])
value.(model[:ΔT_lower])
value.(model[:T_LMTD])
get_design_area(prob)
get_design_area(prob)
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

using Plots
using JuMP
using Ipopt
using MathOptInterface
using Test
const MOI = MathOptInterface

using BARON

#exportall(CompHENS)

# 2. Specify path to xlsx file
file_path_xlsx = joinpath(@__DIR__, "Gundersen_4_stream.xlsx")
Expand Down Expand Up @@ -42,14 +42,12 @@ overall_network = construct_superstructure(prob.all_names, FloudasCiricGrossmann
obj_func = CostScaledPaterson()
base_cost, cost_coeff, scaling_coeff = 4000, 500, 0.83

# 7.i. Commercial using BARON:
optimizer = optimizer_with_attributes(BARON.Optimizer, "MaxTime" => 20.0, "AbsConFeasTol" => 1)
results_df = generate_network!(prob, EMAT; optimizer = optimizer, obj_func = obj_func, verbose = true, cost_coeff = cost_coeff, scaling_coeff = scaling_coeff, base_cost = base_cost, save_model = true)

optimizer = optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0, "max_iter" => 8000, "tol" => 1e-6)
results_df = generate_network!(prob, EMAT; overall_network = overall_network, optimizer = optimizer, obj_func = obj_func, verbose = true, cost_coeff = cost_coeff, scaling_coeff = scaling_coeff, base_cost = base_cost, save_model = true)
@show termination_status(model)
model = prob.results_dict[:network_gen_model]
file_name = "/home/avinash/Desktop/COMPHENS/CompHENS.jl/Examples/XLSX_interface/ClassicHENSProblem/Gundersen_4_stream/Gundersen_4_stream.pdf"

plot_HEN_streamwise(prob, model, overall_network, file_name; digits = 1)
@test termination_status(model) in [MOI.LOCALLY_SOLVED, MOI.OPTIMAL, MOI.ALMOST_LOCALLY_SOLVED, MOI.ALMOST_OPTIMAL]
@test primal_status(model) == MOI.FEASIBLE_POINT

#=Trials
#CompHENS.
Expand Down Expand Up @@ -106,4 +104,4 @@ initial_values = (; v_names = variable_ref, v_starts = start_vals)
optimizer = IPOPT_solver
optimizer = JUNIPER_solver
generate_network!(prob, EMAT; optimizer = optimizer, verbose = true, cost_coeff = cost_coeff, scaling_coeff = scaling_coeff, base_cost = base_cost, save_model = true, initial_values = initial_values)
=#
=#

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
using Plots
using JuMP
using HiGHS
using Ipopt
using MathOptInterface
using Test
const MOI = MathOptInterface

using BARON
#using XLSX
#using DataFrames

Expand Down Expand Up @@ -35,7 +37,10 @@ overall_network = construct_superstructure(prob.all_names, FloudasCiricGrossmann
obj_func = CostScaledPaterson()
base_cost, cost_coeff, scaling_coeff = 8333.3, 641.7, 1

optimizer = optimizer_with_attributes(BARON.Optimizer, "MaxTime" => -1, "AbsConFeasTol" => 10)
optimizer = optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0, "max_iter" => 10000, "tol" => 1e-6)
results_df = generate_network!(prob, EMAT; optimizer = optimizer, obj_func = obj_func, verbose = true, cost_coeff = cost_coeff, scaling_coeff = scaling_coeff, base_cost = base_cost, save_model = true)
model = prob.results_dict[:network_gen_model]
@test termination_status(model) in [MOI.LOCALLY_SOLVED, MOI.OPTIMAL, MOI.ALMOST_LOCALLY_SOLVED, MOI.ALMOST_OPTIMAL]
@test primal_status(model) == MOI.FEASIBLE_POINT

prob.results_dict[:HLD_list]
prob.results_dict[:HLD_list]
11 changes: 6 additions & 5 deletions Examples/XLSX_interface/ClassicHENSProblem/NaN_MWE/NaN_MWE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
using Plots
using JuMP
using HiGHS
using Ipopt
using MathOptInterface
using Test
using BARON
const MOI = MathOptInterface

file_path_xlsx = joinpath(@__DIR__, "CompHENS_interface_KangLiu_Period1.xlsx")
prob = ClassicHENSProblem(file_path_xlsx; ΔT_min = 10, verbose = true)
Expand Down Expand Up @@ -41,10 +43,9 @@ overall_network = construct_superstructure(prob.all_names, FloudasCiricGrossmann
obj_func = CostScaledPaterson()
base_cost, cost_coeff, scaling_coeff = 4000, 500, 0.83

optimizer = optimizer_with_attributes(BARON.Optimizer, "MaxTime" => 20.0, "AbsConFeasTol" => 1.5)
optimizer = optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0, "max_iter" => 8000, "tol" => 1e-6)
results_df = generate_network!(prob, EMAT; optimizer = optimizer, obj_func = obj_func, verbose = true, cost_coeff = cost_coeff, scaling_coeff = scaling_coeff, base_cost = base_cost, save_model = true)

model = prob.results_dict[:network_gen_model]
file_name = "/home/avinash/Desktop/COMPHENS/CompHENS.jl/Examples/XLSX_interface/ClassicHENSProblem/NaN_MWE/KangLiu_Period1.pdf"

plot_HEN_streamwise(prob, model, overall_network, file_name; digits = 1)
@test termination_status(model) in [MOI.LOCALLY_SOLVED, MOI.OPTIMAL, MOI.ALMOST_LOCALLY_SOLVED, MOI.ALMOST_OPTIMAL]
@test primal_status(model) == MOI.FEASIBLE_POINT
Loading
Loading