Skip to content

Commit

Permalink
update sovler clp, cplex, scip, highs
Browse files Browse the repository at this point in the history
  • Loading branch information
swang22 committed Jun 27, 2024
1 parent 82a43fc commit 78c9bf3
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
DataCase: Data_100RPS/ #String, the folder name of data, default Data/ GTEP example: "Data_100RPS/"; PCM example: "Data_PCM2035/"
model_mode: GTEP #String,"GTEP" or "PCM" or ...
aggregated!: 1 #Binary,1 aggregate technology resource; 0 Does Not
representative_day!: 0 #Binary,1 use representative days (need to set time_periods); 0 Does Not
representative_day!: 1 #Binary,1 use representative days (need to set time_periods); 0 Does Not
inv_dcs_bin: 0 #Binary, 1 use integer variable for investment decisions; 0 Does Not
time_periods: #representative day clustering, could define yourself
1 : (3, 20, 6, 20) # March 20th to June 20th; 1;srping
2 : (6, 21, 9, 21) # June 21st to September 21st; 2;summer
3 : (9, 22, 12, 20) # September 22nd to December 20th; 3;fall
4 : (12, 21, 3, 19) # December 21st to March 19th; 4;winter

solver: gurobi #String, solver: cbc, gurobi
solver: cbc #String, solver: cbc, clp, scip, highs, cplex, gurobi
debug: 0 #Float, flag for turning on the Method of Debug, 0 = not active; 1 = active conflict method; 2 = active penalty method
#(please refer to https://jump.dev/JuMP.jl/stable/tutorials/getting_started/debugging/, https://jump.dev/JuMP.jl/stable/manual/solutions/#Conflicts for more detal)
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ time_periods: #representative day clustering for time peroid
3 : (9, 22, 12, 20) # September 22nd to December 20th; 3;fall
4 : (12, 21, 3, 19) # December 21st to March 19th; 4;winter
unit_commitment: 0 #Int, 0 no UC constraints;, 1 integer UC; 2 convexified UC
solver: gurobi #String,solver: cbc, gurobi
solver: cbc #String, solver: cbc, clp, scip, highs, cplex, gurobi
debug: 0 #Binary, flag for turning on the Method of Debug, 0 = not active; 1 = active conflict method; 2 = active penalty method
#(please refer to https://jump.dev/JuMP.jl/stable/tutorials/getting_started/debugging/, https://jump.dev/JuMP.jl/stable/manual/solutions/#Conflicts for more detal)

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ time_periods: #representative day clustering for time peroid
3 : (9, 22, 12, 20) # September 22nd to December 20th; 3;fall
4 : (12, 21, 3, 19) # December 21st to March 19th; 4;winter
unit_commitment: 0 #Int, 0 no UC constraints;, 1 integer UC; 2 convexified UC
solver: gurobi #String,solver: cbc, gurobi
solver: cbc #String, solver: cbc, clp, scip, highs, cplex, gurobi
debug: 0 #Binary, flag for turning on the Method of Debug, 0 = not active; 1 = active conflict method; 2 = active penalty method
#(please refer to https://jump.dev/JuMP.jl/stable/tutorials/getting_started/debugging/, https://jump.dev/JuMP.jl/stable/manual/solutions/#Conflicts for more detal)

Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ time_periods: #representative day clustering, could define y
2 : (6, 21, 9, 21) # June 21st to September 21st; 2;summer
3 : (9, 22, 12, 20) # September 22nd to December 20th; 3;fall
4 : (12, 21, 3, 19) # December 21st to March 19th; 4;winter
solver: gurobi #solver: cbc, gurobi
solver: cbc #String, solver: cbc, clp, scip, highs, cplex, gurobi
debug: 0 #Flag for turning on the Method of Debug, 0 = not active; 1 = active conflict method; 2 = active penalty method
#(please refer to https://jump.dev/JuMP.jl/stable/tutorials/getting_started/debugging/, https://jump.dev/JuMP.jl/stable/manual/solutions/#Conflicts for more detal)
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ time_periods: #representative day clustering, could define y
3 : (9, 22, 12, 20) # September 22nd to December 20th; 3;fall
4 : (12, 21, 3, 19) # December 21st to March 19th; 4;winter
unit_commitment: 0 #Int, 0 no UC constraints;, 1 integer UC; 2 convexified UC
solver: gurobi #solver: cbc, gurobi
solver: cbc #String, solver: cbc, clp, scip, highs, cplex, gurobi
debug: 0 #Flag for turning on the Method of Debug, 0 = not active; 1 = active conflict method; 2 = active penalty method
#(please refer to https://jump.dev/JuMP.jl/stable/tutorials/getting_started/debugging/, https://jump.dev/JuMP.jl/stable/manual/solutions/#Conflicts for more detal)
116 changes: 115 additions & 1 deletion src/solver_config.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function initiate_solver(solver_name::String, path::String)
solver_settings = YAML.load(open(path*"Settings/"*solver_name*"_settings.yml"))
if solver_name == "cbc"
# Optional solver parameters ############################################
# Optional solver parameters ############################################
Myseconds = 1e-6
if(haskey(solver_settings, "TimeLimit")) Myseconds = solver_settings["TimeLimit"] end
MylogLevel = 1e-6
Expand All @@ -28,6 +28,120 @@ function initiate_solver(solver_name::String, path::String)
"threads" => Mythreads
)
end
if solver_name == "clp"
# Optional solver parameters ############################################
Myfeasib_Tol = 1e-7
if(haskey(solver_settings, "Feasib_Tol")) Myfeasib_Tol = solver_settings["Feasib_Tol"] end
Myseconds = -1
if(haskey(solver_settings, "TimeLimit")) Myseconds = solver_settings["TimeLimit"] end
Mypre_solve = 0
if(haskey(solver_settings, "Pre_Solve")) Mypre_solve = solver_settings["Pre_Solve"] end
Mymethod = 5
if(haskey(solver_settings, "Method")) Mymethod = solver_settings["Method"] end
MyDualObjectiveLimit = 1e308
if(haskey(solver_settings, "DualObjectiveLimit")) MymaxNodes = solver_settings["DualObjectiveLimit"] end
MyMaximumIterations = 2147483647
if(haskey(solver_settings, "MaximumIterations")) MyallowableGap = solver_settings["MaximumIterations"] end
MyLogLevel= 1
if(haskey(solver_settings, "LogLevel")) MyLogLevel = solver_settings["LogLevel"] end
MyInfeasibleReturn = 0
if(haskey(solver_settings, "InfeasibleReturn")) MyInfeasibleReturn = solver_settings["InfeasibleReturn"] end
MyScaling = 3
if(haskey(solver_settings, "Scaling")) MyScaling = solver_settings["Scaling"] end
MyPerturbation = 100
if(haskey(solver_settings, "Perturbation")) MyPerturbation = solver_settings["Perturbation"] end

