Skip to content

Fixing typos in scip.pyx file #1

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
wants to merge 160 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
77a5e9a
adds Benders' decomposition plugin interface functions
Apr 9, 2018
e487d9f
Merge branch 'master' into benders-plugin
Apr 19, 2018
822282a
fix parameter list of consenfolp
mattmilten Apr 24, 2018
3eb1aea
fix error in conshdlr implementation
mattmilten Apr 24, 2018
910beeb
increase version to 1.4.5
mattmilten Apr 24, 2018
82f236a
improve support cutting planes
fserra May 4, 2018
6a91655
code review changes
fserra May 4, 2018
8958b81
close #158 consistent number check in expr.pxi
AntoinePrv May 4, 2018
1647931
Merge pull request #160 from AntoinePrv/fix_158
fserra May 4, 2018
f21febb
Merge pull request #159 from SCIP-Interfaces/fs/more_support_for_sepa…
mattmilten May 6, 2018
833cdb4
increase version to 1.4.6
mattmilten May 7, 2018
474ed5c
add quickmul method (in-place Expr multiplication)
ramabile May 16, 2018
42b9973
correct typo in parameter list
mattmilten May 18, 2018
6a1b40c
add README as long description
mattmilten May 22, 2018
ad5dce4
Merge remote-tracking branch 'upstream/master'
May 24, 2018
c1e2990
Merge branch 'benders-plugin' into sm/benders
May 24, 2018
48da981
Merge pull request #163 from stephenjmaher/master
mattmilten May 24, 2018
a89f93d
updating Benders' interface
May 24, 2018
6ebe08c
adding Benders example
May 24, 2018
11f69f9
Merge branch 'master' of github.com:SCIP-Interfaces/PySCIPOpt
May 24, 2018
732c8c8
add SCIP_LOCKTYPE to includeCondhdlr
May 24, 2018
9b6d9df
Merge branch 'sm/build-with-scip6.0' into sm/benders
May 24, 2018
7983209
working Benders interface
May 24, 2018
f170e49
working Benders' example
May 24, 2018
2596558
AND and OR constraints
ramabile May 28, 2018
4719706
Merge branch 'master' of https://github.com/SCIP-Interfaces/PySCIPOpt
ramabile May 28, 2018
1769f72
test quickmul method
ramabile May 28, 2018
8bfbe01
AND and OR constraints: bugfix, tests, cosmetics
ramabile May 29, 2018
f1ee10b
bugfix
ramabile May 29, 2018
34ae608
python3 compliant
ramabile May 29, 2018
230817d
fix memory leak
fserra May 29, 2018
5d77158
Merge pull request #166 from SCIP-Interfaces/fs/fix-leak
mattmilten May 29, 2018
79115e0
increase version to 1.4.8
mattmilten May 29, 2018
85c7bce
quickmul -> quickprod
ramabile May 29, 2018
1ff4402
AND and OR constraints: tests; .gitignore: .pytest
ramabile May 29, 2018
da5bad4
.pytest_cache deleted
ramabile May 29, 2018
7f372cf
python3 compliant
ramabile May 29, 2018
75be318
bugfix
ramabile May 29, 2018
1461604
Merge pull request #165 from ramabile/master
mattmilten May 29, 2018
5baa5f8
increase version to 1.4.9
mattmilten May 29, 2018
f60e4f2
disable codecov and allow PyPI deploy to skip files
mattmilten May 30, 2018
0ea4b46
testing info + typo
ramabile Jun 4, 2018
caf52a6
docufix
ramabile Jun 4, 2018
ab0e576
Merge pull request #169 from ramabile/patch-1
mattmilten Jun 4, 2018
7a2c580
add CONTRIBUTING guidelines
mattmilten Jun 4, 2018
5132091
some whitespace improvements
mattmilten Jun 4, 2018
598efd6
Update CONTRIBUTING.rst
mattmilten Jun 4, 2018
240a09c
Merge pull request #171 from SCIP-Interfaces/add-contributing
fserra Jun 4, 2018
c965ddb
XOR constraint
ramabile Jun 2, 2018
4afa388
Merge https://github.com/SCIP-Interfaces/PySCIPOpt
ramabile Jun 5, 2018
441cf00
example: integer parity
ramabile Jun 5, 2018
710f496
AND/OR/XOR constraints: examples
ramabile Jun 5, 2018
9665b2e
clarifications, cosmetics
ramabile Jun 6, 2018
c317270
Merge pull request #173 from ramabile/master
fserra Jun 8, 2018
075f23d
test with SCIP-600 release candidate
mattmilten Jun 18, 2018
188dace
make env vars global
mattmilten Jun 18, 2018
752d850
specify output name of rc archive
mattmilten Jun 18, 2018
419843c
add new parameter locktype to conshdlr tests
mattmilten Jun 18, 2018
7229739
Merge branch 'master' into sm/build-with-scip6.0
mattmilten Jun 18, 2018
85f3198
clean up test_logical according to pep8 format
mattmilten Jun 18, 2018
f78a12b
add pep8 note
ramabile Jun 18, 2018
bd27e4f
Merge pull request #180 from ramabile/patch-2
mattmilten Jun 19, 2018
631e688
String conversion in setStringParam()
gasse Apr 25, 2018
4cd9e3b
Merge pull request #181 from ds4dm/maxime
fserra Jun 19, 2018
2767aea
relax asserts in nonlinear test
mattmilten Jun 20, 2018
515b6b2
adds comparison functions
Jun 21, 2018
8aa6c46
fix for Benders' decomposition
Jun 21, 2018
96deee2
Merge branch 'master' into pre6.0
Jun 21, 2018
6dc1545
adds Benders' decomposition test
Jun 21, 2018
dcea622
updates Benders' decomposition test
Jun 21, 2018
79075d5
Merge branch 'pre6.0' into sm/build-with-scip6.0
Jun 21, 2018
e82af2f
Appveyor rc ci (#187)
mattmilten Jun 27, 2018
14bb392
clean up appveyor script
mattmilten Jun 27, 2018
1748db7
use latest release candidate for CI tests
mattmilten Jun 27, 2018
82422bb
CONTRIBUTING improvement
ramabile Jun 30, 2018
687c81a
use public download and nice cmake commands
mattmilten Jul 3, 2018
5b1e461
use public download in appveyor CI
mattmilten Jul 3, 2018
80f6bc4
fix typo in appveyor yaml
mattmilten Jul 3, 2018
7dff203
Merge pull request #182 from SCIP-Interfaces/sm/build-with-scip6.0
mattmilten Jul 3, 2018
66ce12e
update recommended/required SCIP version to 6.0.0
mattmilten Jul 3, 2018
4108e90
increase version to 2.0.0
mattmilten Jul 3, 2018
51387b3
use correct output file name in writeProblem()
mattmilten Jul 4, 2018
cee51c5
Merge pull request #191 from SCIP-Interfaces/fix-writeProblem
mattmilten Jul 4, 2018
bb2da7d
cosmetics
ramabile Jul 6, 2018
ed64699
fix markowitz example
fserra Jul 8, 2018
fea0fe8
add methods for probing and diving
fserra Jun 14, 2018
14a8348
add missing comment
fserra Jul 20, 2018
2c68679
Merge pull request #193 from SCIP-Interfaces/fs/diving-probing
mattmilten Jul 20, 2018
9b5b51b
perform automatic parameter value conversion in setParam
mattmilten Jul 20, 2018
643fe83
Merge pull request #195 from SCIP-Interfaces/user-friendly-setParam
fserra Jul 20, 2018
512a1af
Merge pull request #189 from ramabile/patch-3
mattmilten Jul 20, 2018
1f7fd5d
Update CONTRIBUTING.rst
mattmilten Jul 20, 2018
1facb3e
Update CONTRIBUTING.rst
mattmilten Jul 20, 2018
d882fa7
Revert "Update CONTRIBUTING.rst"
mattmilten Jul 20, 2018
d446b3d
add VSCode directory to gitignore
mattmilten Jul 20, 2018
92d62ff
adds BendersDecomp class and update lower bound function
Jul 27, 2018
997fed4
changes scipbenders to benders
Jul 30, 2018
ae3f4e0
moves update Benders lower bounds to Model
Jul 30, 2018
b6ed098
fix for PEP8 style
Jul 30, 2018
e5d803a
add section about common installation errors
mattmilten Aug 2, 2018
6455b86
Add function to redirect SCIP output via Python
Aug 13, 2018
be64b46
Properly decode byte objects
Aug 15, 2018
6f5c786
Replaced print by more generic functions
Aug 15, 2018
94e3135
Merge pull request #199 from stan227/redirectOutput
mattmilten Aug 15, 2018
ee400c6
increase version to 2.0.1
mattmilten Aug 15, 2018
435eb3a
Merge pull request #196 from SCIP-Interfaces/sm/benders-updates
fserra Aug 21, 2018
045ae56
travis: try deb package on ubuntu xenial
mattmilten Aug 24, 2018
41c50b6
install blas, lapack and gfortran
mattmilten Aug 24, 2018
9001a4f
clean up travis
mattmilten Aug 24, 2018
eb8fe68
Merge pull request #202 from SCIP-Interfaces/travis-xenial
fserra Aug 24, 2018
d844d3a
compute activity before comparison with lhs/rhs for correct dualsols
mattmilten Sep 11, 2018
1f15691
use SCIP internal method for next release
mattmilten Sep 11, 2018
5b2a21b
Merge pull request #204 from SCIP-Interfaces/fix-dualsols
fserra Sep 11, 2018
99a6887
extend note in README about dual values
mattmilten Oct 1, 2018
b6e1718
different additions
roessig Oct 18, 2018
f74aa9e
tighten returns also infeasible, documentation
roessig Oct 19, 2018
8344252
Test for variable methods
roessig Oct 19, 2018
f96c4e4
test branching and chgVarLbGlobal
roessig Oct 19, 2018
a99c9ee
extended event test
roessig Oct 19, 2018
b68281b
allow constants in setObjective, esp. 0 to clear it
mattmilten Oct 19, 2018
f4d95ce
Merge pull request #209 from SCIP-Interfaces/allow-0-obj
fserra Oct 19, 2018
c0344a7
added functions for relaxing rows and fix vars
roessig Oct 28, 2018
a2bdb29
test to reduce priority of trivial heuristic
roessig Oct 29, 2018
639a6f4
new test without quadratic
roessig Oct 29, 2018
b68b472
new test without quadratic
roessig Oct 29, 2018
20edb27
back to old status
roessig Oct 29, 2018
75099e8
new test added
roessig Oct 29, 2018
124cee7
added getLPBranchcand
roessig Oct 29, 2018
3f5d637
test without rootiterlimit
roessig Oct 29, 2018
6f82eca
Updated docu, removed delObjective
roessig Oct 30, 2018
e001bd8
debug output removed in test
mattmilten Oct 30, 2018
a8c750c
update .gitignore
ramabile Oct 31, 2018
453482a
clearer assertions, cosmetics
ramabile Oct 31, 2018
bdf0c2d
.gitignore typo
ramabile Oct 31, 2018
f3bb093
Update src/pyscipopt/scip.pyx
mattmilten Oct 31, 2018
16dae9a
cosmetics
ramabile Oct 31, 2018
5d4c2a8
Merge pull request #210 from ramabile/master
mattmilten Oct 31, 2018
b243b43
Merge pull request #208 from roessig/squash2
mattmilten Oct 31, 2018
659ebb7
cosmetic fix
ramabile Nov 1, 2018
b3c95f0
upgrade to general expression only when necessary
fserra Nov 1, 2018
c400e9f
examples: cleaner and tutorials (#211)
ramabile Nov 2, 2018
3861be7
fix ZeroDivisionError (#215)
ramabile Nov 2, 2018
76268de
Merge pull request #214 from SCIP-Interfaces/213-make-expr-when-divid…
ramabile Nov 2, 2018
10c88f6
increase version to 2.0.2
mattmilten Nov 4, 2018
1be1239
fix lotisizing_lazy example
fserra Nov 11, 2018
d84ff4b
fix set/get char param
fserra Nov 12, 2018
2d93159
Merge pull request #220 from SCIP-Interfaces/fs/fix-char-params
mattmilten Nov 12, 2018
acdbee7
Bugfix: setObjLimit -> getObjLimit typo
gasse Nov 15, 2018
3631c14
Merge pull request #221 from ds4dm/gasse-patch-1
mattmilten Nov 15, 2018
38c565c
update networkx call to get connected components
mattmilten Nov 22, 2018
0a07f17
fix new connected components test
mattmilten Nov 22, 2018
069912a
enlarge time limit in tests
mattmilten Nov 22, 2018
aefb90c
Merge pull request #223 from SCIP-Interfaces/222-update-networkx-conn…
mattmilten Nov 23, 2018
9326fce
conslock changed
fserra Nov 28, 2018
d933675
Merge pull request #224 from SCIP-Interfaces/fs/fix-litsizing_lazy
mattmilten Nov 28, 2018
b03a2ca
add more methods for branching
mattmilten Dec 2, 2018
710e014
fix typo
mattmilten Dec 2, 2018
44d0faf
Merge pull request #226 from SCIP-Interfaces/more-createChild-methods
mattmilten Dec 3, 2018
f73d812
version 2.1.0 and explain versioning in CONTRIBUTING
mattmilten Dec 3, 2018
040e5d8
Update scip.pyx
andynuaa Apr 4, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,14 @@ venv.bak/

# mypy
.mypy_cache/

# pytest
.pytest_cache/

# model (for tests)
model
model.cip
model.lp

# VSCode
.vscode/
39 changes: 23 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
os: linux
dist: xenial
sudo: true

language: python

python:
- '2.7'
- '3.6'
- 2.7
- 3.5
- 3.6
- 3.7

env:
global:
- secure: "CML6W6GUTFcZxZavt2x9vT3pUeg9jA2tber8Wl+34zBI9QxXel8PxKlw896OI2jnGPMvL7ANRElklE6/WNaVvogjgZXKcXnqaGKPoPlJNsGenHw0poxjqrrs9VnuX2XU56h53ESsOZ9mq53oFNaimS6fbtIAs7xlS27nY0KJk42ZEicaS2E9cbzH/XqOIEzdIZCHy8NjViMXFCspE9fhndv04T3ic2opXmGDy2veoZ/oF2zbOcz0e9XLEjTs0yXz5qir8AGEnRS4lwI6hb3jkMBOxbNKIPx63gsno3xUHjXYjiwb4iQV9eybhY0csli/5br8isIX81vlg5xeoEfvSy6sZvZ8rErx3Eos5OdCu4vnxqtMZvpb+2pCVQU2IldZTl9B3/lv4ehZhKurF3l89rnqKW14eh4p2eT6WQ2s0tjPd5NuPdow4hT5x7WWSeS1395exlJJGgv1bt4ASM+KNFfA/4CK4TjszZJ7xLttiJ7nOgo/8KtSd/dM0PfBWeeBQxi/0YgCyD781ieL009ZUPwvKf4B0RJ8pPaSDePypKHvzmcm7UGgT86zz1FnCxsIEmHFJQGazXbdBmi0OvPAo1fCrAdMXipppf+ckAotckWjOLIK6IN9RlrF/E9YFll/SfSiXi6EdB0P+T6m8iBqNEToJbUiRqKhMznr7A4+JLs="
- VERSION=6.0.0

notifications:
email: false

before_install:
- export VERSION=5.0.1
- wget http://scip.zib.de/download/release/scipoptsuite-$VERSION.tgz
- tar xf scipoptsuite-$VERSION.tgz
- cd scipoptsuite-$VERSION
- mkdir build
- cd build; cmake .. -DCMAKE_C_STANDARD=99 -DCMAKE_INSTALL_PREFIX=~/scipdir; make -j8 install; cd ..
- cd ..
- rm -rf scipoptsuite-$VERSION
- sudo apt-get install libblas-dev liblapack-dev gfortran
- export VERSION=6.0.0
- wget http://scip.zib.de/download/release/SCIPOptSuite-$VERSION-Linux.deb
- sudo dpkg -i SCIPOptSuite-$VERSION-Linux.deb

install:
- pip install cython networkx pytest-cov codecov
- # SCIPOPTDIR=~/scipdir python setup.py build_ext --inplace --define CYTHON_TRACE
- SCIPOPTDIR=~/scipdir python setup.py install
- pip install cython networkx pytest-cov
- python setup.py install

script: py.test --cov
script: py.test #--cov

after_success:
- codecov
# after_success:
# - codecov

deploy:
provider: pypi
Expand All @@ -34,3 +40,4 @@ deploy:
secure: ePfiLq2vOJC4O5zYFChHk5wa+quza+m/lsCGPfKXBVpIyb7TvzTHaFDBYtYVZK7710LIKRIcHxvmJPELyKeK1l9QyLxi1x/jOHwk0VbKpf3f5fJjjPaYfXgAUKMMeUplrdhvzU6cgUMrsGhlUE1EIHxc97x5xOa2xlv3lis3j5yjdFUbP6e7MBCEb6c8yU88CclPU2BeHDATzOtMZp0dsyzFTjP9DI7fWbEvOfGy66e5uB/Cjk07mguBZVAUFoukkwKD0KUgBB7RlrAdE61uFVHG8nE5q+G9SZIhQcwULxPLz4v18osJf1aea0g/grZnnrgdG5F24rCA6dSBlvUhnA6aDJXDSgd/dCJ7FV/w3okwhsn18esnycBeM+i3O1pleHsmkq+yFCf2wTbZlm68Hxu+WSirKjie5AtzlSOHa82jQkTjkZI1AHE2syiShnWGvaWpPtoecJKr7aHdFylbJpKwyGvptsObRerWJH5GARXnOoH+FVJ4LrAKcahwCdx0CB63HU2s5p4JgYqAlQV+hFD6yfTDvcKO97/u+8BKlLe9Jnq+fSefEJW1ndOi4mJQ4xGG93sOCub13UCo6zGLvnFlO7R7vwHJeSMDL9Z0Jqmpo2sLhKmaYMr6PhyWvWpXauZOmLTaJEutcnJZ2cjXTU2VuULWwhNYzgXLu9rnVB0=
on:
tags: true
skip_existing: true
52 changes: 52 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Contributing to PySCIPOpt
=========================

Code contributions are very welcome and should comply to a few rules:

0. Read `Design principles of PySCIPOpt`_.

1. Compatibility with both Python-2 and Python-3.

2. All tests defined in the Continuous Integration setup need to pass:

- `.travis.yml <.travis.yml>`__
- `appveyor.yml <appveyor.yml>`__

3. New features should be covered by tests *and* examples. Please extend `tests <tests>`__ and `examples <examples>`__. Tests uses pytest and examples are meant to be accessible for PySCIPOpt newcomers (even advanced examples).

4. New code should be documented in the same style as the rest of the code.

5. New code should be `pep8-compliant <https://www.python.org/dev/peps/pep-0008/>`__. Help yourself with the `style guide checker <https://pypi.org/project/pep8/>`__.

6. Before implementing a new PySCIPOpt feature, check whether the feature exists in SCIP. If so, implement it as a pure wrapper, mimicking SCIP whenever possible. If the new feature does not exist in SCIP but it is close to an existing one, consider if implementing that way is substantially convenient (e.g. Pythonic). If it does something completely different, you are welcome to pull your request and discuss the implementation.

7. PySCIPOpt uses `semantic versioning <https://semver.org/>`__. Version number increase only happens on master and must be tagged to build a new PyPI release.

For general reference, we suggest:

- `PySCIPOpt README <README.rst>`__;
- `SCIP documentation <http://scip.zib.de/doc/html/>`__;
- `SCIP mailing list <https://listserv.zib.de/mailman/listinfo/scip/>`__ which can be easily searched with search engines (e.g. `Google <http://www.google.com/#q=site:listserv.zib.de%2Fpipermail%2Fscip>`__);
- `open and closed PySCIPOpt issues <https://github.com/SCIP-Interfaces/PySCIPOpt/issues?utf8=%E2%9C%93&q=is%3Aissue>`__;
- `SCIP/PySCIPOpt Stack Exchange <https://stackoverflow.com/questions/tagged/scip>`__.

If you find this contributing guide unclear, please open an issue! :)

Design principles of PySCIPOpt
==============================

PySCIPOpt is meant to be a fast-prototyping interface of the pure SCIP C API. By design, we distinguish different functions in PySCIPOPT:

- pure wrapping functions of SCIP;
- convenience functions.

**PySCIPOpt wrappers of SCIP functions** should act:

- with an expected behavior - and parameters, returns, attributes, ... - as close to SCIP as possible
- without *"breaking"* Python and the purpose for what the language it is meant.

Ideally speaking, we want every SCIP function to be wrapped in PySCIPOpt.

**Convenience functions** are additional, non-detrimental features meant to help prototyping the Python way. Since these functions are not in SCIP, we wish to limit them to prevent difference in features between SCIP and PySCIPOPT, which are always difficult to maintain. A few convenience functions survive in PySCIPOpt when keeping them is doubtless beneficial.

Admittedly, *there is a middle ground where functions are not completely wrappers or just convenient*. That is the case, for instance, of fundamental :code:`Model` methods like :code:`addCons` or :code:`writeProblem`. We want to leave their development to negotiation.
25 changes: 24 additions & 1 deletion INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ your ``PATH`` environment variable:

On Linux and OS X this is encoded in the generated PySCIPOpt library and therefore not necessary.

Building everything form source
Building everything from source
===============================

PySCIPOpt requires `Cython <http://cython.org/>`__, at least version 0.21 (``pip install cython``).
Expand Down Expand Up @@ -76,3 +76,26 @@ To use debug information in PySCIPOpt you need to build it like this:

Be aware that you will need the **debug library** of the SCIP Optimization
Suite for this to work (``cmake .. -DCMAKE_BUILD_TYPE=Debug``).

Testing new installation
========================

To test your brand-new installation of PySCIPOpt you need `pytest <https://pytest.org/>`__ on your system. Here is the `installation procedure <https://docs.pytest.org/en/latest/getting-started.html>`__.

Tests can be run in the ``PySCIPOpt`` directory with:
::

py.test # all the available tests
py.test tests/test_name.py # a specific tests/test_name.py (Unix)

Ideally, the status of your tests must be passed or skipped. Running tests with pytest creates the ``__pycache__`` directory in ``tests`` and, occasionally, a ``model`` file in the working directory. They can be removed harmlessly.

Common errors
=============

- readline: ``libreadline.so.6: undefined symbol: PC``
This is a readline/ncurses compatibility issue that can be fixed like this (when using ``conda``):

::

conda install -c conda-forge readline=6.2
17 changes: 11 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ simple examples.
Please notice that in most cases one needs to use a ``dictionary`` to
specify the return values needed by SCIP.

Extend the interface
====================
Extending the interface
=======================

The interface python-scip already provides many of the SCIP callable
library methods. You may also extend python-scip to increase the
functionality of this interface.The following will provide some
PySCIPOpt already covers many of the SCIP callable
library methods. You may also extend it to increase the
functionality of this interface. The following will provide some
directions on how this can be achieved:

The two most important files in PySCIPOpt are the ``scip.pxd`` and
Expand All @@ -87,6 +87,10 @@ functions in python that reference the SCIP public functions included in
``scip.pxd``. This is achieved by modifying the ``scip.pyx`` file to add
the functionality you require.

We are always happy to accept pull request containing patches or extensions!

Please have a look at our `contribution guidelines <CONTRIBUTING.rst>`__.

Gotchas
=======

Expand Down Expand Up @@ -122,9 +126,10 @@ Dual values
-----------

While PySCIPOpt supports access to the dual values of a solution, there are some limitations involved:

- Can only be used when presolving and propagation is disabled to ensure that the LP solver - which is providing the dual information - actually solves the unmodified problem.
- Heuristics should also be disabled to avoid that the problem is solved before the LP solver is called.
- There should be no bound constraints, i.e., constraints with only one variable. This can cause incorrect values as explained in `#136 <https://github.com/SCIP-Interfaces/PySCIPOpt/issues/136>`__

Therefore, you should use the following settings when trying to work with dual information:

Expand Down
17 changes: 10 additions & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
version: '{build}'

branches:
only:
- master

environment:
SCIPOPTDIR: C:\scipoptdir
password:
pypipw:
secure: HEa8MAJyyfSv33snyK3Gleflk9SIfZBxbnTiS39hlWM=
optipw:
secure: mi/mkS8vYK1Yza0A1FB4/Q==

matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
Expand All @@ -28,7 +26,12 @@ environment:
TWINE: C:\Python36-x64\Scripts\twine

install:
- ps: wget http://scip.zib.de/download/release/SCIPOptSuite-5.0.1-win64-VS15.exe -outfile scipopt-installer.exe
# - ps: $uri = 'http://opti-test.zib.de/v600-rc06/scip/download/release/SCIPOptSuite-6.0.0-win64-VS15.exe'
# - ps: $user = 'opti-test'
# - ps: $pass = $env:optipw | ConvertTo-SecureString -AsPlainText -Force
# - ps: $cred = New-Object Management.Automation.PSCredential ($user, ($pass))
# - ps: Invoke-WebRequest -Uri $uri -Credential $cred -OutFile 'scipopt-installer.exe'
- ps: wget http://scip.zib.de/download/release/SCIPOptSuite-6.0.0-win64-VS15.exe -outfile scipopt-installer.exe
- scipopt-installer.exe /S /D=%SCIPOPTDIR%
- set PATH=%SCIPOPTDIR%\bin;%PYTHON%;%PATH%
- if [%INCLUDE_REQUIRED%]==[true] copy .\VC9-include\* %SCIPOPTDIR%\include
Expand All @@ -46,7 +49,7 @@ artifacts:
after_test:
- cmd: "echo [pypi] > %USERPROFILE%\\.pypirc"
- cmd: "echo username: pyscipopt >> %USERPROFILE%\\.pypirc"
- cmd: "echo password: %password% >> %USERPROFILE%\\.pypirc"
- cmd: "echo password: %pypipw% >> %USERPROFILE%\\.pypirc"
- python setup.py bdist_wheel

on_success:
Expand Down
2 changes: 1 addition & 1 deletion examples/finished/eoq_en.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
eoq.py: piecewise linear model to the multi-item economic ordering quantity problem.
eoq_en.py: piecewise linear model to the multi-item economic ordering quantity problem.

Approach: use a convex combination formulation.

Expand Down
72 changes: 72 additions & 0 deletions examples/finished/even.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
from pyscipopt import Model

################################################################################
#
# EVEN OR ODD?
#
# If a positional argument is given:
# prints if the argument is even/odd/neither
# else:
# prints if a value is even/odd/neither per each value in a example list
#
# This example is made for newcomers and motivated by:
# - modulus is unsupported for pyscipopt.scip.Variable and int
# - variables are non-integer by default
# Based on this:
# https://github.com/SCIP-Interfaces/PySCIPOpt/issues/172#issuecomment-394644046
#
################################################################################

verbose = False
sdic = {0:"even",1:"odd"}

def parity(number):
try:
assert number == int(round(number))
m = Model()
m.hideOutput()

### variables are non-negative by default since 0 is the default lb.
### To allow for negative values, give None as lower bound
### (None means -infinity as lower bound and +infinity as upper bound)
x = m.addVar("x", vtype="I", lb=None, ub=None) #ub=None is default
n = m.addVar("n", vtype="I", lb=None)
s = m.addVar("s", vtype="B")

### CAVEAT: if number is negative, x's lb must be None
### if x is set by default as non-negative and number is negative:
### there is no feasible solution (trivial) but the program
### does not highlight which constraints conflict.
m.addCons(x==number)

m.addCons(s == x-2*n)
m.setObjective(s)
m.optimize()

assert m.getStatus() == "optimal"
if verbose:
for v in m.getVars():
print("%s %d" % (v,m.getVal(v)))
print("%d%%2 == %d?" % (m.getVal(x), m.getVal(s)))
print(m.getVal(s) == m.getVal(x)%2)

xval = m.getVal(x)
sval = m.getVal(s)
sstr = sdic[sval]
print("%d is %s" % (xval, sstr))
except (AssertionError, TypeError):
print("%s is neither even nor odd!" % number.__repr__())

if __name__ == "__main__":
import sys
from ast import literal_eval as leval
example_values = [0, 1, 1.5, "hallo welt", 20, 25, -101, -15., -10, -int(2**31), int(2**31-1), int(2**63)-1]
try:
try:
n = leval(sys.argv[1])
except ValueError:
n = sys.argv[1]
parity(n)
except IndexError:
for n in example_values:
parity(n)
Loading