-
-
Notifications
You must be signed in to change notification settings - Fork 37
[WIP] MATLAB interface #360
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
Open
stefphd
wants to merge
58
commits into
cvanaret:main
Choose a base branch
from
stefphd:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
47929da
Renamed UNO_OPTION_TYPE_INT to UNO_OPTION_TYPE_INTEGER
stefphd 873c2df
Moved stream callbacks to UserModel.hpp
stefphd a4ae849
Added Vector(begin, end) constructor
stefphd c74073a
Added typed option getters
stefphd ce7ece0
Added Matlab MEX interface
stefphd 3bb120a
Create README for Matlab interface
stefphd ff6f04c
Added Matlab example
stefphd c322a01
Fixed missing include
stefphd c79b6bf
Matlab libut not required
stefphd 571f82b
Added explicit sparsity patterns in matlab interface
stefphd ea06c51
Updated matlab example to use explicit sparsity
stefphd d6474ec
Updated matlab README
stefphd 9f1a5b2
Simplified struct to option conversion
stefphd ef5fb87
Added conversion of matlab string to std::string
stefphd 2ade211
Accept matlab string in option preset
stefphd e731182
Merge branch 'main' of https://github.com/cvanaret/Uno
stefphd 28f2af1
Removed redundant callbacks in matlab interface
stefphd f671410
Merge branch 'main' of https://github.com/cvanaret/Uno
stefphd a7cdf6c
Updated matlab with number model evaluations
stefphd 35c8b36
Updated the matlab example
stefphd bdfb559
Added function argument validation
stefphd e364415
Reorganized matlab interface sources
stefphd e5c888c
Link matlab interface to uno default lib
stefphd 568e59b
Validate user callback outputs during optimization
stefphd 577b605
Removed unused functions
stefphd c83e3f5
Update example_hs015.m
stefphd d0b7d8b
Added matlab Polak5 example
stefphd 252f39f
Flip multiplier sign back before eval (data are copied)
stefphd 95bda52
Update example_polak5.m
stefphd fd716f3
Renamed validate_matlab_handle to validate_matlab_handle_field
stefphd 5e516dd
Added high-level Matlab interface
stefphd 0668266
Fixed missing (:) in uno.m
stefphd f333c0b
Fixed typo in Matlab readme
stefphd 26bade9
Added Test Matlab interface workflow
stefphd 7fe875b
Fixed typo in Matlab readme
stefphd 71b1b3d
Exclude auto build of Matlab interface
stefphd 9a4d24d
Try install Matlab files
stefphd f17e229
Added explicit error messages in Uno matlab interface
stefphd d9101e2
Merge branch 'main' of https://github.com/cvanaret/Uno
stefphd 9843722
Fixed unomex_optimize hessian and problem type
stefphd 09e3a74
Clear uno_optimize after calling uno
stefphd 3f5a38a
Merge branch 'main' of https://github.com/cvanaret/Uno
stefphd 799876c
Merged C API with main changes
stefphd cc4329a
unomex_* renamed to uno_
stefphd 16ae619
Added validate_string_field
stefphd eb36f1e
Added missing return
stefphd 88abf78
Updated Matlab examples with new problem_type
stefphd 390bd6b
Link Matlab libut in unomex-options target
stefphd 08bbf4f
Divided C++ classes for Matlab interface into multiple files
stefphd 6f6eca7
Added Matlab test example on MacOS
stefphd 0ddef43
Fixed platform in github workflow
stefphd b0f5d1d
Try adding fortran compiler in macod workflow
stefphd 2842a66
Fixed wrong slash in include
stefphd 1988033
Fixed wrong slash in include (missing)
stefphd 0fc34b5
Merge branch 'main' of https://github.com/cvanaret/Uno
stefphd 49165f3
Updated multiplier sign convention in Materlab interface
stefphd 752601d
compile the Unomex source files once
stefphd 8cce827
Try fix rpath for macos Matlab interface
stefphd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,97 @@ | ||
| name: Test the Matlab interface on the example | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| paths-ignore: | ||
| - '*.md' | ||
| - 'LICENSE' | ||
| - '*.cff' | ||
| pull_request: | ||
| branches: [ "main" ] | ||
| paths-ignore: | ||
| - '*.md' | ||
| - 'LICENSE' | ||
| - '*.cff' | ||
|
|
||
| env: | ||
| BUILD_TYPE: Release | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - os: windows-latest | ||
| addpath: install/bin | ||
| - os: macos-14 | ||
| addpath: install/lib | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up MATLAB | ||
| uses: matlab-actions/setup-matlab@v2 | ||
|
|
||
| - name: Download dependency (BQPD) | ||
| shell: bash | ||
| run: | | ||
| VERSION_BQPD="1.0.0" | ||
| if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | ||
| PLATFORM="x86_64-w64-mingw32" | ||
| choco install wget | ||
| else | ||
| PLATFORM="aarch64-apple-darwin" | ||
| fi | ||
| wget https://github.com/leyffer/BQPD_jll.jl/releases/download/BQPD-v${VERSION_BQPD}%2B0/BQPD.v${VERSION_BQPD}.$PLATFORM-libgfortran5.tar.gz | ||
| mkdir deps | ||
| tar -xzvf BQPD.v${VERSION_BQPD}.$PLATFORM-libgfortran5.tar.gz -C deps | ||
|
|
||
| - name: Add MinGW64 to PATH (Windows) | ||
| if: matrix.os == 'windows-latest' | ||
| run: echo "C:\tools\msys64\mingw64\bin" >> "$GITHUB_PATH" | ||
|
|
||
| - name: Install Fortran compiler (MacOS) | ||
| if: matrix.os != 'windows-latest' | ||
| uses: fortran-lang/setup-fortran@main | ||
| with: | ||
| compiler: 'gcc' | ||
| version: '13' | ||
|
|
||
| - name: Configure CMake | ||
| shell: bash | ||
| run: | | ||
| if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | ||
| cmake -G "MinGW Makefiles" -B "${{github.workspace}}/build" \ | ||
| -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ | ||
| -DBQPD="${{github.workspace}}/deps/lib/libbqpd.a" | ||
| else | ||
| cmake -B "${{github.workspace}}/build" \ | ||
| -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ | ||
| -DBQPD="${{github.workspace}}/deps/lib/libbqpd.a" | ||
| fi | ||
|
|
||
| - name: Build uno | ||
| run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j4 | ||
|
|
||
| - name: Build unomex | ||
| run: cmake --build ${{github.workspace}}/build --target unomex --config ${{env.BUILD_TYPE}} -j4 | ||
|
|
||
| - name: Install unomex | ||
| run: cmake --install ${{github.workspace}}/build --prefix ${{github.workspace}}/install | ||
|
|
||
| - name: Run example (high-level interface) | ||
| uses: matlab-actions/run-command@v2 | ||
| with: | ||
| command: | | ||
| addpath('${{ matrix.addpath }}'); | ||
| run('interfaces/Matlab/example/example_uno.m'); | ||
|
|
||
| - name: Run example (low-level interface) | ||
| uses: matlab-actions/run-command@v2 | ||
| with: | ||
| command: | | ||
| addpath('${{ matrix.addpath }}'); | ||
| run('interfaces/Matlab/example/example_hs015.m'); | ||
|
|
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you've verified this works with a particular matlab version I'd recommend pinning it on that version. There have been several minor changes in the mex behaviour over the past couple of versions that could cause unnecessary heartache.