-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa747d4
commit 9bc061f
Showing
39 changed files
with
604 additions
and
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#pydata-sphinx-theme==0.7.1 | ||
ampl-sphinx-theme | ||
sphinx==4.2.0 | ||
sphinx==5.0.0 | ||
myst_parser>=0.17.0 |
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
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
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
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,58 @@ | ||
name: build-and-test | ||
run-name: ${{ github.actor }} is building "${{ github.ref_name }}" | ||
on: [push] | ||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: r-lib/actions/setup-r@v2 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
- run: | | ||
set -ex | ||
python updatelib.py | ||
bash build.sh | ||
mkdir -p upload/{release,doc} | ||
cp rAMPL_*.tar.gz upload/release/ | ||
cp rAMPL_*.tar.gz upload/release/rAMPL.tar.gz | ||
cp -r docs/build/html upload/doc/R | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: drop | ||
path: upload/ | ||
|
||
test: | ||
needs: build | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
bundle: https://portal.ampl.com/dl/amplce/ampl.linux64.tgz | ||
- os: macos-latest | ||
bundle: https://portal.ampl.com/dl/amplce/ampl.macos64.tgz | ||
- os: windows-latest | ||
bundle: https://portal.ampl.com/dl/amplce/ampl.mswin64.zip | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: r-lib/actions/setup-r@v2 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: drop | ||
- name: Copy package | ||
shell: bash | ||
run: cp release/* . | ||
- name: Install Rcpp and testthat | ||
run: bash dependencies.sh | ||
- name: Install package | ||
run: bash install.sh | ||
- name: Install AMPL | ||
run: bash download-ampl.sh ${{ matrix.bundle }} | ||
- name: Test package | ||
shell: bash | ||
run: SKIP_BIG_TESTS=1 PATH="`pwd`/ampl:$PATH" bash test.sh 2>&1 |
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,17 @@ | ||
# Read the Docs configuration file for Sphinx projects | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
version: 2 | ||
|
||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.11" | ||
|
||
# Build documentation in the "docs/" directory with Sphinx | ||
sphinx: | ||
configuration: docs/source/conf.py | ||
|
||
python: | ||
install: | ||
- requirements: docs/requirements.txt |
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,15 @@ | ||
Package: rAMPL | ||
Title: AMPL API for R | ||
Version: 2.0.12.0-20230210 | ||
Author: Filipe Brandao | ||
Maintainer: Filipe Brandão <[email protected]> | ||
Description: AMPL API for R. | ||
Depends: R (>= 3.2.3) | ||
License: BSD-3 | ||
Encoding: UTF-8 | ||
LinkingTo: Rcpp | ||
Imports: Rcpp | ||
RoxygenNote: 6.0.1 | ||
Suggests: testthat | ||
NeedsCompilation: yes | ||
Packaged: 2024-09-29 17:36:23 UTC; lentz |
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,29 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2020, AMPL Optimization inc. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,4 @@ | ||
useDynLib(rAMPL) | ||
exportPattern("^[^\\.]") | ||
import(Rcpp) | ||
|
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 @@ | ||
### rAMPL | ||
|
||
[![Build Status](https://dev.azure.com/ampldev/rAMPL/_apis/build/status/ampl.rAMPL?branchName=master)](https://dev.azure.com/ampldev/rAMPL/_build/latest?definitionId=10&branchName=master) [![build-and-test](https://github.com/ampl/rAMPL/actions/workflows/build-and-test.yaml/badge.svg)](https://github.com/ampl/rAMPL/actions/workflows/build-and-test.yaml) | ||
|
||
AMPL API is an interface that allows developers to access the features of the | ||
AMPL interpreter from within a programming language. All model generation and | ||
solver interaction is handled directly by AMPL, which leads to great stability | ||
and speed; the library just acts as an intermediary, and the added overhead | ||
(in terms of memory and CPU usage) depends mostly on how much data is read | ||
back from AMPL, the size of the model as such is irrelevant. Functions for | ||
directly assigning data to AMPL parameters and sets are provided, which can | ||
be used instead of the normal AMPL data reading procedures. AMPL API has been | ||
written with usability in mind, and it is easy to access its functionalities | ||
from C++, Java, C#, MATLAB, Python, and R. | ||
|
||
The AMPL API can function as an add-on to any existing AMPL installation. If | ||
you do not yet have an AMPL installation on the computer where you will be | ||
working with the API. Use our [Community Edition](http://ampl.com/ce) | ||
to download a working version that can be installed quickly. | ||
|
||
#### Documentation | ||
|
||
- http://rAMPL.readthedocs.io | ||
|
||
#### Setup | ||
|
||
In order to install the latest version of the R API you just need to run: | ||
``` | ||
> install.packages("Rcpp", type="source") | ||
> install.packages("https://ampl.com/dl/API/rAMPL.tar.gz", repos=NULL) | ||
``` | ||
|
||
Note: this package requires R development tools on Windows and macOS, which can be installed as follows: | ||
* Windows: https://cran.r-project.org/bin/windows/Rtools/ | ||
* macOS: https://cran.r-project.org/bin/macosx/tools/ | ||
* On Linux, this package requires a C++ compiler such as g++. | ||
|
||
Alternatively, you can download, build, and install the package locally: | ||
``` | ||
$ git clone [email protected]:ampl/rAMPL.git | ||
$ cd rAMPL | ||
$ python updatelib.py | ||
$ cd .. | ||
$ R CMD build rAMPL | ||
$ R CMD INSTALL rAMPL_<version>.tar.gz | ||
``` | ||
|
||
#### License | ||
|
||
BSD-3 | ||
|
||
*** | ||
Copyright © 2023 AMPL Optimization inc. All rights reserved. |
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,97 @@ | ||
variables: | ||
BUNDLES_URL: 'https://portal.ampl.com/dl/amplce/' | ||
LINUX32_BUNDLE_NAME: 'ampl.linux32.tgz' | ||
LINUX64_BUNDLE_NAME: 'ampl.linux64.tgz' | ||
MACOS64_BUNDLE_NAME: 'ampl.macos64.tgz' | ||
MSWIN64_BUNDLE_NAME: 'ampl.mswin64.zip' | ||
|
||
stages: | ||
- stage: build | ||
displayName: 'Build' | ||
jobs: | ||
- job: macos | ||
pool: {vmImage: 'macos-latest'} | ||
steps: | ||
- task: UsePythonVersion@0 | ||
- bash: | | ||
set -ex | ||
python updatelib.py | ||
bash build.sh | ||
mkdir -p upload/{macos,release,doc} | ||
cp rAMPL_*.tar.gz upload/macos/ | ||
cp rAMPL_*.tar.gz upload/release/ | ||
cp rAMPL_*.tar.gz upload/release/rAMPL.tar.gz | ||
cp -r docs/build/html upload/doc/R | ||
displayName: Build package | ||
- task: PublishBuildArtifacts@1 | ||
inputs: {artifactName: 'drop', pathtoPublish: 'upload'} | ||
|
||
- stage: test | ||
displayName: 'Test' | ||
dependsOn: build | ||
jobs: | ||
- job: linux | ||
pool: {vmImage: 'Ubuntu-20.04'} | ||
variables: {AMPL_URL: '$(BUNDLES_URL)/$(LINUX64_BUNDLE_NAME)'} | ||
steps: | ||
- task: DownloadBuildArtifacts@0 | ||
inputs: {artifactName: 'drop', downloadPath: '.'} | ||
- bash: cp drop/release/* . | ||
displayName: Copy package | ||
- bash: sudo bash dependencies.sh | ||
displayName: Install Rcpp and testthat | ||
- bash: sudo bash install.sh | ||
displayName: Install package | ||
- bash: bash download-ampl.sh $AMPL_URL | ||
displayName: Install AMPL | ||
- bash: sudo SKIP_BIG_TESTS=1 PATH="`pwd`/ampl:$PATH" bash test.sh | ||
displayName: Test package | ||
- job: macos | ||
pool: {vmImage: 'macos-latest'} | ||
variables: {AMPL_URL: '$(BUNDLES_URL)/$(MACOS64_BUNDLE_NAME)'} | ||
steps: | ||
- task: DownloadBuildArtifacts@0 | ||
inputs: {artifactName: 'drop', downloadPath: '.'} | ||
- bash: cp drop/release/* . | ||
displayName: Copy package | ||
- bash: bash dependencies.sh | ||
displayName: Install Rcpp and testthat | ||
- bash: bash install.sh | ||
displayName: Install package | ||
- bash: bash download-ampl.sh $AMPL_URL | ||
displayName: Install AMPL | ||
- bash: SKIP_BIG_TESTS=1 PATH="`pwd`/ampl:$PATH" bash test.sh | ||
displayName: Test package | ||
# - job: windows | ||
# pool: {vmImage: 'windows-2022'} | ||
# variables: {AMPL_URL: '$(BUNDLES_URL)/$(MSWIN64_BUNDLE_NAME)'} | ||
# steps: | ||
# - task: DownloadBuildArtifacts@0 | ||
# inputs: {artifactName: 'drop', downloadPath: '.'} | ||
# - bash: cp drop/release/* . | ||
# displayName: Copy package | ||
# # - bash: | | ||
# # # Debug the following issue on azure pipelines: | ||
# # # "C:/rtools40/mingw64/bin/"g++ -std=gnu++11 -shared -static-libgcc -o rAMPL.dll tmp.def RcppExports.o rampl.o rcon_entity.o rcon_instance.o renvironment.o robj_entity.o robj_instance.o rparam_entity.o rset_entity.o rset_instance.o rvar_entity.o rvar_instance.o utils.o -L../inst/libs/i386 -L../inst/libs/x64 -lampl -LC:/PROGRA~1/R/R-40~1.3/bin/x64 -lR | ||
# # # /usr/bin/sh: line 8: "C:/rtools40/mingw64/bin/"g++ -std=gnu++11 : No such file or directory | ||
# # # no DLL was created | ||
# # set -ex | ||
# # grep " -shared " -R `R RHOME` | ||
# # cat `R RHOME`/etc/x64/Makeconf | ||
# # cat `R RHOME`/etc/i386/Makeconf | ||
# # cat `R RHOME`/share/make/winshlib.mk | ||
# # displayName: Debug azure-pipelines issue | ||
# - bash: | | ||
# set -ex | ||
# cat `R RHOME`/share/make/winshlib.mk | ||
# sed -i 's/\$(SHLIB_LD)/c:\/rtools40\/mingw64\/bin\/g++/g' `R RHOME`/share/make/winshlib.mk | ||
# cat `R RHOME`/share/make/winshlib.mk | ||
# displayName: Hack to fix azure-pipelines issue | ||
# - bash: bash dependencies.sh | ||
# displayName: Install Rcpp and testthat | ||
# - bash: bash install.sh | ||
# displayName: Install package | ||
# - bash: bash download-ampl.sh $AMPL_URL | ||
# displayName: Install AMPL | ||
# - bash: SKIP_BIG_TESTS=1 PATH="`pwd`/ampl:$PATH" bash test.sh | ||
# displayName: Test package |
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,25 @@ | ||
#!/bin/bash | ||
cd `dirname $0` | ||
BASEDIR=`pwd` | ||
set -ex | ||
|
||
if [[ "$(python -V)" =~ "Python 3" ]]; then | ||
PYTHON="python" | ||
else | ||
PYTHON="python3" | ||
fi | ||
|
||
cd docs | ||
if [ ! -d "venv" ]; then | ||
$PYTHON -m pip install virtualenv | ||
$PYTHON -m virtualenv venv | ||
source venv/bin/activate | ||
$PYTHON -m pip install -r requirements-dev.txt | ||
deactivate | ||
fi | ||
source venv/bin/activate | ||
make html | ||
deactivate | ||
cd $BASEDIR | ||
rm -rf rAMPL_*.tar.gz | ||
R CMD build . |
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,6 @@ | ||
#!/bin/bash | ||
BASEDIR=`dirname $0` | ||
cd $BASEDIR | ||
set -ex | ||
|
||
R --no-save -q -e "install.packages(c('Rcpp', 'testthat'), repos='http://cran.us.r-project.org', INSTALL_opts=c('--no-multiarch'))" |
Oops, something went wrong.