OPTIMIZER = optimizer_with_attributes(Clp.Optimizer,
"PrimalTolerance" => Myfeasib_Tol,
"DualObjectiveLimit" => MyDualObjectiveLimit,
"MaximumIterations" => MyMaximumIterations,
"MaximumSeconds" => Myseconds,
"LogLevel" => MyLogLevel,
"PresolveType" => Mypre_solve,
"SolveType" => Mymethod,
"InfeasibleReturn" => MyInfeasibleReturn,
"Scaling" => MyScaling,
"Perturbation" => MyPerturbation
)
end

if solver_name == "highs"
# Optional solver parameters ############################################
Myfeasib_Tol = 1e-6
if(haskey(solver_settings, "Feasib_Tol")) Myfeasib_Tol = solver_settings["Feasib_Tol"] end
MyOptimal_Tol = 1e-4
if(haskey(solver_settings, "Optimal_Tol")) MyOptimal_Tol = solver_settings["Optimal_Tol"] end
Myseconds = 1.0e23
if(haskey(solver_settings, "TimeLimit")) Myseconds = solver_settings["TimeLimit"] end
Mypre_solve = "choose"
if(haskey(solver_settings, "Pre_Solve")) Mypre_solve = solver_settings["Pre_Solve"] end
Mymethod = "ipm"
if(haskey(solver_settings, "Method")) Mymethod = solver_settings["Method"] end

OPTIMIZER = optimizer_with_attributes(HiGHS.Optimizer,
"primal_feasibility_tolerance" => Myfeasib_Tol,
"dual_feasibility_tolerance" => MyOptimal_Tol,
"time_limit" => Myseconds,
"presolve" => Mypre_solve,
"solver" => Mymethod
)
end

if solver_name == "scip"
# Optional solver parameters ############################################
MyDispverblevel = 0
if(haskey(solver_settings, "Dispverblevel")) MyDispverblevel = solver_settings["Dispverblevel"] end
Mylimitsgap = 0.05
if(haskey(solver_settings, "limitsgap")) Mylimitsgap = solver_settings["limitsgap"] end

