Skip to content

Commit

Permalink
Extra options
Browse files Browse the repository at this point in the history
  • Loading branch information
udeshmg committed Jul 16, 2021
1 parent efbe95f commit 988db6e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ def _eval_dataset(model, dataset, width, softmax_temp, opts, device):
opts.use_gurobi = False

if dynamic:
opts.datasets = ["data/dynamic_tsp/dynamic_tsp20_validation_seed4321.pkl"]
opts.model = "outputs/icde/dynamic_tsp_20/run_15/"
opts.datasets = ["data/dynamic_tsp/dynamic_tsp10_validation_seed4321.pkl"]
opts.model = "outputs/icde/dynamic_tsp_10/run_41/epoch-81.pt"
else:
opts.datasets = ["data/dynamic_tsp/dynamic_tsp50_validation_seed4321.pkl"]
opts.model = "outputs/icde/dynamic_tsp_20/run_12/"

opts.decode_strategy = "bs"
opts.width = [10]
opts.width = [5]

assert opts.o is None or (len(opts.datasets) == 1 and len(opts.width) <= 1), \
"Cannot specify result filename with more than one dataset or more than one width"
Expand Down
12 changes: 6 additions & 6 deletions options.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def get_options(args=None):

# Data
parser.add_argument('--problem', default='dynamic_tsp', help="The problem to solve, default 'tsp'")
parser.add_argument('--graph_size', type=int, default=20, help="The size of the problem graph")
parser.add_argument('--graph_size', type=int, default=10, help="The size of the problem graph")
parser.add_argument('--batch_size', type=int, default=32, help='Number of instances per batch during training')
parser.add_argument('--epoch_size', type=int, default=12800, help='Number of instances per epoch during training')
parser.add_argument('--val_size', type=int, default=100,
Expand All @@ -23,7 +23,7 @@ def get_options(args=None):
parser.add_argument('--model', default='st_attention', help="Model, 'attention' (default) or 'pointer'")
parser.add_argument('--embedding_dim', type=int, default=128, help='Dimension of input embedding')
parser.add_argument('--hidden_dim', type=int, default=128, help='Dimension of hidden layers in Enc/Dec')
parser.add_argument('--n_encode_layers', type=int, default=3,
parser.add_argument('--n_encode_layers', type=int, default=5,
help='Number of layers in the encoder/critic network')
parser.add_argument('--tanh_clipping', type=float, default=10.,
help='Clip the parameters to within +- this value using tanh. '
Expand All @@ -34,7 +34,7 @@ def get_options(args=None):
# Training
parser.add_argument('--lr_model', type=float, default=1e-4, help="Set the learning rate for the actor network")
parser.add_argument('--lr_critic', type=float, default=1e-4, help="Set the learning rate for the critic network")
parser.add_argument('--lr_decay', type=float, default=1, help='Learning rate decay per epoch')
parser.add_argument('--lr_decay', type=float, default=1., help='Learning rate decay per epoch')
parser.add_argument('--eval_only', action='store_true', help='Set this value to only evaluate model')
parser.add_argument('--n_epochs', type=int, default=50, help='The number of epochs to train')
parser.add_argument('--seed', type=int, default=1234, help='Random seed to use')
Expand Down Expand Up @@ -67,16 +67,16 @@ def get_options(args=None):
parser.add_argument('--output_dir', default='outputs/icde', help='Directory to write output models to')
parser.add_argument('--epoch_start', type=int, default=0,
help='Start at epoch # (relevant for learning rate decay)')
parser.add_argument('--checkpoint_epochs', type=int, default=10,
parser.add_argument('--checkpoint_epochs', type=int, default=1,
help='Save checkpoint every n epochs (default 1), 0 to save no checkpoints')
parser.add_argument('--load_path', help='Path to load model parameters and optimizer state from')
parser.add_argument('--resume', help='Resume from previous checkpoint file')
parser.add_argument('--no_tensorboard', action='store_true', help='Disable logging TensorBoard files')
parser.add_argument('--no_progress_bar', action='store_true', help='Disable progress bar')

opts = parser.parse_args(args)
opts.val_dataset = "./data/dynamic_tsp/dynamic_tsp20_test_seed1234.pkl"
opts.resume = "./outputs/icde/dynamic_tsp_20/run_9/epoch-49.pt"
opts.val_dataset = "./data/dynamic_tsp/dynamic_tsp10_validation_seed4321.pkl"
#opts.resume = "outputs/icde/dynamic_cvrp_20/run_7/epoch-49.pt"
opts.use_single_time = False
opts.use_cuda = torch.cuda.is_available() and not opts.no_cuda

Expand Down
Binary file added pretrained/dynamic_tsp_10/GTA-RL-rt/epoch-49.pt
Binary file not shown.
2 changes: 1 addition & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def test_gurobi(filename, dynamic, time=60):
opts.load_path = 'pretrained/tsp_20/'

if opts.dynamic:
opts.load_data = 'data/dynamic_tsp/dynamic_tsp20_validation_seed4321.pkl'
opts.load_data = 'data/dynamic_tsp/dynamic_tsp10_validation_seed4321.pkl'
else:
opts.load_data = 'data/tsp/tsp20_test_seed1234.pkl'

Expand Down

0 comments on commit 988db6e

Please sign in to comment.