Skip to content

Commit

Permalink
Improved PPO.
Browse files Browse the repository at this point in the history
  • Loading branch information
perara committed Oct 30, 2024
1 parent a280de8 commit 11c944d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jsp/examples/ppo_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ def get_best_schedule(self) -> Tuple[List[jobshop.Action], float]:
def action_masks(self) -> np.ndarray:
return self._action_mask

def get_jobshop_env(self) -> jobshop.JobShopEnvironment:
return self.env

class MakespanCallback(BaseCallback):
def __init__(self, verbose: int = 0, plotter: Optional[jobshop.LivePlotter] = None):
Expand Down Expand Up @@ -313,8 +315,8 @@ def make_env() -> Callable[[], gym.Env]:
model.learn(total_timesteps=total_timesteps, callback=makespan_callback)

print(f"Best makespan achieved: {makespan_callback.best_makespan}")
print(f"Optimal makespan: {ta_optimal}")
print(f"Gap: {(makespan_callback.best_makespan - ta_optimal) / ta_optimal * 100:.2f}%")
#print(f"Optimal makespan: {ta_optimal}")
#print(f"Gap: {(makespan_callback.best_makespan - ta_optimal) / ta_optimal * 100:.2f}%")

if __name__ == "__main__":
print(":D")
Expand Down

0 comments on commit 11c944d

Please sign in to comment.