Skip to content

Commit

Permalink
Merge pull request #3 from ctwardy/sourcery/master
Browse files Browse the repository at this point in the history
Sourcery refactored master branch - simple replacements: \n\t ➛ \n, and range(0,x) ➛ range(x)
  • Loading branch information
ctwardy authored Aug 19, 2020
2 parents 9e89501 + 784d7f2 commit bc4a27e
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions SORAL/python/testbed.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,50 @@
def runTest():
areas=4
resources=1

area = soral.doubleArray(areas)
POA = soral.doubleArray(areas)
ESW = soral.doubleArray(areas)
speed = soral.doubleArray(areas)

# Configure the arrays with some test values
for i in range(0, areas):
for i in range(areas):
area[i] = [28, 30, 14, 12][i]
POA[i] = [0.1935, 0.2581, 0.2903, 0.2581][i]
ESW[i] = 1
speed[i] = 1

availableHours = soral.doubleArray(resources)
availableHours[0] = 40

effectiveness = soral.Array2D(areas, resources)
for resourceIdx in range(0, resources):
for areaIdx in range(0, areas):

for resourceIdx in range(resources):
for areaIdx in range(areas):
value = ESW[areaIdx]*speed[areaIdx]/area[areaIdx]
effectiveness.set(areaIdx, resourceIdx, value)
# print "Effectiveness("+str(areaIdx)+","+str(resourceIdx)+" = "+str(value);


theAllocation = soral.newCharnesCooper(resources, areas, effectiveness, availableHours, POA)

print("The calculated allocation")
printAssignments(theAllocation)

print("PODs: ")
for i in range(0, areas):
for i in range(areas):
print(" " +str(i) + ": " + str(theAllocation.getPOD(i)))

print("Adjusted POAs: ")
for i in range(0, areas):
for i in range(areas):
print(" " +str(i) + ": " + str(theAllocation.getNewPOC(i)))

print("Segment POSs: ")
for i in range(0, areas):
for i in range(areas):
print(" " +str(i) + ": " + str(theAllocation.getPOS(i)))

print(" Cumulative POS: " + str(theAllocation.getTotalPOS()) )

del theAllocation


Expand Down

0 comments on commit bc4a27e

Please sign in to comment.