Skip to content

Commit 1cce0ef

Browse files
committed
Release v0.2.1
2 parents 9336ae5 + 499c93c commit 1cce0ef

38 files changed

+5006
-740
lines changed

.gitlab-ci.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
py37:
2+
image: python:3.7
3+
script:
4+
- python setup.py install
5+
- cd tests
6+
- python test_generators.py
7+
8+
#py36:
9+
# image: python:3.6
10+
# script:
11+
# - python setup.py install
12+
# - cd tests
13+
# - python test_generators.py
14+
#
15+
#py35:
16+
# image: python:3.5
17+
# script:
18+
# - python setup.py install
19+
# - cd tests
20+
# - python test_generators.py

README.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ To use **sasoptpy**, you need to have:
3232

3333
### Installation
3434

35-
**sasoptpy** can be installed from [project releases](https://github.com/sassoftware/sasoptpy/releases) page.
35+
**sasoptpy** can be installed using `pip`:
36+
37+
pip install sasoptpy
38+
39+
or using `conda`:
40+
41+
conda install -c sas-institute sasoptpy
42+
43+
Old releases can be found on the GitHub repository: https://github.com/sassoftware/sasoptpy/releases
3644
Download the release and install it using `pip`:
3745

3846
pip install vX.X.X.tar.gz
@@ -47,7 +55,7 @@ Alternatively, use:
4755

4856
## Getting Started
4957

50-
* The source code is currently hosted on Github at https://github.com/sassoftware/sasoptpy
58+
* The source code is currently hosted on GitHub at https://github.com/sassoftware/sasoptpy
5159
* Online documentation is at https://sassoftware.github.io/sasoptpy/
5260
* For the latest release go to https://github.com/sassoftware/sasoptpy/releases/latest
5361

doc/_static/css/sasoptpy.css

+7
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@ table.field-list {
99
border-spacing: 10px;
1010
}
1111

12+
.http-example div[class^='highlight'] {
13+
margin-top: -20px;
14+
}
15+
16+
.row-even td {
17+
background-color: #D9F3BA;
18+
}

doc/api/functions.rst

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Utility Functions
3535
tuple_unpack
3636
union
3737
wrap
38+
utils._evaluate
3839

3940

4041
.. _math-functions:

doc/conf.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import os
2424
import sys
2525
sys.path.insert(0, os.path.abspath('..'))
26+
import matplotlib
2627

2728
# -- General configuration ------------------------------------------------
2829

@@ -34,8 +35,8 @@
3435
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3536
# ones.
3637
extensions = [
37-
'matplotlib.sphinxext.only_directives',
38-
'matplotlib.sphinxext.plot_directive',
38+
#'matplotlib.sphinxext.only_directives',
39+
#'matplotlib.sphinxext.plot_directive',
3940
'sphinx.ext.autodoc',
4041
'sphinx.ext.doctest',
4142
'sphinx.ext.intersphinx',
@@ -47,6 +48,8 @@
4748
'sphinx.ext.imgmath',
4849
'sphinxcontrib.fulltoc',
4950
'numpydoc',
51+
'sphinxcontrib.httpdomain',
52+
'sphinxcontrib.excel_table',
5053
]
5154

5255
# Add any paths that contain templates here, relative to this directory.
@@ -63,17 +66,17 @@
6366

6467
# General information about the project.
6568
project = 'sasoptpy'
66-
copyright = '2017-2018, SAS Institute'
67-
author = 'SAS Institute (Sertalp B. Cay)'
69+
copyright = '2017-2019, SAS Institute'
70+
author = 'Sertalp B. Cay (SAS Institute)'
6871

6972
# The version info for the project you're documenting, acts as replacement for
7073
# |version| and |release|, also used in various other places throughout the
7174
# built documents.
7275
#
7376
# The short X.Y version.
74-
version = '0.2.0'
77+
version = '0.2.1'
7578
# The full version, including alpha/beta/rc tags.
76-
release = '0.2.0'
79+
release = '0.2.1'
7780

7881
# The language for content autogenerated by Sphinx. Refer to documentation
7982
# for a list of supported languages.
@@ -117,7 +120,7 @@
117120
# documentation.
118121
#
119122
html_theme_options = {
120-
"sidebarwidth": "400"
123+
"sidebarwidth": "320"
121124
}
122125

123126
# Add any paths that contain custom static files (such as style sheets) here,

doc/examples.rst

+9
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Viya Examples / Concrete
3232
Decentralization <examples/decentralization.rst>
3333
SAS/OR Blog: Optimal Wedding <examples/optimal_wedding.rst>
3434
SAS/OR Blog: Kidney Exchange <examples/kidney_exchange.rst>
35+
Multiobjective <examples/multiobjective.rst>
3536

3637
Viya Examples / Abstract
3738
------------------------
@@ -50,3 +51,11 @@ SAS (saspy) Examples
5051
:maxdepth: 1
5152

5253
Decentralization <examples/decentralization_saspy.rst>
54+
55+
RESTful API Examples
56+
--------------------
57+
58+
.. toctree::
59+
:maxdepth: 1
60+
61+
Knapsack <examples/knapsack.rst>

doc/examples/knapsack.rst

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
.. _examples/rest_knapsack:
3+
4+
Knapsack
5+
========
6+
7+
Model
8+
-----
9+
10+
.. literalinclude:: ../../examples/rest_knapsack.py
11+
12+
Output
13+
------
14+
15+
.. ipython:: python
16+
:suppress:
17+
18+
import sasoptpy
19+
sasoptpy.reset_globals()
20+
21+
22+
.. ipython:: python
23+
24+
from examples.rest_knapsack import test
25+
test(hostname, port)

doc/examples/multiobjective.rst

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
.. _examples/multiobjective:
3+
4+
Multiobjective
5+
==============
6+
7+
Reference
8+
---------
9+
10+
https://go.documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=ormpug&docsetTarget=ormpug_lsosolver_examples07.htm&locale=en
11+
12+
http://support.sas.com/documentation/onlinedoc/or/ex_code/143/lsoe10.html
13+
14+
15+
Model
16+
-----
17+
18+
.. literalinclude:: ../../examples/multiobjective.py
19+
20+
Output
21+
------
22+
23+
.. ipython:: python
24+
:suppress:
25+
26+
import sasoptpy
27+
sasoptpy.reset_globals()
28+
29+
.. ipython:: python
30+
31+
from examples.multiobjective import test
32+
sols = test(cas_conn, sols=True)
33+
34+
.. ipython:: python
35+
36+
import matplotlib.pyplot as plt
37+
tr = sols.transpose()
38+
scvalues = tr.iloc[2:]
39+
scvalues = scvalues.astype({0: float, 1: float})
40+
x = sasoptpy.get_obj_by_name('x')
41+
f1 = sasoptpy.get_obj_by_name('f1')
42+
f2 = sasoptpy.get_obj_by_name('f2')
43+
x[1].set_value(scvalues[0])
44+
x[2].set_value(scvalues[1])
45+
scvalues['f1'] = f1.get_value()
46+
scvalues['f2'] = f2.get_value()
47+
f = scvalues.plot.scatter(x='f1', y='f2')
48+
f.set_title('Multiobjective: Plot of Pareto-Optimal Set');
49+
@savefig multiobj.png
50+
f

doc/examples/refinery_optimization.rst

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Output
2525
2626
2727
.. ipython:: python
28+
:okwarning:
2829
2930
from examples.refinery_optimization import test
3031
test(cas_conn)

doc/index.rst

+6-5
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ solve them using
1919

2020
*sasoptpy* can handle linear optimization, mixed integer linear optimization,
2121
and nonlinear optimization problems. Users can benefit from native Python
22-
structures like dictionaries, tuples, and list to define an optimization
22+
structures like dictionaries, tuples, and lists to define an optimization
2323
problem. *sasoptpy* supports `Pandas <http://pandas.pydata.org/>`_
2424
objects extensively.
2525

26-
Under the hood, *sasoptpy* uses
27-
`swat package <https://sassoftware.github.io/python-swat/>`_ to communicate
28-
SAS Viya, and uses
29-
`saspy package <https://sassoftware.github.io/saspy/>`_ to communicate SAS 9.4
26+
Under the hood, *sasoptpy* uses the
27+
`swat package <https://sassoftware.github.io/python-swat/>`_ to communicate with
28+
SAS Viya, and uses the
29+
`saspy package <https://sassoftware.github.io/saspy/>`_ to communicate with SAS 9.4
3030
installations.
3131

3232
*sasoptpy* is an interface to SAS Optimization solvers. Check
@@ -51,4 +51,5 @@ See our SAS Global Forum paper: `Optimization Modeling with Python and SAS Viya
5151
workflow
5252
examples
5353
api/api
54+
web-api
5455

doc/input-data.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ CASTable
145145
~~~~~~~~
146146

147147
When a data is available on the server-side, a reference to the object can be
148-
passed. Note that, using CASTable and Abstract Data requires SAS Viya version
148+
passed. Note that, using :class:`swat.cas.table.CASTable`
149+
and Abstract Data requires SAS Viya version
149150
3.4.
150151

151152
.. ipython:: python

doc/install.rst

+11-76
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,22 @@ It depends on the following packages:
1818
* swat
1919
* pandas
2020

21-
Getting swat
22-
------------
23-
24-
`swat <https://github.com/sassoftware/python-swat>`_ package is a requirement
25-
to use SAS Viya solvers.
26-
27-
swat releases are listed at
28-
`<https://github.com/sassoftware/python-swat/releases>`_.
29-
After downloading the platform-specific release file, it can be installed using
30-
pip::
31-
32-
pip install python-swat-X.X.X-platform.tar.gz
33-
34-
Getting saspy
35-
-------------
21+
Getting sasoptpy
22+
----------------
3623

37-
`saspy <https://github.com/sassoftware/saspy>`_ package is a requirement to use
38-
SAS 9.4 solvers.
24+
*sasoptpy* can be installed using `pip` or `conda`::
3925

40-
saspy releases are listed at
41-
`<https://github.com/sassoftware/saspy/releases>`_.
42-
The easiest way to download the latest stable version of saspy is to use::
26+
pip install sasoptpy
4327

44-
pip install saspy
28+
conda install -c sas-institute sasoptpy
4529

46-
47-
Getting sasoptpy
48-
----------------
30+
Any dependencies should be installed automatically.
31+
32+
GitHub repository
33+
+++++++++++++++++
4934

50-
The latest available version of *sasoptpy* can be obtained from the online
51-
repository.
52-
Call::
35+
You can also get stable and development versions of *sasoptpy* from the GitHub repository.
36+
To get the latest version, call::
5337

5438
git clone https://github.com/sassoftware/sasoptpy.git
5539

@@ -62,52 +46,3 @@ Alternatively, you can use::
6246
python setup.py install
6347

6448

65-
Step-by-step installation
66-
-------------------------
67-
68-
#. **Installing pandas and numpy**
69-
70-
First, download and install numpy and pandas using pip:
71-
72-
.. code-block:: bash
73-
74-
pip install numpy
75-
pip install pandas
76-
77-
78-
#. **Installing the swat package**
79-
80-
First, check the
81-
`swat release page <https://github.com/sassoftware/python-swat/releases>`_
82-
to find the latest release of the SAS-SWAT package for your environment.
83-
84-
Then install it using
85-
86-
.. code-block:: bash
87-
88-
pip install python-swat-X.X.X.platform.tar.gz
89-
90-
As an example, run
91-
92-
.. code-block:: bash
93-
94-
wget https://github.com/sassoftware/python-swat/releases/download/v1.2.1/python-swat-1.2.1-linux64.tar.gz
95-
pip install python-swat-1.2.1-linux64.tar.gz
96-
97-
to install the version 1.2.1 of the swat package for 64-bit Linux
98-
environments.
99-
100-
#. **Installing sasoptpy**
101-
102-
Finally you can install *sasoptpy* by downloading the latest archive file
103-
and install via pip.
104-
105-
.. code-block:: bash
106-
107-
wget *url-to-sasoptpy.tar.gz*
108-
pip install sasoptpy.tar.gz
109-
110-
Latest release file is available at
111-
`Github releases <https://github.com/sassoftware/sasoptpy/releases/latest>`_
112-
page.
113-

0 commit comments

Comments
 (0)