Skip to content

Commit

Permalink
fix import
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryHongjiangLv committed Nov 21, 2017
1 parent 1f36d02 commit 4efeadb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions Solver.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import LPSTerm
import math
import Utils
import Robustness

class LPSolver:
def __init__(self, input_dimension, total_constraint_count, origin, originbound):
Expand All @@ -13,10 +14,10 @@ def __init__(self, input_dimension, total_constraint_count, origin, originbound)
for i in range(varCount):
vid = 0
self.solver_.AddVariable("x" + i, out vid)
self.solver_.SetIntegrality(vid, RobustnessOptions.Integrality)
self.solver_.SetIntegrality(vid, Robustness.RobustnessOptions.Integrality)
if i < len(origin):
lb = max(Utils.RobustnessOptions.MinValue, origin[i] - originbound)
ub = min(Utils.RobustnessOptions.MaxValue, origin[i] + originbound)
lb = max(Robustness.RobustnessOptions.MinValue, origin[i] - originbound)
ub = min(Robustness.RobustnessOptions.MaxValue, origin[i] + originbound)

if lb <= ub:
"""// Tighter bounds for the image variables!"""
Expand All @@ -26,7 +27,7 @@ def __init__(self, input_dimension, total_constraint_count, origin, originbound)
// The programmer got the Min / Max values wrong."""
self.solver_.SetBounds(vid, origin[i] - originbound, origin[i] + originbound)
else:
self.solver_.SetBounds(vid, Utils.RobustnessOptions.MinValue, Utils.RobustnessOptions.MaxValue)
self.solver_.SetBounds(vid, Robustness.RobustnessOptions.MinValue, Utils.RobustnessOptions.MaxValue)
vars_[i] = vid


Expand Down
6 changes: 3 additions & 3 deletions SynthRegistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ def RecordAtomically(self, datasetName, datasetIndex, origLab, synthLab, scale,
e = SynthEntry()
e.datasetName = datasetName

e.origPngName = CreatePnG("orig", datasetName, datasetIndex, origLab.datum, scale, offset, numRows, numCols, isColor, isRowOrder)
e.origPngName = self.CreatePnG("orig", datasetName, datasetIndex, origLab.datum, scale, offset, numRows, numCols, isColor, isRowOrder)
e.origLabel = origLab.actualLabel

e.synthPngName = CreatePnG("snth", datasetName, datasetIndex, synthLab.datum, scale, offset, numRows, numCols, isColor, isRowOrder)
e.synthPngName = self.CreatePnG("snth", datasetName, datasetIndex, synthLab.datum, scale, offset, numRows, numCols, isColor, isRowOrder)
e.synthLabel = synthLab.actualLabel

diff = [None] * len(origLab.datum)
for i in range(len(origLab.datum)):
diff[i] = 5 * (origLab.datum[i] - synthLab.datum[i]) + 100

CreatePnG("diffx5o100", datasetName, datasetIndex,diff,scale,offset,numRows,numCols,isColor,isRowOrder)
self.CreatePnG("diffx5o100", datasetName, datasetIndex,diff,scale,offset,numRows,numCols,isColor,isRowOrder)

print "Orig path =" + e.origPngName
print "Synth path =" + e.synthPngName
Expand Down

0 comments on commit 4efeadb

Please sign in to comment.