Skip to content

Commit

Permalink
Clean up unstable tests (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbowly authored Dec 4, 2023
1 parent a700b7b commit 8ead181
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 22 deletions.
22 changes: 0 additions & 22 deletions docs/source/mods/portfolio.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ from this DataFrame:
...
Model has 55 quadratic objective terms
...
Presolved: 1 rows, 10 columns, 10 nonzeros
...

Solution
--------
Expand Down Expand Up @@ -241,14 +239,10 @@ the following example, which mimics a single-factor model:
...
Model has 6 quadratic objective terms
...
Presolved: 1 rows, 3 columns, 3 nonzeros
...
Optimize a model with 30 rows, 32 columns and 67 nonzeros
...
Model has 4 quadratic objective terms
...
Presolved: 2 rows, 4 columns, 6 nonzeros
...

The two computed portfolios are the same, up to numerical noise.

Expand Down Expand Up @@ -301,8 +295,6 @@ portfolio value (130-30 strategy), you can do:
...
Model has 55 quadratic objective terms
...
Presolved: 62 rows, 70 columns, 160 nonzeros
...

By incorporating leverage, we now obtain an optimal portfolio with three short
positions, totaling about 14% of assets:
Expand Down Expand Up @@ -356,8 +348,6 @@ optimal portfolio :math:`x`, you can use the keyword parameters ``fees_buy``
...
Model has 55 quadratic objective terms
...
Presolved: 26 rows, 25 columns, 65 nonzeros
...

Transaction fees can be provided either as a constant fee, applying the
same amount uniformly to all assets, or as numpy array or pandas Series
Expand Down Expand Up @@ -413,8 +403,6 @@ trades) keyword parameters as follows:
...
Model has 55 quadratic objective terms
...
Presolved: 1 rows, 10 columns, 10 nonzeros
...

Transaction costs can be provided either as a constant value, applying
the same cost uniformly to all assets, or as a numpy array or pandas Series,
Expand Down Expand Up @@ -470,14 +458,10 @@ allocated to each trade:
...
Model has 55 quadratic objective terms
...
Presolved: 62 rows, 70 columns, 160 nonzeros
...
Optimize a model with 102 rows, 91 columns and 240 nonzeros
...
Model has 55 quadratic objective terms
...
Presolved: 82 rows, 70 columns, 210 nonzeros
...

Comparing the two portfolios ``x_plain``, which has no minimum position
constraints set with ``x_minpos``, which defines these constraints, we see that
Expand Down Expand Up @@ -531,8 +515,6 @@ total number of open positions to three can be achieved as follows:
...
Model has 55 quadratic objective terms
...
Presolved: 27 rows, 25 columns, 65 nonzeros
...

The returned solution now suggests to trade only the assets "AA", "DD", and "HH".

Expand Down Expand Up @@ -595,8 +577,6 @@ the risk-free return rate is 0.25%:
...
Model has 55 quadratic objective terms
...
Presolved: 1 rows, 11 columns, 11 nonzeros
...

If a risk-free return rate has been specified, the returned
:class:`~gurobi_optimods.portfolio.PortfolioResult` instance's ``x_rf``
Expand Down Expand Up @@ -682,8 +662,6 @@ using at most two trades:
...
Model has 55 quadratic objective terms
...
Presolved: 37 rows, 43 columns, 125 nonzeros
...

.. doctest:: mod
:options: +NORMALIZE_WHITESPACE
Expand Down
1 change: 1 addition & 0 deletions tests/opf/test_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def test_ivopf(self):
self.assertLess(abs(solution["branch"][4]["Qt"] + 18.431373), 1e1)


@unittest.skip("varies between versions")
class TestFingerprints(unittest.TestCase):
# Check model fingerprints for some specific cases. Useful while
# refactoring the code, but
Expand Down
1 change: 1 addition & 0 deletions tests/opf/test_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ def test_ac_relax(self):
)


@unittest.skip("unstable")
class TestAPIBranchSwitching(unittest.TestCase):
def setUp(self):
# Modification of case9 where branch switching has an effect
Expand Down

0 comments on commit 8ead181

Please sign in to comment.