Skip to content

Commit

Permalink
adapt to fixed log callbacks
Browse files Browse the repository at this point in the history
- should be threadsafe now
- works for mip output now, too
  • Loading branch information
svigerske committed Feb 4, 2022
1 parent f963da5 commit a66ec73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/gamsconfig.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ solverConfig:
@COIN_HAS_HIGHS_TRUE@ libName: highs/libGamsHighs.la
@COIN_HAS_HIGHS_TRUE@ auditCode: his
@COIN_HAS_HIGHS_TRUE@ solverInterfaceType: 1
@COIN_HAS_HIGHS_TRUE@ threadSafeIndic: False
@COIN_HAS_HIGHS_TRUE@ threadSafeIndic: True
@COIN_HAS_HIGHS_TRUE@ modelTypes:
@COIN_HAS_HIGHS_TRUE@ - LP
@COIN_HAS_HIGHS_TRUE@ - RMIP
Expand Down
20 changes: 1 addition & 19 deletions src/highs/GamsHighs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@ typedef struct
Highs* highs;
} gamshighs_t;

static
void gevprint(
HighsInt level,
const char* msg,
void* msgcb_data
)
{
gevHandle_t gev = (gevHandle_t) msgcb_data;
gevLogPChar(gev, msg);
}

static
void gevlog(
HighsLogType type,
Expand Down Expand Up @@ -114,14 +103,7 @@ int setupProblem(
assert(gh->highs == NULL);

gh->highs = new Highs();

// need to set log callbacks in options struct, since HiGHS::run() calls highsSetLogCallback(options)
// TODO we should not need to uncast const-ness, but there is no method in HiGHS class to set log callbacks
HighsOptions& options = const_cast<HighsOptions&>(gh->highs->getOptions());
options.printmsgcb = gevprint;
options.logmsgcb = gevlog;
options.msgcb_data = (void*) gh->gev;
highsSetLogCallback(options);
gh->highs->setLogCallback(gevlog, gh->gev);

numCol = gmoN(gh->gmo);
numRow = gmoM(gh->gmo);
Expand Down

0 comments on commit a66ec73

Please sign in to comment.