Search is not available for this dataset
repo stringlengths 2 152 ⌀ | file stringlengths 15 239 | code stringlengths 0 58.4M | file_length int64 0 58.4M | avg_line_length float64 0 1.81M | max_line_length int64 0 12.7M | extension_type stringclasses 364
values |
|---|---|---|---|---|---|---|
null | r-mae-main/pretrain/dataset/processor/processors.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import random
import torchvision.transforms as transforms
from pretrain.utils.distributed import is_master
fro... | 10,114 | 28.75 | 87 | py |
null | r-mae-main/pretrain/dataset/reader/__init__.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from pretrain.dataset.reader.image_reader import ImageReader
__all__ = ["ImageReader"]
| 286 | 27.7 | 61 | py |
null | r-mae-main/pretrain/dataset/reader/image_reader.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import cv2
from PIL import Image
class ImageReader:
def __init__(self, base_path, reader_type):
se... | 1,271 | 24.959184 | 78 | py |
null | r-mae-main/pretrain/model/__init__.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import importlib
import os
from pretrain.model.base_model import BaseModel
ARCH_REGISTRY = {}
__all__ = ["BaseModel"]... | 1,777 | 25.537313 | 84 | py |
null | r-mae-main/pretrain/model/base_model.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from torch import nn
class BaseModel(nn.Module):
"""For integration with the trainer, datasets and other features,
... | 1,873 | 31.310345 | 79 | py |
null | r-mae-main/pretrain/model/mae.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import copy
from pretrain.model import BaseModel, register_model
from pretrain.module import build_mae, build_rmae
from p... | 2,822 | 31.448276 | 87 | py |
null | r-mae-main/pretrain/module/__init__.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from .mae import build_mae
from .rmae import build_rmae
__all__ = [
"build_mae",
"build_rmae",
]
| 305 | 19.4 | 61 | py |
null | r-mae-main/pretrain/module/layers.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
from pretrain.utils.functional import drop_path
class DropPath(nn.Module):
"""Dr... | 11,237 | 27.165414 | 99 | py |
null | r-mae-main/pretrain/module/mae.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import copy
import warnings
from functools import partial
import omegaconf
import torch
import torch.nn as nn
from pretr... | 10,108 | 30.990506 | 98 | py |
null | r-mae-main/pretrain/module/rmae.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import copy
import warnings
from functools import partial
import omegaconf
import torch
import torch.nn as nn
import torc... | 19,154 | 32.313043 | 107 | py |
null | r-mae-main/pretrain/optim/__init__.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import importlib
import collections.abc
from lib2to3.pgen2.token import OP
import os
import copy
import torch
import torc... | 3,246 | 31.148515 | 85 | py |
null | r-mae-main/pretrain/optim/lars.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
class LARS(torch.optim.Optimizer):
"""
LARS optimizer, no rate scaling or weight decay for paramete... | 1,815 | 30.859649 | 81 | py |
null | r-mae-main/pretrain/optim/oss.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import copy
import io
import logging
from itertools import chain
from math import inf
from typing import TYPE_CHECKING, An... | 31,784 | 42.541096 | 135 | py |
null | r-mae-main/pretrain/optim/scheduler/__init__.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import importlib
import os
import warnings
from pretrain.optim.scheduler.lr_scheduler import BaseScheduler
SCHEDULER_RE... | 2,087 | 29.26087 | 88 | py |
null | r-mae-main/pretrain/optim/scheduler/cosine_scheduler.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import math
from pretrain.optim.scheduler import register_scheduler, BaseScheduler
@register_scheduler("cosine_annealin... | 1,776 | 36.020833 | 88 | py |
null | r-mae-main/pretrain/optim/scheduler/lr_scheduler.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import warnings
import weakref
from functools import wraps
import torch
class BaseScheduler(object):
def __init__(s... | 5,543 | 35.715232 | 102 | py |
null | r-mae-main/pretrain/optim/scheduler/multi_step_scheduler.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from bisect import bisect_right
from pretrain.optim.scheduler import register_scheduler, BaseScheduler
@register_schedu... | 1,763 | 35.75 | 87 | py |
null | r-mae-main/pretrain/optim/scheduler/step_scheduler.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from pretrain.optim.scheduler import register_scheduler, BaseScheduler
@register_scheduler("step")
class StepScheduler(B... | 1,623 | 35.088889 | 80 | py |
null | r-mae-main/pretrain/trainer/__init__.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import importlib
import os
TRAINER_REGISTRY = {}
def build_trainer(configuration, *args, **kwargs):
configuration.... | 1,178 | 25.2 | 83 | py |
null | r-mae-main/pretrain/trainer/base_trainer.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import time
import os
import collections
import torch
from torch.cuda.amp import GradScaler
from pretrain.utils.meter im... | 10,912 | 34.780328 | 86 | py |
null | r-mae-main/pretrain/trainer/engine/__init__.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import importlib
import os
ENGINE_REGISTRY = {}
from .base_engine import BaseEngine
def build_engine(config, trainer... | 1,352 | 26.06 | 87 | py |
null | r-mae-main/pretrain/trainer/engine/base_engine.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
from pretrain.utils.distributed import reduce_dict
from pretrain.utils.general import clip_grad_norm, filter... | 5,423 | 34.45098 | 88 | py |
null | r-mae-main/pretrain/trainer/engine/pretrain_engine.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import gc
import collections
import torch
import torchvision.transforms as transforms
import torchvision.transforms.funct... | 9,868 | 36.957692 | 88 | py |
null | r-mae-main/pretrain/utils/__init__.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree. | 196 | 38.4 | 61 | py |
null | r-mae-main/pretrain/utils/box_ops.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from typing import List
import torch
import torch.nn.functional as F
from torchvision.ops.boxes import box_area
from pyco... | 21,006 | 33.494253 | 100 | py |
null | r-mae-main/pretrain/utils/checkpoint.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import glob
import warnings
import torch
from omegaconf import OmegaConf
TORCH_VERSION = tuple(int(x) for x in... | 6,758 | 32.132353 | 86 | py |
null | r-mae-main/pretrain/utils/configuration.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import collections
import json
import os
import warnings
from ast import literal_eval
import torch
from omegaconf import ... | 8,726 | 34.189516 | 94 | py |
null | r-mae-main/pretrain/utils/distributed.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import numpy as np
import socket
import subprocess
import warnings
import functools
import torch
from torch imp... | 10,206 | 27.997159 | 92 | py |
null | r-mae-main/pretrain/utils/env.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import random
import datetime
import numpy as np
import torch
import torch.backends.cudnn as cu... | 3,093 | 25.672414 | 89 | py |
null | r-mae-main/pretrain/utils/functional.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import math
import warnings
import collections
from functools import partial
import numpy as np
import torch
import torch... | 25,610 | 33.331099 | 129 | py |
null | r-mae-main/pretrain/utils/general.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import copy
import collections
import re
import sys
import torch
import torch.nn as nn
import torchvision
impor... | 6,570 | 28.334821 | 85 | py |
null | r-mae-main/pretrain/utils/grad_checkpoint.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import functools
import threading
import weakref
from typing import Any, Dict, List, Generator, Optional, Tuple, Union
fro... | 18,667 | 37.411523 | 98 | py |
null | r-mae-main/pretrain/utils/logger.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import collections
import json
import logging
import os
import sys
from torch.utils.tensorboard import SummaryWriter
fro... | 5,647 | 29.695652 | 86 | py |
null | r-mae-main/pretrain/utils/meter.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import datetime
import time
from collections import deque, defaultdict
import torch
import torch.distributed as dist
fro... | 7,593 | 30.510373 | 86 | py |
null | r-mae-main/pretrain/utils/modeling.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from typing import Optional, List, Set, Dict, Any
import torch
def get_layer_id(layer_name, num_layers):
if "net.po... | 5,763 | 31.382022 | 83 | py |
null | r-mae-main/pretrain/utils/params.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from collections import abc
from math import inf
from typing import Any, Dict, List, Optional, Union, Callable
import tor... | 11,141 | 31.202312 | 172 | py |
null | r-mae-main/pretrain/utils/timer.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import time
class Timer:
DEFAULT_TIME_FORMAT_DATE_TIME = "%Y/%m/%d %H:%M:%S"
DEFAULT_TIME_FORMAT = ["%03dms", "%... | 1,929 | 25.438356 | 81 | py |
null | r-mae-main/tools/run.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import random
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import torch
import pretrain
from pretrain.trainer imp... | 2,599 | 28.213483 | 83 | py |
null | r-mae-main/tools/preprocess/README.md | # Pre-Process
## Generate FH masks for COCO Datasets
As shown in the repository, the datasets are assumed to exist in a directory specified by the environment variable $E2E_DATASETS.
In order to make it consistent, we want to generate FH mask proposals and save them to ```fh_train2017``` and ```fh_unlabeled2017``` f... | 2,426 | 31.797297 | 211 | md |
null | r-mae-main/tools/preprocess/__init__.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree. | 196 | 38.4 | 61 | py |
null | r-mae-main/tools/preprocess/create_fh_mask_for_coco.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import glob
from functools import partial
from multiprocessing import Pool
import numpy as np
i... | 3,134 | 30.989796 | 88 | py |
null | r-mae-main/tools/preprocess/create_fh_mask_for_imnet.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import glob
from functools import partial
from multiprocessing import Pool
import numpy as np
i... | 5,301 | 29.825581 | 91 | py |
PB-DFS | PB-DFS-master/README.md | # Learning Primal Heuristics for Mixed Integer Programs
## Requirements
#### Python Code Dependencies
1. Python version 3.6.9.
2. Cuda version 10.0 (required by TRIG-GNN)
3. Cmake version >= 3.15
4. python3-venv (installed by running 'sudo apt-get install python3-venv')
5. Two virtual environments that contain diffe... | 3,698 | 60.65 | 253 | md |
PB-DFS | PB-DFS-master/calc_stats.sh | #! /bin/bash
python3 stats.py mis > ret_solver/mis.txt
python3 stats.py vc > ret_solver/vc.txt
python3 stats.py ca > ret_solver/ca.txt
python3 stats.py ds > ret_solver/ds.txt
| 176 | 24.285714 | 41 | sh |
PB-DFS | PB-DFS-master/heur_eval.sh | #! /bin/bash
prefix=build
# Combinatorial Auction Problem
nohup ${prefix}/CO -p 6 -h 0 &
nohup ${prefix}/CO -p 6 -h 2 &
nohup ${prefix}/CO -p 6 -h 4 &
nohup ${prefix}/CO -p 6 -h 4 -t 50 &
nohup ${prefix}/CO -p 6 -h 6 -t 50 &
nohup ${prefix}/CO -p 6 -h 7 -t 50 &
nohup ${prefix}/CO -p 6 -h 8 -t 50 &
nohup ${prefix}/CO ... | 1,417 | 26.803922 | 39 | sh |
PB-DFS | PB-DFS-master/model_predict.sh | #! /bin/bash
nohup python3 GG-GCN/pred_gcn.py mis &
nohup python3 GG-GCN/pred_gcn.py vc &
nohup python3 GG-GCN/pred_gcn.py ds &
nohup python3 GG-GCN/pred_gcn.py ca &
nohup python3 GG-GCN/pred_baselines.py mis -m lr &
nohup python3 GG-GCN/pred_baselines.py vc -m lr &
nohup python3 GG-GCN/pred_baselines.py ds -m lr &
n... | 368 | 32.545455 | 50 | sh |
PB-DFS | PB-DFS-master/model_test.sh | #! /bin/bash
nohup python3 GG-GCN/test_gcn.py mis &
nohup python3 GG-GCN/test_gcn.py vc &
nohup python3 GG-GCN/test_gcn.py ds &
nohup python3 GG-GCN/test_gcn.py ca &
nohup python3 GG-GCN/test_baselines.py mis -m lr &
nohup python3 GG-GCN/test_baselines.py vc -m lr &
nohup python3 GG-GCN/test_baselines.py ds -m lr &
n... | 574 | 34.9375 | 51 | sh |
PB-DFS | PB-DFS-master/model_test_trig_gcn.sh | #! /bin/bash
nohup python3 TRIG-GCN/test.py mis &
nohup python3 TRIG-GCN/test.py vc &
nohup python3 TRIG-GCN/test.py ds &
nohup python3 TRIG-GCN/test.py ca &
| 159 | 21.857143 | 36 | sh |
PB-DFS | PB-DFS-master/model_train.sh | #! /bin/bash
nohup python3 GG-GCN/train_gcn.py mis &
nohup python3 GG-GCN/train_gcn.py vc &
nohup python3 GG-GCN/train_gcn.py ds &
nohup python3 GG-GCN/train_gcn.py ca &
nohup python3 GG-GCN/train_baselines.py mis -m lr &
nohup python3 GG-GCN/train_baselines.py vc -m lr &
nohup python3 GG-GCN/train_baselines.py ds -m... | 586 | 35.6875 | 52 | sh |
PB-DFS | PB-DFS-master/model_train_trig_gcn.sh | #! /bin/bash
nohup python3 TRIG-GCN/train.py mis &
nohup python3 TRIG-GCN/train.py vc &
nohup python3 TRIG-GCN/train.py ds &
nohup python3 TRIG-GCN/train.py ca & | 162 | 26.166667 | 37 | sh |
PB-DFS | PB-DFS-master/stats.py | import sys,os
import pandas as pd
import argparse
import shutil
import numpy as np
from scipy.stats.mstats import gmean
def analyse(ret_dir, problem):
def geo_mean(arr, mask=None):
if mask is None:
arr = arr.to_numpy().astype(float)
else:
arr = arr.to_numpy()[~mask].astype(... | 2,719 | 35.756757 | 114 | py |
PB-DFS | PB-DFS-master/GG-GCN/pred_baselines.py | import os
import sys
# sys.path.append( f'{os.path.dirname(os.path.realpath(__file__))}/../')
import importlib
import argparse
import csv
import numpy as np
import time
import pickle
import pathlib
import gzip
import warnings
warnings.filterwarnings("ignore")
from utils import load_flat_samples
from sklearn.linear_mode... | 1,843 | 26.939394 | 82 | py |
PB-DFS | PB-DFS-master/GG-GCN/pred_gcn.py | from __future__ import division
from __future__ import print_function
import sys
import os
sys.path.append( f'{os.path.dirname(os.path.realpath(__file__))}/gcn')
from os.path import expanduser
home = expanduser("~")
import time
import scipy.io as sio
import numpy as np
import scipy.sparse as sp
from copy import deepco... | 4,646 | 35.880952 | 133 | py |
PB-DFS | PB-DFS-master/GG-GCN/test_baselines.py | import os
import sys
# sys.path.append( f'{os.path.dirname(os.path.realpath(__file__))}/../')
import importlib
import argparse
import csv
import numpy as np
import time
import pickle
import pathlib
import gzip
import warnings
warnings.filterwarnings("ignore")
from utils import log, load_samples, calc_classification_met... | 2,176 | 30.550725 | 97 | py |
PB-DFS | PB-DFS-master/GG-GCN/test_gcn.py | import sys
import os
sys.path.append( f'{os.path.dirname(os.path.realpath(__file__))}/gcn')
# sys.path.append( f'{os.path.dirname(os.path.realpath(__file__))}/../')
import warnings
warnings.filterwarnings('ignore')
from os.path import expanduser
import time
import scipy.io as sio
import numpy as np
from copy import dee... | 5,899 | 38.072848 | 134 | py |
PB-DFS | PB-DFS-master/GG-GCN/train_baselines.py | import pickle
import sys
import os
# sys.path.append( f'{os.path.dirname(os.path.realpath(__file__))}/../')
import argparse
import numpy as np
import pathlib
import shutil
import warnings
warnings.filterwarnings("ignore")
from utils import log, load_samples, calc_classification_metrics
from sklearn.linear_model import ... | 2,368 | 30.171053 | 81 | py |
PB-DFS | PB-DFS-master/GG-GCN/train_gcn.py | import sys
import os
sys.path.append( f'{os.path.dirname(os.path.realpath(__file__))}/gcn')
from os.path import expanduser
import time
import scipy.io as sio
import numpy as np
from copy import deepcopy
import scipy.sparse as sp
import sklearn.metrics as metrics
from utils import *
from models import GCN_DEEP_DIVER
imp... | 6,169 | 37.322981 | 134 | py |
PB-DFS | PB-DFS-master/GG-GCN/utils.py | import numpy as np
import pickle
import networkx as nx
import scipy.sparse as sp
from scipy.sparse.linalg.eigen.arpack import eigsh, eigs
import sys
import datetime
import scipy.io as sio
import sklearn.metrics as sk_metrics
import gzip
import math
# import pyscipopt as scip
import time
def parse_index_file(filename):
... | 21,805 | 36.022071 | 179 | py |
PB-DFS | PB-DFS-master/GG-GCN/gcn/inits.py | import tensorflow.compat.v1 as tf
import numpy as np
def uniform(shape, scale=0.05, name=None):
"""Uniform init."""
initial = tf.random_uniform(shape, minval=-scale, maxval=scale, dtype=tf.float32)
return tf.Variable(initial, name=name)
def glorot(shape, name=None):
"""Glorot & Bengio (AISTATS 2010)... | 801 | 28.703704 | 95 | py |
PB-DFS | PB-DFS-master/GG-GCN/gcn/layers.py | from inits import *
import tensorflow.compat.v1 as tf
flags = tf.app.flags
FLAGS = flags.FLAGS
# global unique layer ID dictionary for layer name assignment
_LAYER_UIDS = {}
def get_layer_uid(layer_name=''):
"""Helper function, assigns unique layer IDs."""
if layer_name not in _LAYER_UIDS:
_LAYER_UI... | 5,917 | 30.312169 | 92 | py |
PB-DFS | PB-DFS-master/GG-GCN/gcn/metrics.py | import tensorflow.compat.v1 as tf
def my_softmax_cross_entropy(preds, labels):
"""Softmax cross-entropy loss with masking."""
loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, labels=labels)
return tf.reduce_mean(loss)
def my_accuracy(preds, labels):
"""Accuracy with masking."""
correc... | 1,153 | 33.969697 | 79 | py |
PB-DFS | PB-DFS-master/GG-GCN/gcn/models.py | from layers import *
from metrics import *
from layers import _LAYER_UIDS
flags = tf.app.flags
FLAGS = flags.FLAGS
def lrelu(x):
return tf.maximum(x*0.2,x)
class Model(object):
def __init__(self, **kwargs):
allowed_kwargs = {'name', 'logging'}
for kwarg in kwargs.keys():
assert kw... | 9,002 | 38.660793 | 189 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/.landscape.yml | doc-warnings: true
test-warnings: true
ignore-paths:
- examples/unfinished
- src/pyscipopt/__init__.py
python-targets:
- 2
- 3
| 135 | 14.111111 | 29 | yml |
PB-DFS | PB-DFS-master/PySCIPOpt/.travis.yml | os: linux
dist: xenial
sudo: true
language: python
matrix:
include:
- python: 2.7
- python: 3.5
- python: 3.6
- python: 3.7
env: TRAVIS_BUILD_DOCS=$TRAVIS_TAG
addons:
apt:
packages:
- doxygen
- graphviz
env:
global:
- secure: "CML6W6GUTFcZ... | 2,813 | 43.666667 | 700 | yml |
PB-DFS | PB-DFS-master/PySCIPOpt/CONTRIBUTING.md | Contributing to PySCIPOpt
=========================
Code contributions are very welcome and should comply to a few rules:
0. Read Design principles of PySCIPOpt\_.
1. Compatibility with both Python-2 and Python-3.
2. All tests defined in the Continuous Integration setup need to pass:
- [.travis.yml](../../.t... | 3,362 | 42.115385 | 93 | md |
PB-DFS | PB-DFS-master/PySCIPOpt/INSTALL.md | Requirements
============
PySCIPOpt requires a working installation of the [SCIP Optimization
Suite](http://scip.zib.de/). If SCIP is not installed in the global path
you need to specify the install location using the environment variable
`SCIPOPTDIR`:
- on Linux and OS X:\
`export SCIPOPTDIR=<path_to_install_d... | 3,161 | 29.699029 | 77 | md |
PB-DFS | PB-DFS-master/PySCIPOpt/README.md | PySCIPOpt
=========
This project provides an interface from Python to the [SCIP Optimization
Suite](http://scip.zib.de).
[](https://gitter.im/PySCIPOpt/Lobby)
[](https://pypi.python.org/pypi/pyscipopt)
... | 5,331 | 33.623377 | 170 | md |
PB-DFS | PB-DFS-master/PySCIPOpt/appveyor.yml | version: '{build}'
environment:
SCIPOPTDIR: C:\scipoptdir
pypipw:
secure: HEa8MAJyyfSv33snyK3Gleflk9SIfZBxbnTiS39hlWM=
optipw:
secure: mi/mkS8vYK1Yza0A1FB4/Q==
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
PYTHON: C:\Python27-x64
PIP: C:\Python27-x64\Scripts\pip
PYTES... | 1,997 | 34.052632 | 113 | yml |
PB-DFS | PB-DFS-master/PySCIPOpt/generate-docs.sh | #!/bin/bash
# get repo info
GH_REPO_ORG=`echo $TRAVIS_REPO_SLUG | cut -d "/" -f 1`
GH_REPO_NAME=`echo $TRAVIS_REPO_SLUG | cut -d "/" -f 2`
GH_REPO_REF="github.com/$GH_REPO_ORG/$GH_REPO_NAME.git"
#get SCIP TAGFILE
echo "Downloading SCIP tagfile to create links to SCIP docu"
wget -q -O docs/scip.tag https://scip.zib.de... | 1,445 | 32.627907 | 111 | sh |
PB-DFS | PB-DFS-master/PySCIPOpt/setup.py | from setuptools import setup, Extension
import numpy
import os, platform, sys, re
# look for environment variable that specifies path to SCIP Opt lib and headers
scipoptdir = os.environ.get('SCIPOPTDIR', '').strip('"')
includedir = os.path.abspath(os.path.join(scipoptdir, 'include'))
libdir = os.path.abspath(os.path.j... | 2,899 | 33.52381 | 81 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/VC9-include/stdint.h | // ISO C9x compliant stdint.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006-2008 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following condit... | 7,728 | 30.165323 | 122 | h |
PB-DFS | PB-DFS-master/PySCIPOpt/docs/customdoxygen.css | /* The standard CSS for doxygen 1.8.11 */
body, table, div, p, dl {
font: 400 14px/22px Roboto,sans-serif;
}
/* @group Heading Levels */
h1.groupheader {
font-size: 150%;
}
.title {
font: 400 14px/28px Roboto,sans-serif;
font-size: 150%;
font-weight: bold;
margin: 10px 2px;
}
h2.groupheader {
border-bottom:... | 25,871 | 16.528455 | 111 | css |
PB-DFS | PB-DFS-master/PySCIPOpt/docs/footer.html | <!-- HTML footer for doxygen 1.8.11-->
<!-- start footer part -->
<!--BEGIN GENERATE_TREEVIEW-->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
$navpath
<li class="footer">$generatedby
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="$relpath^... | 716 | 31.590909 | 92 | html |
PB-DFS | PB-DFS-master/PySCIPOpt/docs/header.html | <!-- HTML header for doxygen 1.8.11-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" cont... | 1,993 | 34.607143 | 121 | html |
PB-DFS | PB-DFS-master/PySCIPOpt/docs/maindoc.py | ##@file maindoc.py
#@brief Main documentation page
## @mainpage Overview
#
# This project provides an interface from Python to the [SCIP Optimization Suite](http://scip.zib.de). <br>
#
# See the [web site] (https://github.com/SCIP-Interfaces/PySCIPOpt) to download PySCIPOpt.
#
# @section Installation
# See [INSTALL.m... | 2,177 | 41.705882 | 142 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/atsp.py | ##@file atsp.py
#@brief solve the asymmetric traveling salesman problem
"""
formulations implemented:
- mtz -- Miller-Tucker-Zemlin's potential formulation
- mtz_strong -- Miller-Tucker-Zemlin's potential formulation with stronger constraint
- scf -- single-commodity flow formulation
- mcf -- multi-co... | 8,763 | 31.579926 | 105 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/bpp.py | ##@file bpp.py
#@brief use SCIP for solving the bin packing problem.
"""
The instance of the bin packing problem is represented by the two
lists of n items of sizes and quantity s=(s_i).
The bin size is B.
We use Martello and Toth (1990) formulation, and suggest
extensions with tie-breaking and SOS constraints.
Copy... | 3,682 | 25.883212 | 87 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/diet.py | ##@file diet.py
#@brief model for the modern diet problem
"""
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
# todo: can we make it work as "from pyscipopt import *"?
from pyscipopt import Model, quicksum, multidict
def diet(F,N,a,b,c,d):
"""diet -- model for the modern diet problem
Parameters:
... | 3,848 | 35.657143 | 129 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/eoq_en.py | ##@file eoq_en.py
#@brief piecewise linear model to the multi-item economic ordering quantity problem.
"""
Approach: use a convex combination formulation.
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
from pyscipopt import Model, quicksum, multidict
def eoq(I,F,h,d,w,W,a0,aK,K):
"""eoq -- multi-it... | 2,399 | 30.168831 | 93 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/even.py | ##@file finished/even.py
#@brief model to decide whether argument is even or odd
################################################################################
#
# EVEN OR ODD?
#
# If a positional argument is given:
# prints if the argument is even/odd/neither
# else:
# prints if a value is even/odd/neither pe... | 2,543 | 31.615385 | 112 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/flp-benders.py | ##@file flp-benders.py
#@brief model for solving the capacitated facility location problem using Benders' decomposition
"""
minimize the total (weighted) travel cost from n customers
to some facilities with fixed costs and capacities.
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
from pyscipopt import M... | 4,087 | 30.689922 | 96 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/flp.py | ##@file flp.py
#@brief model for solving the capacitated facility location problem
"""
minimize the total (weighted) travel cost from n customers
to some facilities with fixed costs and capacities.
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
from pyscipopt import Model, quicksum, multidict
def flp(I,... | 3,029 | 29.918367 | 89 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/gcp.py | ##@file gcp.py
#@brief model for the graph coloring problem
"""
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
from pyscipopt import Model, quicksum, multidict
def gcp(V,E,K):
"""gcp -- model for minimizing the number of colors in a graph
Parameters:
- V: set/list of nodes in the graph
... | 5,046 | 29.77439 | 113 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/gcp_fixed_k.py | ##@file gcp_fixed_k.py
#@brief solve the graph coloring problem with fixed-k model
"""
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
from pyscipopt import Model, quicksum, multidict
def gcp_fixed_k(V,E,K):
"""gcp_fixed_k -- model for minimizing number of bad edges in coloring a graph
Parameters... | 2,648 | 27.483871 | 87 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/gpp.py | ##@file gpp.py
#@brief model for the graph partitioning problem
"""
Copyright (c) by Joao Pedro PEDROSO, Masahiro MURAMATSU and Mikio KUBO, 2012
"""
from pyscipopt import Model, quicksum, multidict
def gpp(V,E):
"""gpp -- model for the graph partitioning problem
Parameters:
- V: set/list of nodes in t... | 5,610 | 30.172222 | 106 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/kmedian.py | ##@file kmedian.py
#@brief model for solving the k-median problem.
"""
minimize the total (weighted) travel cost for servicing
a set of customers from k facilities.
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
import math
import random
from pyscipopt import Model, quicksum, multidict
def kmedian(I,J,c... | 3,491 | 29.902655 | 96 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/lo_wines.py | ##@file lo_wines.py
#@brief Simple SCIP example of linear programming.
"""
It solves the same instance as lo_wines_simple.py:
maximize 15x + 18y + 30z
subject to 2x + y + z <= 60
x + 2y + z <= 60
z <= 30
x,y,z >= 0
Variables correspond to the production of three t... | 1,822 | 25.42029 | 99 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/logical.py | ##@file finished/logical.py
#@brief Tutorial example on how to use AND/OR/XOR constraints
from pyscipopt import Model
from pyscipopt import quicksum
"""
AND/OR/XOR CONSTRAINTS
Tutorial example on how to use AND/OR/XOR constraints.
N.B.: standard SCIP XOR constraint works differently from AND/OR by design.
The ... | 2,064 | 23.879518 | 76 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/lotsizing_lazy.py | ##@file lotsizing_lazy.py
#@brief solve the single-item lot-sizing problem.
"""
Approaches:
- sils: solve the problem using the standard formulation
- sils_cut: solve the problem using cutting planes
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
from pyscipopt import Model, Conshdlr, quicksum, m... | 5,578 | 33.226994 | 132 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/markowitz_soco.py | ##@file markowitz_soco.py
#@brief simple markowitz model for portfolio optimization.
"""
Approach: use second-order cone optimization.
Copyright (c) by Joao Pedro PEDROSO, Masahiro MURAMATSU and Mikio KUBO, 2012
"""
from pyscipopt import Model, quicksum, multidict
def markowitz(I,sigma,r,alpha):
"""markowitz -- s... | 1,733 | 27.42623 | 118 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/mctransp.py | ##@file mctransp.py
#@brief a model for the multi-commodity transportation problem
"""
Model for solving the multi-commodity transportation problem:
minimize the total transportation cost for satisfying demand at
customers, from capacitated facilities.
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
from... | 4,759 | 31.380952 | 110 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/mkp.py | ##@file mkp.py
#@brief model for the multi-constrained knapsack problem
"""
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
from pyscipopt import Model, quicksum, multidict
def mkp(I,J,v,a,b):
"""mkp -- model for solving the multi-constrained knapsack
Parameters:
- I: set of dimensions
... | 1,482 | 23.716667 | 81 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/pfs.py | ##@file pfs.py
#@brief model for the permutation flow shop problem
"""
Use a position index formulation for modeling the permutation flow
shop problem, with the objective of minimizing the makespan (maximum
completion time).
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
import math
import random
from py... | 3,052 | 27.53271 | 91 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/piecewise.py | ##@file piecewise.py
#@brief several approaches for solving problems with piecewise linear functions.
"""
Approaches:
- mult_selection: multiple selection model
- convex_comb_sos: model with SOS2 constraints
- convex_comb_dis: convex combination with binary variables (disaggregated model)
- convex_comb_... | 11,608 | 37.1875 | 106 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/prodmix_soco.py | ##@file prodmix_soco.py
#@brief product mix model using soco.
"""
Copyright (c) by Joao Pedro PEDROSO, Masahiro MURAMATSU and Mikio KUBO, 2012
"""
from pyscipopt import Model, quicksum, multidict
def prodmix(I,K,a,p,epsilon,LB):
"""prodmix: robust production planning using soco
Parameters:
I - set of ... | 1,680 | 27.491525 | 86 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/rcs.py | ##@file rcs.py
#@brief model for the resource constrained scheduling problem
"""
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
from pyscipopt import Model, quicksum, multidict
def rcs(J,P,R,T,p,c,a,RUB):
"""rcs -- model for the resource constrained scheduling problem
Parameters:
- J: set... | 3,840 | 29.484127 | 109 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/read_tsplib.py | ##@file read_tsplib.py
#@brief read standard instances of the traveling salesman problem
"""
Functions provided:
* read_tsplib - read a symmetric tsp instance
* read_atsplib - asymmetric
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
import gzip
import math
def distL2(x1,y1,x2,y2):
... | 7,764 | 26.055749 | 85 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/ssa.py | ##@file ssa.py
#@brief multi-stage (serial) safety stock allocation model
"""
Approach: use SOS2 constraints for modeling non-linear functions.
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
from pyscipopt import Model, quicksum, multidict
import math
import random
from piecewise import convex_comb_sos
... | 2,828 | 28.164948 | 88 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/ssp.py | ##@file ssp.py
#@brief model for the stable set problem
"""
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
from pyscipopt import Model, quicksum, multidict
def ssp(V,E):
"""ssp -- model for the stable set problem
Parameters:
- V: set/list of nodes in the graph
- E: set/list of ed... | 1,346 | 23.490909 | 77 | py |
PB-DFS | PB-DFS-master/PySCIPOpt/examples/finished/sudoku.py | ##@file sudoku.py
#@brief Simple example of modeling a Sudoku as a binary program
#!/usr/bin/env python
from pyscipopt import Model, quicksum
# initial Sudoku values
init = [5, 3, 0, 0, 7, 0, 0, 0, 0,
6, 0, 0, 1, 9, 5, 0, 0, 0,
0, 9, 8, 0, 0, 0, 0, 6, 0,
8, 0, 0, 0, 6, 0, 0, 0, 3,
4, ... | 1,802 | 25.514706 | 96 | py |