Skip to content

Commit

Permalink
Move XPRS_ATTRIBUTES to src/api.jl (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Mar 19, 2024
1 parent 3842900 commit 58c4d5c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ set_optimizer(model, "PRESOLVE", 0)

## Options

For other parameters use [Xpress Optimizer manual](https://www.fico.com/fico-xpress-optimization/docs/latest/solver/optimizer/HTML/)
or type `julia -e "using Xpress; println(keys(Xpress.XPRS_ATTRIBUTES))"`.
For other parameters see the [Xpress Optimizer manual](https://www.fico.com/fico-xpress-optimization/docs/latest/solver/optimizer/HTML/).

If `logfile` is set to `""`, the log file is disabled and output is printed
to the console ([there might be issues with console output on windows (it is manually implemented with callbacks)](https://www.fico.com/fico-xpress-optimization/docs/latest/solver/optimizer/HTML/OUTPUTLOG.html)).
If `logfile` is set to a file's path, output is printed to that file.
By default, `logfile = ""` (console).
If `logfile` is set to `""`, the log file is disabled and output is printed to
the console ([there might be issues with console output on windows (it is manually implemented with callbacks)](https://www.fico.com/fico-xpress-optimization/docs/latest/solver/optimizer/HTML/OUTPUTLOG.html)).

If `logfile` is set to a file's path, output is printed to that file. By
default, `logfile = ""` (console).

### Custom options

Expand Down
12 changes: 0 additions & 12 deletions src/Xpress.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,6 @@ include("api.jl")
include("xprs_callbacks.jl")
include("license.jl")

_is_xprs_attribute(name::Symbol) = _is_xprs_attribute(string(name))

function _is_xprs_attribute(name::String)
return startswith(name, "XPRS_") &&
all(isuppercase(c) || isdigit(c) for c in name if c != '_')
end

const XPRS_ATTRIBUTES = Dict{String,Any}(
replace("$name", "XPRS_" => "") => getfield(Lib, name) for
name in filter(_is_xprs_attribute, names(Lib; all = true))
)

function initialize()
Libdl.dlopen(libxprs)
userlic()
Expand Down
12 changes: 12 additions & 0 deletions src/api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6942,3 +6942,15 @@ function setcontrols!(prob::XpressProblem; kwargs...)
end
return
end

_is_xprs_attribute(name::Symbol) = _is_xprs_attribute(string(name))

function _is_xprs_attribute(name::String)
return startswith(name, "XPRS_") &&
all(isuppercase(c) || isdigit(c) for c in name if c != '_')
end

const XPRS_ATTRIBUTES = Dict{String,Any}(
replace("$name", "XPRS_" => "") => getfield(Lib, name) for
name in filter(_is_xprs_attribute, names(Lib; all = true))
)

0 comments on commit 58c4d5c

Please sign in to comment.