From 4efeadb7363799e90c954e269c2b15963142f4cd Mon Sep 17 00:00:00 2001 From: HenryHongjiangLv <719792729@qq.com> Date: Mon, 20 Nov 2017 20:33:11 -0600 Subject: [PATCH] fix import --- Solver.py | 9 +++++---- SynthRegistry.py | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Solver.py b/Solver.py index 342ef88..24239d8 100644 --- a/Solver.py +++ b/Solver.py @@ -1,6 +1,7 @@ import LPSTerm import math import Utils +import Robustness class LPSolver: def __init__(self, input_dimension, total_constraint_count, origin, originbound): @@ -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!""" @@ -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 diff --git a/SynthRegistry.py b/SynthRegistry.py index 2235907..30c02cf 100644 --- a/SynthRegistry.py +++ b/SynthRegistry.py @@ -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