OPTIMIZER = optimizer_with_attributes(SCIP.Optimizer,
"display_verblevel" => MyDispverblevel,
"limits_gap" => Mylimitsgap
)
end

if solver_name == "cplex"
# Optional solver parameters ############################################
Myfeasib_Tol = 1e-7 #https://www.ibm.com/docs/en/cofz/12.9.0?topic=parameters-solution-type-lp-qp
if(haskey(solver_settings, "Feasib_Tol")) Myfeasib_Tol = solver_settings["Feasib_Tol"] end
MyOptimal_Tol = 1e-4 #https://www.ibm.com/docs/en/cofz/12.9.0?topic=parameters-optimality-tolerance
if(haskey(solver_settings, "Optimal_Tol")) MyOptimal_Tol = solver_settings["Optimal_Tol"] end
MyAggFill= 10 #https://www.ibm.com/docs/en/cofz/12.9.0?topic=parameters-preprocessing-aggregator-fill
if(haskey(solver_settings, "AggFill")) MyAggFill = solver_settings["AggFill"] end
Mypre_dual = 0 #https://www.ibm.com/docs/en/cofz/12.9.0?topic=parameters-presolve-dual-setting
if(haskey(solver_settings, "PreDual")) Mypre_dual = solver_settings["PreDual"] end
Myseconds = 1e+75 #https://www.ibm.com/docs/en/cofz/12.9.0?topic=parameters-optimizer-time-limit-in-seconds
if(haskey(solver_settings, "TimeLimit")) Myseconds = solver_settings["TimeLimit"] end
MyMIPGap = 1e-3 #https://www.ibm.com/docs/en/cofz/12.9.0?topic=parameters-relative-mip-gap-tolerance
if(haskey(solver_settings, "MIPGap")) MyMIPGap = solver_settings["MIPGap"] end
Mymethod = 0 #https://www.ibm.com/docs/en/cofz/12.9.0?topic=optimizers-using-parallel-in-component-libraries
if(haskey(solver_settings, "Method")) Mymethod = solver_settings["Method"] end
Mypre_solve = 1 # https://www.ibm.com/docs/en/icos/12.8.0.0?topic=parameters-presolve-switch
if(haskey(solver_settings, "Pre_Solve")) Mypre_solve = solver_settings["Pre_Solve"] end
MyBarConvTol = 1e-8 #https://www.ibm.com/docs/en/cofz/12.9.0?topic=parameters-convergence-tolerance-lp-qp-problems
if(haskey(solver_settings, "BarConvTol")) MyBarConvTol = solver_settings["BarConvTol"] end
MyNumericFocus = 0 #https://www.ibm.com/docs/en/cofz/12.9.0?topic=parameters-numerical-precision-emphasis
if(haskey(solver_settings, "NumericFocus")) MyNumericFocus = solver_settings["NumericFocus"] end
MyBarObjRng = 1e+75 #https://www.ibm.com/docs/en/cofz/12.9.0?topic=parameters-barrier-objective-range
if(haskey(solver_settings, "BarObjRng")) MyBarObjRng = solver_settings["BarObjRng"] end
MySolutionType = 2 #https://www.ibm.com/docs/en/cofz/12.9.0?topic=parameters-solution-type-lp-qp
if(haskey(solver_settings, "SolutionType")) MySolutionType = solver_settings["SolutionType"] end

OPTIMIZER = optimizer_with_attributes(CPLEX.Optimizer,
"CPX_PARAM_EPRHS" => Myfeasib_Tol,
"CPX_PARAM_EPOPT" => MyOptimal_Tol,
"CPX_PARAM_AGGFILL" => MyAggFill,
"CPX_PARAM_PREDUAL" => Mypre_dual,
"CPX_PARAM_TILIM" => Myseconds,
"CPX_PARAM_EPGAP" => MyMIPGap,
"CPX_PARAM_LPMETHOD" => Mymethod,
"CPX_PARAM_PREIND" => Mypre_solve,
"CPX_PARAM_BAREPCOMP" => MyBarConvTol,
"CPX_PARAM_NUMERICALEMPHASIS" => MyNumericFocus,
"CPX_PARAM_BAROBJRNG" => MyBarObjRng,
"CPX_PARAM_SOLUTIONTYPE" => MySolutionType
)
end
if solver_name == "gurobi"
# Optional solver parameters ############################################
MyFeasibilityTol = 1e-6 # Constraint (primal) feasibility tolerances. See https://www.gurobi.com/documentation/8.1/refman/feasibilitytol.html
Expand Down

0 comments on commit 78c9bf3

Please sign in to comment.