Beispiel #1
0
 def test_case_3(self):
     # prepare raw problem
     variables = [0, 1, 2, 3]
     objectives = [{0: -10, 1: -5, 2: -1, 3: -5}, {0: 3, 1: 2, 2: 3, 3: 0}]
     constraints = dict()
     # prepare solvers
     for solver_name in self.binary_solver:
         if solver_name == 'epsilon':
             problem = NextReleaseProblem.MOIP( \
                 variables, objectives, constraints,  \
                 dict(), dict() \
             )
         else:
             constraints = JNRP.regularize_constraints(
                 constraints, len(variables))
             problem = JNRP(variables, objectives, constraints)
         solver = Solver(solver_name)
         # prepare and solve
         solver.load(problem)
         solver.execute()
         # get the solutions
         solutions = solver.solutions()
         print(solver_name + '\t\t' + str(len(solutions)))
         self.display(solutions, 5)
Beispiel #2
0
 def test_case_2(self):
     # prepare raw problem
     variables = [0, 1, 2, 3]
     objectives = [{0: -10, 1: -5, 2: -1, 3: 5}]
     constraints = [{2: 1, 4: 0}, {0: 1, 3: -1, 4: 0}]
     # prepare solvers
     for solver_name in self.single_solver:
         if solver_name == 'single':
             problem = NextReleaseProblem.MOIP( \
                 variables, objectives, constraints,  \
                 ['L' for _ in range(len(constraints))], dict() \
             )
         else:
             constraints = JNRP.regularize_constraints(
                 constraints, len(variables))
             problem = JNRP(variables, objectives, constraints)
         solver = Solver(solver_name)
         # prepare and solve
         solver.load(problem)
         solver.execute()
         # get the solutions
         solutions = solver.solutions()
         print(solver_name + '\t\t' + str(len(solutions)))
         self.display(solutions, 5)