本文整理汇总了Python中cylp.cy.CyClpSimplex.argWeightedMax方法的典型用法代码示例。如果您正苦于以下问题:Python CyClpSimplex.argWeightedMax方法的具体用法?Python CyClpSimplex.argWeightedMax怎么用?Python CyClpSimplex.argWeightedMax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cylp.cy.CyClpSimplex
的用法示例。
在下文中一共展示了CyClpSimplex.argWeightedMax方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestCyCoinIndexedVector
# 需要导入模块: from cylp.cy import CyClpSimplex [as 别名]
# 或者: from cylp.cy.CyClpSimplex import argWeightedMax [as 别名]
class TestCyCoinIndexedVector(unittest.TestCase):
def setUp(self):
self.a = np.array([1, 10.5, -11.3, 100, -50.5, 20], dtype=np.double)
self.a2 = np.array([1000, 10.5, -11.3, 100, -50.5, 20], dtype=np.double)
self.s = CyClpSimplex()
# def test_gen(self):
# w = np.array([3], dtype=np.int32)
# self.assertEqual(self.s.argWeightedMax(self.a, w, 0.1), 5)
#
# def test_empty(self):
# w = np.array([], dtype=np.int32)
# self.assertEqual(self.s.argWeightedMax(np.array([]), w, 0.1), 0)
#
# def test_first(self):
# w = np.array([0, 2], dtype=np.int32)
# self.assertEqual(self.s.argWeightedMax(self.a, w, 99), 3)
# self.assertEqual(self.s.argWeightedMax(self.a, w, 100), 0)
def test_argMax4_1(self):
w_ind = np.array([0, 2, 5], dtype=np.int32)
self.assertEqual(self.s.argWeightedMax(self.a, 0, 100, w_ind), 5)
def test_argMax4_2(self):
w_ind = np.array([0, 2, 5], dtype=np.int32)
w = np.array([1.5, -10, 4], dtype=np.double)
self.assertEqual(self.s.argWeightedMax(self.a, 0, w, w_ind), 2)
def test_argMax4_3(self):
w_ind = np.array([0, 8, 21], dtype=np.int32)
a_ind = np.array([2, 5, 8, 10, 20, 21] , dtype=np.int32)
self.assertEqual(self.s.argWeightedMax(self.a, a_ind, 5.1, w_ind), 5)
def test_argMax4_4(self):
w_ind = np.array([0, 8, 21], dtype=np.int32)
w = np.array([100, -10, 4], dtype=np.double)
a_ind = np.array([2, 5, 8, 10, 20, 21] , dtype=np.int32)
self.assertEqual(self.s.argWeightedMax(self.a, a_ind, w, w_ind), 2)
def test_argMax_5(self):
w_ind = np.array([2, 7, 100], dtype=np.int32)
w = np.array([100, -10, 4], dtype=np.double)
a_ind = np.array([2, 5, 8, 10, 20, 21] , dtype=np.int32)
self.assertEqual(self.s.argWeightedMax(self.a2, a_ind, 10, w_ind), 0)