-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update CMake configuration for Gurobi 9.5
- Loading branch information
1 parent
589978b
commit a630790
Showing
4 changed files
with
86 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
find_path( | ||
GUROBI_INCLUDE_DIRS | ||
NAMES gurobi_c.h | ||
HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME} | ||
PATH_SUFFIXES include) | ||
|
||
find_library( | ||
GUROBI_LIBRARY | ||
NAMES gurobi gurobi81 gurobi90 gurobi95 | ||
HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME} | ||
PATH_SUFFIXES lib) | ||
|
||
get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES) | ||
if("CXX" IN_LIST languages) | ||
if(MSVC) | ||
# determine Visual Studio year | ||
if(MSVC_TOOLSET_VERSION EQUAL 142) | ||
set(MSVC_YEAR "2019") | ||
elseif(MSVC_TOOLSET_VERSION EQUAL 141) | ||
set(MSVC_YEAR "2017") | ||
elseif(MSVC_TOOLSET_VERSION EQUAL 140) | ||
set(MSVC_YEAR "2015") | ||
endif() | ||
|
||
if(MT) | ||
set(M_FLAG "mt") | ||
else() | ||
set(M_FLAG "md") | ||
endif() | ||
|
||
find_library( | ||
GUROBI_CXX_LIBRARY | ||
NAMES gurobi_c++${M_FLAG}${MSVC_YEAR} | ||
HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME} | ||
PATH_SUFFIXES lib) | ||
find_library( | ||
GUROBI_CXX_DEBUG_LIBRARY | ||
NAMES gurobi_c++${M_FLAG}d${MSVC_YEAR} | ||
HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME} | ||
PATH_SUFFIXES lib) | ||
else() | ||
find_library( | ||
GUROBI_CXX_LIBRARY | ||
NAMES gurobi_c++ | ||
HINTS ${GUROBI_DIR} $ENV{GUROBI_HOME} | ||
PATH_SUFFIXES lib) | ||
set(GUROBI_CXX_DEBUG_LIBRARY ${GUROBI_CXX_LIBRARY}) | ||
endif() | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(GUROBI DEFAULT_MSG GUROBI_LIBRARY | ||
GUROBI_INCLUDE_DIRS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ Copyright (C) 2013-2021, Filipe Brandao <[email protected]> | |
#include <map> | ||
#include <vector> | ||
#include <algorithm> | ||
#include "gurobi_c.h" | ||
#include "gurobi_c++.h" | ||
#include "config.hpp" | ||
#include "common.hpp" | ||
|
@@ -36,12 +35,12 @@ void solve(const Instance &inst, bool print_inst = false, bool pyout = false) { | |
// model.getEnv().set(GRB_DoubleParam_ImproveStartTime, 60); | ||
// model.getEnv().set(GRB_DoubleParam_ImproveStartGap, 1); | ||
|
||
vector <Arc> As(afg.A); | ||
sort(all(As)); | ||
map <Arc, GRBVar> va; | ||
std::vector <Arc> As(afg.A); | ||
std::sort(all(As)); | ||
std::map <Arc, GRBVar> va; | ||
int lastv = afg.Ts[0] - 1; | ||
for (int i = 0; i < inst.nbtypes; i++) { | ||
lastv = min(lastv, afg.Ts[i] - 1); | ||
lastv = std::min(lastv, afg.Ts[i] - 1); | ||
} | ||
for (int i = 0; i < 3; i++) { | ||
for (const Arc &a : As) { | ||
|
@@ -72,9 +71,9 @@ void solve(const Instance &inst, bool print_inst = false, bool pyout = false) { | |
} | ||
} | ||
|
||
vector <vector<Arc>> Al(inst.nsizes); | ||
vector <vector<Arc>> in(afg.NV); | ||
vector <vector<Arc>> out(afg.NV); | ||
std::vector <std::vector<Arc>> Al(inst.nsizes); | ||
std::vector <std::vector<Arc>> in(afg.NV); | ||
std::vector <std::vector<Arc>> out(afg.NV); | ||
|
||
for (const Arc &a : As) { | ||
if (a.label != afg.LOSS) { | ||
|
@@ -123,7 +122,7 @@ void solve(const Instance &inst, bool print_inst = false, bool pyout = false) { | |
printf("Total run time: %.2f seconds\n", tg + pre); | ||
|
||
if (inst.vtype == 'I') { | ||
map<Arc, int> flow; | ||
std::map<Arc, int> flow; | ||
for (const auto &a : va) { | ||
double x = a.second.get(GRB_DoubleAttr_X); | ||
int rx = static_cast<int>(round(x)); | ||
|