GenXProject / GenX.jl

GenX: a configurable power system capacity expansion model for studying low-carbon energy futures. More details at : https://genx.mit.edu
https://genxproject.github.io/GenX.jl/
GNU General Public License v2.0
256 stars 105 forks source link

[Bug]: Changing the optimiser does not work #691

Closed mrchamanbaz closed 2 months ago

mrchamanbaz commented 2 months ago

Bug description

Changing the optimiser on the setting is not reflected in the code. The package always uses HiGHS no matter what optimiser is selected in genx_settings.yml. Isn't it because case_runner.jl already defines the optimiser and it is not changed elsewhere based on the settings: function run_genx_case!(case::AbstractString, optimizer::Any=HiGHS.Optimizer)

Environment and Version

Julia 1.10.2 on a linux server

Relevant error messages

No response

Additional context

No response

sambuddhac commented 2 months ago

If you are using GenX from the main branch (which is the GenX prelease 0.4.0), this page in the doc pages tells you how to use one of the other commercial (or non-commercial solvers) other than HiGHS (which is the default solver):

https://genxproject.github.io/GenX.jl/dev/Getting_Started/commercial_solvers/

Specifically, for instance, if you want to use let's say, Gurobi, or, CPLEX, this is what you should be doing:

Make sure you have a valid license and the actual solvers for either of Gurobi or CPLEX installed on your machine Add Gurobi or CPLEX to the Julia Project. $ julia --project=/home/youruser/GenX

julia> <press close-bracket ] to access the package manager>
(GenX) pkg> add Gurobi

-or- (GenX) pkg> add CPLEX

Edit the Run.jl file to use the commercial solver. For example, to use Gurobi, you can add the following lines to the Run.jl file:

using Gurobi
using GenX

run_genx_case!(dirname(@__FILE__), Gurobi.Optimizer)

Warning Note that if you have not already installed the required Julia packages or you do not have a valid Gurobi license on your host machine, you will receive an error message and Run.jl will not run to completion.

Please let us know, if that works for you.

mrchamanbaz commented 2 months ago

Thanks. Yes, this solves the problem. Has this changed recently? I used to define the solver in the setting in the past. It seems I am using the old documentation: https://genxproject.github.io/GenX.jl/stable/how_to_run_genx.html