Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OR-Tools Integration & C++17 upgrade #1035

Open
wants to merge 60 commits into
base: develop
Choose a base branch
from
Open

OR-Tools Integration & C++17 upgrade #1035

wants to merge 60 commits into from

Conversation

dguittet
Copy link
Collaborator

@dguittet dguittet commented Jun 13, 2023

To use:

Download OR-Tools source separately in the same directory as sam, ssc, etc.
Set the directory via export ORTOOLSDIR=$HOME/.../sam-dev/or-tools/install (for Windows, set the environment variable)

Then build and install it with CMake.

If using XPRESS, add -DUSE_XPRESS=ON -DXPRESS_ROOT=${XPRESS_ROOT} to the cmake config commands below. If XPRESS_ROOT is defined as an environment variable, you don't need to add it to the CMake command.

Unix

Environment variable: ORTOOLSDIR = /path/to/or-tools/install/install_release

cd or-tools

# without XPRESS
cmake -S . -B build -DBUILD_DEPS=ON -DUSE_COINOR=OFF -DUSE_HIGHS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SAMPLES=OFF -DBUILD_DOC=OFF -DINSTALL_DOC=OFF -DUSE_XPRESS=OFF -DCMAKE_INSTALL_PREFIX=${ORTOOLSDIR}

cmake --build build --config Release --target install -v -j 4

# with XPRESS
cmake -S . -B build -DBUILD_DEPS=ON -DUSE_COINOR=OFF -DUSE_HIGHS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SAMPLES=OFF -DBUILD_DOC=OFF -DINSTALL_DOC=OFF -DCMAKE_INSTALL_PREFIX=${ORTOOLSDIR} -DUSE_XPRESS=ON -DXPRESS_ROOT=${XPRESS_ROOT}

cmake --build build --config Release --target install -v -j 4

# Build SSC

cd ssc
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DSAM_SKIP_TOOLS=1 

Windows

Use x64 Native Tools Command Prompt for VS 2022 and note VS 2022 is required. If XPRESS_ROOT is defined as an environment variable, you don't need to add it to the CMake command. Windows requires building both Debug and Release. In addition, these are built in separate directories named install_release and install_debug. The "release" and "debug" text is needed in the names for the CMake to switch between the configurations.

Environment variables:
ORTOOLSDIR = /path/to/or-tools/install/install_release
ORTOOLSDBDIR = /path/to/or-tools/install/install_debug

cd or-tools

# Release, without XPRESS
cmake -S . -B build_release -DBUILD_DEPS=ON -DUSE_COINOR=OFF -DUSE_HIGHS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SAMPLES=OFF -DBUILD_DOC=OFF -DINSTALL_DOC=OFF -DUSE_XPRESS=OFF 

cmake --build build_release --config Release --target install -v -j 4

# Debug, without XPRESS
cmake -S . -B build_debug -DBUILD_DEPS=ON -DUSE_COINOR=OFF -DUSE_HIGHS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SAMPLES=OFF -DBUILD_DOC=OFF -DINSTALL_DOC=OFF -DUSE_XPRESS=OFF 

cmake --build build_debug --config Debug --target install -v -j 4

# Build SSC
cd ssc
cmake -S . -B build -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DSAM_SKIP_TOOLS=1

Then the .sln file can be used in Visual Studio

Test OR-tools in the Test via the lib_ptes_chp_dispatch_test test.

If downloading OR-Tools binary from their website https://developers.google.com/optimization/install/cpp, then set ORTOOLSDIR to the extracted folder. ORTOOLSDIR should contain the 'lib', 'cmake', 'bin', etc folders.

@qualand
Copy link
Collaborator

qualand commented Oct 3, 2023

@dguittet

We now have or-tools fork which lives here: https://github.com/NREL/or-tools

When using this fork, I was unable to build or-tools using x64 Native Tools Command Prompt for VS 2022 due to a known issue: google/or-tools#3807

Instead I built or-tools with x64 Native Tools Command Prompt for VS 2019 then built SSC using x64 Native Tools Command Prompt for VS 2022. When building SSC, I did NOT need to add -DUSE_XPRESS=ON -DXPRESS_ROOT=${XPRESS_ROOT} to the command; however, I do have XPRESS_ROOT defined as a environment variable.

I was able to run the test using SCIP and Xpress.

dguittet and others added 30 commits January 31, 2024 08:43
Modify index to year 1 index to correctly utilize tou demand function
* fix adjustment factor use for pvwatts

* add failing NonAnnualSummerStart test

* change so test is passing

* update test values for NonAnnualSummerStart
Add json to list of definitely text files
* update battery tests

* update battery test
This reverts commit 91f7e63, reversing
changes made to cd1e8ec.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants