Skip to content

Commit

Permalink
Merge branch 'network' of github.com:stevedwards/gurobi-optimods into…
Browse files Browse the repository at this point in the history
… network
  • Loading branch information
stevedwards committed May 4, 2023
2 parents 40142b1 + 406d79b commit 367bffb
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/gurobi_optimods/networkdesign.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Implementation of your new mod. This should be copied to
# src/gurobi_optimods/<mod-name>.py. You may alternatively want to include
# your mod in an existing file, if it coexists naturally with other mods.
#
# In general the public API should be a single class or function. Go with
# whatever makes the most sense for this mod.

import gurobipy as gp


def solve_mod(data):
"""
A sphinx-compatible docstring
:param data1: Data structure for first argument
:type data1: pd.DataFrame
"""
with gp.Env() as env, gp.Model(env=env) as model:
# build model
model.optimize()
# post-process and return solution
return
20 changes: 20 additions & 0 deletions tests/test_networkdesign.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Unit tests for your mod. This is separate from the example tests, it should
# test smaller pieces of functionality, and can also test multiple cases.
# This template should be copied to tests/test_<mod-name>.py

import unittest

from gurobi_optimods.datasets import load_mod_example_data
from gurobi_optimods.networkdesign import solve_mod


class TestMod(unittest.TestCase):
def test_datasets(self):
# If you added something to optimods.datasets, test it here
data = load_mod_example_data()
self.assertEqual(set(data.keys()), {"a", "b", "c"})

def test_simple(self):
data = None
solution = solve_mod(data)
self.assertTrue(solution is None)

0 comments on commit 367bffb

Please sign in to comment.