Instantly share code, notes, and snippets.

Embed
What would you like to do?
# election two categories of voters:
# 20 voters with weight 1, 2 voters with weight 10
# 10x + y = 20
# x <= 2, y <= 20
# three solution points: (2, 0), (1, 10), (0, 20)
# particular solution (origin):
# [0 20]
# basis
# [1 -10]
# to derive the monomials:
# monomial form
# origin term + basis term
# origin term = origin value / (number of voters * number of points)
# basis term = basis value / (number of voters * number of points)
# x monomials: 0/6 + 1/6x: [[1/6,[1]]]
# y monomials: 20/60 - 10x/60: [[20/60,[0]], [-10/60,[1]]]
3 3
20 -10 -1
2 -1 0
20 0 -1
linearity 1 1
nonnegative 2 1 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment