reader = BiCriteriaProbReaderOR(inputPath) reader.load() reader.save(moipInputFile) reader.displayFeatureNum() reader.displayTestCaseNum() reader.displayStmtNum() reader.displayFaultNum() reader.displayConstraintInequationNum() reader.displayConstraintEquationNum() prob = MOIPProblem(len(reader.objectNames), len(reader.featureNames), len(reader.objectNames) - 1) prob.displayObjectiveCount() prob.displayFeatureCount() prob.exetractFromFile(moipInputFile) prob.displayObjectives() #prob.displayVariableNames() #prob.displayObjectiveSparseMapList() prob.displaySparseInequationsMapListCount() prob.displaySparseEquationsMapListCount() #prob.displayAttributeMatrix() time_start = time.time() sol = CwmoipSol(prob) sol.prepare() sol.execute() time_end = time.time() exec_time = time_end - time_start sol.outputCplexParetoMap(paretoOutputFile) sol.outputFullCplexResultMap(fullResultOutputFile)
# -*- coding: utf-8 -*- """ Created on Thu Jun 14 10:03:21 2018 @author: Yinxing Xue """ from moipProb import MOIPProblem from naiveSol import NaiveSol if __name__ == "__main__": prob = MOIPProblem(2, 7, 1) prob.displayObjectiveCount() prob.displayFeatureCount() prob.exetractFromFile("../test/test_case/parameter_example.txt") prob.displayObjectives() prob.displayVariableNames() prob.displayObjectiveSparseMapList() prob.displaySparseInequationsMapList() prob.displaySparseEquationsMapList() prob.displayAttributeMatrix() sol = NaiveSol(prob) sol.prepare() sol.execute() sol.outputCplexParetoMap("../result/test_case/parameter_example.txt") sol.displaySolvingAttempts() sol.displayObjsBoundsDictionary() sol.displayCplexSolutionSetSize() sol.displayCplexResultMap() sol.displayFullCplexResultMap() sol.displayCplexParetoSet()
rsltObj = cplex.solution.get_objective_value() if origiCplex == None: cplex.end() else: #remove the temp constraints cplex.linear_constraints.delete(tempConstNames1) cplex.linear_constraints.delete(tempConstNames2) return (rsltObj, rsltXvar, rsltSolString) if __name__ == "__main__": prob = MOIPProblem(4, 1244, 3) prob.displayObjectiveCount() prob.displayFeatureCount() prob.exetractFromFile("../test/parameter_ecos1.txt") prob.displayObjectives() prob.displayVariableNames() #prob.displayObjectiveSparseMapList() #prob.displaySparseInequationsMapList() #prob.displaySparseEquationsMapList() #prob.displayAttributeMatrix() sol = NcgopSol(prob) sol.prepare() sol.execute() sol.outputCplexParetoMap("../result/parameter_ecos1.txt") sol.displaySolvingAttempts() sol.displayObjsBoundsDictionary() sol.displayCplexSolutionSetSize() sol.displayCplexResultMap()
ub = ub+ value else: lb = lb + value return ub, lb def displaySolvingAttempts(self): print ("Total Sovling Attempts: %s" % self.solveCounter) def displayObjsBoundsDictionary(self): print ("Objectives' Bound Dictionary: %s" % self.boundsDict) if __name__ == "__main__": prob = MOIPProblem(2,10,1) prob.displayObjectiveCount() prob.displayFeatureCount() prob.exetractFromFile("../test/tri_input_example.txt") prob.displayObjectives() prob.displayVariableNames() prob.displayObjectiveSparseMapList() prob.displaySparseInequationsMapList() prob.displaySparseEquationsMapList() prob.displayAttributeMatrix() sol= NaiveSol(prob) sol.prepare() sol.execute() sol.outputCplexParetoMap("../result/tri-obj/Pareto_example.txt") sol.outputFullCplexResultMap("../result/tri-obj/FullResult_example.txt") sol.displaySolvingAttempts() sol.displayObjsBoundsDictionary() sol.displayCplexSolutionSetSize()