Skip to content

Commit

Permalink
fix: tiny fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Furffico committed May 6, 2024
1 parent 95124f6 commit 30892fe
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
30 changes: 30 additions & 0 deletions baselines/eoh/original/prompts/bpp_online.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
class GetPrompts():
def __init__(self):
self.prompt_task = "I need help designing a novel score function that scoring a set of bins to assign an item. \
In each step, the item will be assigned to the bin with the maximum score. If the rest capacity of a bin equals the maximum capacity, it will not be used. The final goal is to minimize the number of used bins."
self.prompt_func_name = "score"
self.prompt_func_inputs = ['item', 'bins']
self.prompt_func_outputs = ['scores']
self.prompt_inout_inf = "'item' and 'bins' are the size of current item and the rest capacities of feasible bins, which are larger than the item size. \
The output named 'scores' is the scores for the bins for assignment. "
self.prompt_other_inf = "Note that 'item' is of type int, while 'bins' and 'scores' are both Numpy arrays. The novel function should be sufficiently complex in order to achieve better performance. It is important to ensure self-consistency."
#Include the following imports at the beginning of the code: 'import numpy as np', and 'from numba import jit'. Place '@jit(nopython=True)' just above the 'priority' function definition."

def get_task(self):
return self.prompt_task

def get_func_name(self):
return self.prompt_func_name

def get_func_inputs(self):
return self.prompt_func_inputs

def get_func_outputs(self):
return self.prompt_func_outputs

def get_inout_inf(self):
return self.prompt_inout_inf

def get_other_inf(self):
return self.prompt_other_inf

3 changes: 3 additions & 0 deletions baselines/eoh/problem_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ def __init__(self, cfg, root_dir):
if self.problem_type == "tsp_constructive":
from .original.prompts.tsp_greedy import GetPrompts
self.prompts = GetPrompts()
elif self.problem_type == "bpp_online":
from .original.prompts.bpp_online import GetPrompts
self.prompts = GetPrompts()
else:
self.prompts = Prompts(self.config, root_dir)

Expand Down
7 changes: 4 additions & 3 deletions baselines/eoh/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ Implementation of EoH (Liu et al., 2024). Code adapted from [official source cod
`-- original
|-- eoh.py <- <a href="https://github.com/FeiLiu36/EoH/tree/d7c5a69f4f6b70b475c5ef942f9c72675fe9ac71/eoh/src/eoh/methods/eoh/eoh.py">/eoh/methods/eoh/eoh.py</a>
|-- eoh_evolution.py <- <a href="https://github.com/FeiLiu36/EoH/tree/d7c5a69f4f6b70b475c5ef942f9c72675fe9ac71/eoh/src/eoh/methods/eoh/eoh_evolution.py">/eoh/methods/eoh/eoh_evolution.py</a>
|-- eoh_interface_EC.py <- <a href="https://github.com/FeiLiu36/EoH/tree/d7c5a69f4f6b70b475c5ef942f9c72675fe9ac71/eoh/src/eoh/methods/eoh/eoh_evolution.py">/eoh/methods/eoh/eoh_evolution.py</a>
|-- getParas.py <- <a href="https://github.com/FeiLiu36/EoH/blob/d7c5a69f4f6b70b475c5ef942f9c72675fe9ac71/eoh/src/eoh/utils/getParas.py">/eoh/utils/getParas.py</a>
|-- interface_LLM.py <- <a href="https://github.com/FeiLiu36/EoH/blob/d7c5a69f4f6b70b475c5ef942f9c72675fe9ac71/eoh/src/eoh/llm/api_general.py">/eoh/llm/api_general.py</a>
|-- eoh_interface_EC.py <- <a href="https://github.com/FeiLiu36/EoH/tree/d7c5a69f4f6b70b475c5ef942f9c72675fe9ac71/eoh/src/eoh/methods/eoh/eoh_interface_EC.py">/eoh/methods/eoh/eoh_interface_EC.py</a>
|-- pop_greedy.py <- <a href="https://github.com/FeiLiu36/EoH/blob/d7c5a69f4f6b70b475c5ef942f9c72675fe9ac71/eoh/src/eoh/methods/management/pop_greedy.py">/eoh/methods/management/pop_greedy.py</a>
|-- prob_rank.py <- <a href="https://github.com/FeiLiu36/EoH/blob/d7c5a69f4f6b70b475c5ef942f9c72675fe9ac71/eoh/src/eoh/methods/selection/prob_rank.py">/eoh/methods/selection/prob_rank.py</a>
|-- interface_LLM.py <- <a href="https://github.com/FeiLiu36/EoH/blob/d7c5a69f4f6b70b475c5ef942f9c72675fe9ac71/eoh/src/eoh/llm/api_general.py">/eoh/llm/api_general.py</a>
|-- getParas.py <- <a href="https://github.com/FeiLiu36/EoH/blob/d7c5a69f4f6b70b475c5ef942f9c72675fe9ac71/eoh/src/eoh/utils/getParas.py">/eoh/utils/getParas.py</a>
`-- prompts
|-- bpp_online.py <- <a href="https://github.com/FeiLiu36/EoH/blob/d7c5a69f4f6b70b475c5ef942f9c72675fe9ac71/eoh/src/eoh/problems/optimization/bp_online/prompts.py">/eoh/problems/optimization/bp_online/prompts.py</a>
`-- tsp_greedy.py <- <a href="https://github.com/FeiLiu36/EoH/blob/d7c5a69f4f6b70b475c5ef942f9c72675fe9ac71/eoh/src/eoh/problems/optimization/tsp_greedy/prompts.py">/eoh/problems/optimization/tsp_greedy/prompts.py</a>
</pre>

Expand Down
2 changes: 2 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def main(cfg):
from reevo import ReEvo as ga
elif cfg.algorithm == "ael":
from baselines.ael.ga import AEL as ga
elif cfg.algorithm == "eoh":
from baselines.eoh import EoH as ga
else:
raise NotImplementedError

Expand Down

0 comments on commit 30892fe

Please sign in to comment.