Skip to content

Commit

Permalink
Continue completing expected functions for the new problem/solution type
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniogi committed Nov 1, 2024
1 parent aceffb3 commit 33459fa
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/CristinaData.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def __del__(self):
def getNumParams(self):
return self.__numParams

def printData(self):
for i in range(self.__numParams):
u.logger.info("CristinaData. Param(" + str(i) +") - Value: " + str(self.__params[i].get_value()))

"""
Returns a list of doubles with the values of the modificable parameters
"""
Expand Down
4 changes: 3 additions & 1 deletion src/ProblemCristina.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def __init__(self):
return

def solve(self, solution):
return random.random()
val = random.randint(0, 1000000)
print("ProblemCristina. Solution found with value: " + str(val))
return val

def extractSolution(self):
raise NotImplementedError("Extract solution abstract problem")
Expand Down
4 changes: 4 additions & 0 deletions src/SolutionBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ def getNumberofParams(self):
def getMaxNumberofValues(self):
return 0

def print(self):
u.logger.debug("Print function not implemented")
return

def isValid(self):
return self.__isValid

Expand Down
6 changes: 5 additions & 1 deletion src/SolutionCristina.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def initialize(self, data):
return

def prepare(self, filename):
self.__data.create_input_file(filename)
return
# self.__data.create_input_file(filename)

def getNumberofParams(self):
return self.__data.getNumParams()
Expand All @@ -68,3 +69,6 @@ def setParameters(self, params):

def getData(self):
return self.__data

def print(self):
self.__data.printData()
1 change: 1 addition & 0 deletions src/SolverDAB.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def createRandomSolution(self):
newVal = random.randint(minVal, maxVal)
params[i].set_value(newVal)
solution.setParameters(params)
solution.print()
return solution

"""
Expand Down

0 comments on commit 33459fa

Please sign in to comment.