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
PB-DFS
PB-DFS-master/PySCIPOpt/examples/finished/transp.py
##@file transp.py #@brief a model for the transportation problem """ Model for solving a 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 pyscipopt import Model, quicksum, mu...
2,515
27.590909
104
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/finished/transp_nofn.py
##@file transp_nofn.py #@brief a model for the transportation problem """ Model for solving a transportation problem: minimize the total transportation cost for satisfying demand at customers, from capacitated facilities. Data: I - set of customers J - set of facilities c[i,j] - unit transportation cost on...
1,527
23.645161
100
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/finished/tsp.py
##@file tsp.py #@brief solve the traveling salesman problem """ minimize the travel cost for visiting n customers exactly once approach: - start with assignment model - add cuts until there are no sub-cycles - two cutting plane possibilities (called inside "solve_tsp"): - addcut: limit the number of...
4,147
29.725926
97
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/finished/weber_soco.py
##@file weber_soco.py #@brief model for solving the weber problem using soco. """ Copyright (c) by Joao Pedro PEDROSO, Masahiro MURAMATSU and Mikio KUBO, 2012 """ from pyscipopt import Model, quicksum, multidict def weber(I,x,y,w): """weber: model for solving the single source weber problem using soco. Paramet...
5,924
31.554945
109
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/tutorial/even.py
##@file tutorial/even.py #@brief Tutorial example to check whether values are even or odd """ Public Domain, WTFNMFPL Public Licence """ from pyscipopt import Model from pprint import pformat as pfmt example_values = [ 0, 1, 1.5, "helloworld", 20, ...
3,583
29.632479
79
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/tutorial/logical.py
##@file tutorial/logical.py #@brief Tutorial example on how to use AND/OR/XOR constraints. """ N.B.: standard SCIP XOR constraint works differently from AND/OR by design. The constraint is set with a boolean rhs instead of an integer resultant. cf. http://listserv.zib.de/pipermail/scip/2018-May/003392.html A workaround...
2,686
30.244186
75
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/tutorial/puzzle.py
##@file tutorial/puzzle.py #@brief solve a simple puzzle using SCIP """ On a beach there are octopuses, turtles and cranes. The total number of legs of all animals is 80, while the number of heads is 32. What are the minimum numbers of turtles and octopuses, respectively? Copyright (c) by Joao Pedro PEDROSO and Mikio ...
967
28.333333
91
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/cutstock.py
#todo relax function needed """ cutstock.py: use SCIP for solving the cutting stock problem. The instance of the cutting stock problem is represented by the two lists of m items of size w=(w_i) and and quantity q=(q_i). The roll size is B. Given packing patterns t_1, ...,t_k,...t_K where t_k is a vector of the numb...
6,000
28.561576
95
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/diet_std.py
""" diet.py: model for the modern diet problem Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012 """ from pyscipopt import Model, quicksum, multidict def diet(F,N,a,b,c,d): """diet -- model for the modern diet problem Parameters: F - set of foods N - set of nutrients a[i] - mini...
3,753
33.440367
85
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/eld.py
""" eld.py: economic load dispatching in electricity generation Approach: use an 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 def cost(...
8,669
40.090047
83
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/eoq_soco.py
""" eoq_soco.py: model to the multi-item economic ordering quantity problem. 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 eoq_soco(I,F,h,d,w,W): """eoq_soco -- multi-item capac...
1,616
26.87931
86
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/flp_nonlinear.py
# todo """ flp_nonlinear.py: piecewise linear model for the capacitated facility location problem minimize the total (weighted) travel cost from n customers to a given set of facilities, with fixed costs and limited capacities; costs are nonlinear (square root of the total quantity serviced by a facility). Approache...
19,258
32.262522
106
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/flp_nonlinear_soco.py
# todo """ flp_nonlinear.py: soco approach to the capacitated facility location problem minimize the total (weighted) travel cost from n customers to a given set of facilities, with fixed costs and limited capacities; costs are nonlinear (square root of the total quantity serviced by a facility). Approach: use a sec...
4,919
30.33758
99
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/kcenter.py
""" kcenter.py: model for solving the k-center problem. select k facility positions such that the maximum distance of each vertex in the graph to a facility is minimum Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012 """ from pyscipopt import Model, quicksum, multidict def kcenter(I,J,c,k): """kcenter -...
3,449
29.263158
96
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/kcenter_binary_search.py
""" kcenter_binary_search.py: use bisection for solving the k-center problem bisects the interval [0, max facility-customer distance] until finding a distance such that all customers are covered, but decreasing that distance by a small amount delta would leave some uncovered. Copyright (c) by Joao Pedro PEDROSO and ...
4,857
30.141026
96
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/lotsizing.py
""" lotsizing.py: solve the multi-item lot-sizing problem. Approaches: - mils: solve the problem using the standard formulation - mils_fl: solve the problem using the facility location (tighten) formulation Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012 """ import random from pyscipopt import Model...
12,056
36.444099
110
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/lotsizing_cut.py
""" lotsizing_cut.py: 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, quicksum, multidict def sils(T,f,c...
3,915
28.223881
126
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/lotsizing_echelon.py
""" lotsizing.py: solve the multi-item, multi-stage lot-sizing problem. Approaches: - mils_standard: standard formulation - mils_echelon: echelon formulation Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012 """ import random from pyscipopt import Model, quicksum, multidict def mils_standard(T,K,P,f,...
15,109
32.135965
157
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/mctransp_tuplelist.py
""" transp.py: 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. Use tuplelist for selecting arcs. Copyright (c) by Joao Pedro PEDROSO and Mikio K...
3,806
30.46281
111
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/pareto_front.py
""" pareto_front.py: tools for building a pareto front in multi-objective optimization Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012 """ def dominates(a,b): dominating = False for i in range(len(a)): if a[i] > b[i]: return False if a[i] < b[i]: dominating = ...
1,143
21.88
83
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/portfolio_soco.py
""" portfolio_soco.py: modified 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 import math def phi_inv(p): """phi_inv: inverse of gaussian ...
2,434
27.988095
106
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/read_tsplib.py
""" tsp.py: 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): """Compute the L2-no...
7,667
25.811189
85
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/scheduling.py
""" scheduling.py: solve the one machine scheduling problem. approaches: - linear ordering formulation - time-index formulation - disjunctive formulation - heuristics using cutting plane Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012 """ from pyscipopt import Model, quicksum, multidict def...
9,424
28.270186
106
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/staff_sched.py
""" staff_sched.py: model for staff scheduling Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012 """ import random from pyscipopt import Model, quicksum, multidict def staff(I,T,N,J,S,c,b): """ staff: staff scheduling Parameters: - I: set of members in the staff - T: number of peri...
5,242
32.825806
102
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/staff_sched_mo.py
""" staff_sched_mo.py: multiobjective model for staff scheduling Objectives: - minimize cost - minimize uncovered shifts Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012 """ import random from pyscipopt import Model, quicksum, multidict def staff_mo(I,T,N,J,S,c,b): """ staff: staff schedulin...
5,790
31.172222
103
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/tsp_flow.py
""" tsp_flow.py: solve the traveling salesman problem using flow formulation minimize the travel cost for visiting n customers exactly once approach: - start with assignment model - check flow from a source to every other node; - if no flow, a sub-cycle has been found --> add cut - otherwise, the...
5,113
29.082353
145
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/tsp_lazy.py
""" tsp.py: solve the traveling salesman problem minimize the travel cost for visiting n customers exactly once approach: - start with assignment model - add cuts until there are no sub-cycles Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012 """ import math import random import networkx from pyscipop...
4,435
30.239437
116
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/tsp_mo.py
""" tsp-mp.py: solve the multi-objective traveling salesman problem Approaches: - segmentation - ideal point - scalarization Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012 """ import math import random from pyscipopt import Model, quicksum, multidict def optimize(model,cand): """optimize:...
10,031
30.54717
95
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/tsptw.py
""" tsptw.py: solve the asymmetric traveling salesman problem with time window constraints minimize the travel cost for visiting n customers exactly once; each customer has a time window within which the salesman must visit him formulations based on Miller-Tucker-Zemlin's formulation, for the atsp; one- and two-index...
7,537
31.491379
106
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/vrp.py
""" vrp.py: solve the vehicle routing problem. approach: - start with assignment model - add cuts until all components of the graph are connected Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012 """ import math import random import networkx from pyscipopt import Model, quicksum, multidict def solve_...
3,456
29.866071
97
py
PB-DFS
PB-DFS-master/PySCIPOpt/examples/unfinished/vrp_lazy.py
""" vrp.py: model for the vehicle routing problem using callback for adding cuts. approach: - start with assignment model - add cuts until all components of the graph are connected Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012 """ import math import random import networkx from pyscipopt import Mod...
4,744
33.136691
116
py
PB-DFS
PB-DFS-master/PySCIPOpt/src/pyscipopt/Multidict.py
##@file Multidict.py #@brief Implementation of Multidictionaries def multidict(D): '''creates a multidictionary''' keys = list(D.keys()) if len(keys) == 0: return [[]] try: N = len(D[keys[0]]) islist = True except: N = 1 islist = False dlist = [dict() for ...
511
22.272727
43
py
PB-DFS
PB-DFS-master/PySCIPOpt/src/pyscipopt/__init__.py
__version__ = '2.1.5' # export user-relevant objects: from pyscipopt.Multidict import multidict from pyscipopt.scip import Model from pyscipopt.scip import Benders from pyscipopt.scip import Benderscut from pyscipopt.scip import Branchrule from pyscipopt.scip import Nodesel from pyscipopt.scip...
1,701
46.277778
79
py
PB-DFS
PB-DFS-master/PySCIPOpt/src/pyscipopt/scip.c
/* Generated by Cython 0.29.24 */ /* BEGIN: Cython Metadata { "distutils": { "depends": [ "/home/joey/py-venv-test/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h", "/home/joey/py-venv-test/lib/python3.6/site-packages/numpy/core/include/numpy/npy_math.h", ...
8,771,017
44.361078
1,743
c
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_alldiff.py
import pytest networkx = pytest.importorskip("networkx") from pyscipopt import Model, Conshdlr, SCIP_RESULT, SCIP_PARAMEMPHASIS, SCIP_PARAMSETTING try: from types import SimpleNamespace except: class SimpleNamespace: def __init__(self, **kwargs): self.__dict__.update(kwargs) def ...
12,268
39.094771
139
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_benders.py
""" flp-benders.py: 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 Model, quicksu...
3,451
29.280702
105
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_branch_probing_lp.py
from pyscipopt import Model, Branchrule, SCIP_RESULT, quicksum class MyBranching(Branchrule): def __init__(self, model, cont): self.model = model self.cont = cont self.count = 0 self.was_called_val = False self.was_called_int = False def branchexeclp(self, allowaddcon...
2,957
29.494845
105
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_conshdlr.py
from pyscipopt import Model, Conshdlr, SCIP_RESULT, SCIP_PRESOLTIMING, SCIP_PROPTIMING from sys import version_info if version_info >= (3, 3): from types import SimpleNamespace else: class SimpleNamespace: def __init__(self, **kwargs): self.__dict__.update(kwargs) def __repr__(self...
7,831
29.59375
115
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_copy.py
from pyscipopt import Model def test_copy(): # create solver instance s = Model() # add some variables x = s.addVar("x", vtype = 'C', obj = 1.0) y = s.addVar("y", vtype = 'C', obj = 2.0) s.setObjective(4.0 * y, clear = False) c = s.addCons(x + 2 * y >= 1.0) s2 = Model(sourceModel=s) ...
465
18.416667
45
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_event.py
import pytest from pyscipopt import Model, Eventhdlr, SCIP_RESULT, SCIP_EVENTTYPE, SCIP_PARAMSETTING calls = [] class MyEvent(Eventhdlr): def eventinit(self): calls.append('eventinit') self.model.catchEvent(SCIP_EVENTTYPE.FIRSTLPSOLVED, self) def eventexit(self): calls.append('event...
1,270
22.537037
99
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_expr.py
import pytest from pyscipopt import Model, sqrt, log, exp from pyscipopt.scip import Expr, GenExpr, ExprCons, Term, quicksum @pytest.fixture(scope="module") def model(): m = Model() x = m.addVar("x") y = m.addVar("y") z = m.addVar("z") return m, x, y, z CONST = Term() def test_upgrade(model): ...
5,031
27.590909
101
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_gomory.py
import pytest from pyscipopt import Model, Sepa, SCIP_RESULT, SCIP_PARAMSETTING from pyscipopt.scip import is_memory_freed class GMI(Sepa): def __init__(self): self.ncuts = 0 def getGMIFromRow(self, cols, rows, binvrow, binvarow, primsol): """ Given the row (binvarow, binvrow) of the tableau...
15,199
42.930636
136
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_heur.py
import gc import weakref import pytest from pyscipopt import Model, Heur, SCIP_RESULT, SCIP_PARAMSETTING, SCIP_HEURTIMING from pyscipopt.scip import is_memory_freed from util import is_optimized_mode class MyHeur(Heur): def heurexec(self, heurtiming, nodeinfeasible): sol = self.model.createSol(self) ...
1,670
23.573529
128
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_knapsack.py
from pyscipopt import Model, quicksum def test_knapsack(): # create solver instance s = Model("Knapsack") s.hideOutput() # setting the objective sense to maximise s.setMaximize() # item weights weights = [4, 2, 6, 3, 7, 5] # item costs costs = [7, 2, 5, 4, 3, 4] assert len(we...
1,417
26.269231
96
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_linexpr.py
import pytest from pyscipopt import Model from pyscipopt.scip import Expr, ExprCons, Term, quicksum @pytest.fixture(scope="module") def model(): m = Model() x = m.addVar("x") y = m.addVar("y") z = m.addVar("z") return m, x, y, z CONST = Term() def test_term(model): m, x, y, z = model ass...
5,534
23.709821
68
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_logical.py
from pyscipopt import Model from pyscipopt import quicksum try: import pytest itertools = pytest.importorskip("itertools") except ImportError: import itertools product = itertools.product # Testing AND/OR/XOR constraints # check whether any error is raised # see http://scip.zib.de/doc-5.0.1/html/cons__...
5,697
32.715976
131
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_lp.py
from pyscipopt import LP def test_lp(): # create LP instance, minimizing by default myLP = LP() # create cols w/o coefficients, 0 objective coefficient and 0,\infty bounds myLP.addCols(2 * [[]]) # create rows myLP.addRow(entries = [(0,1),(1,2)] ,lhs = 5) lhs, rhs = myLP.getSides() ass...
556
20.423077
79
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_memory.py
import pytest from pyscipopt.scip import Model, is_memory_freed from util import is_optimized_mode def test_not_freed(): if is_optimized_mode(): pytest.skip() m = Model() assert not is_memory_freed() def test_freed(): if is_optimized_mode(): pytest.skip() m = Model() del m as...
409
18.52381
49
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_model.py
from pyscipopt import Model def test_model(): # create solver instance s = Model() # add some variables x = s.addVar("x", vtype = 'C', obj = 1.0) y = s.addVar("y", vtype = 'C', obj = 2.0) assert x.getObj() == 1.0 assert y.getObj() == 2.0 s.setObjective(4.0 * y + 10.5, clear = False) ...
1,424
22.360656
52
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_nonlinear.py
import pytest from pyscipopt import Model, quicksum, sqrt # test string with polynomial formulation (uses only Expr) def test_string_poly(): PI = 3.141592653589793238462643 NWIRES = 11 DIAMETERS = [0.207, 0.225, 0.244, 0.263, 0.283, 0.307, 0.331, 0.362, 0.394, 0.4375, 0.500] PRELOAD = 300.0 MAXWOR...
11,399
38.721254
154
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_pricer.py
from pyscipopt import Model, Pricer, SCIP_RESULT, SCIP_PARAMSETTING, quicksum class CutPricer(Pricer): # The reduced cost function for the variable pricer def pricerredcost(self): # Retrieving the dual solutions dualSolutions = [] for i, c in enumerate(self.data['cons']): ...
5,049
32.892617
116
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_quadcons.py
from pyscipopt import Model def test_niceqp(): s = Model() x = s.addVar("x") y = s.addVar("y") s.addCons(x >= 2) s.addCons(x*x <= y) s.setObjective(y, sense='minimize') s.optimize() assert round(s.getVal(x)) == 2.0 assert round(s.getVal(y)) == 4.0 def test_niceqcqp(): s = Mo...
604
17.333333
43
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_quickprod.py
from pyscipopt import Model, quickprod from pyscipopt.scip import CONST from operator import mul import functools def test_quickprod_model(): m = Model("quickprod") x = m.addVar("x") y = m.addVar("y") z = m.addVar("z") c = 2.3 q = quickprod([x,y,z,c]) == 0.0 s = functools.reduce(mul,[x,y,z...
1,147
25.697674
63
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_quicksum.py
from pyscipopt import Model, quicksum from pyscipopt.scip import CONST def test_quicksum_model(): m = Model("quicksum") x = m.addVar("x") y = m.addVar("y") z = m.addVar("z") c = 2.3 q = quicksum([x,y,z,c]) == 0.0 s = sum([x,y,z,c]) == 0.0 assert(q.expr.terms == s.expr.terms) def...
1,099
25.829268
63
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_relax.py
from pyscipopt import Model from pyscipopt.scip import Relax calls = [] class SoncRelax(Relax): def relaxexec(self): calls.append('relaxexec') def test_relax(): m = Model() m.hideOutput() #include relaxator m.includeRelax(SoncRelax(),'testrelaxator','Test that relaxator gets incl...
767
20.333333
83
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_short.py
from pyscipopt import Model import pytest import os # This test requires a directory link in tests/ to check/ in the main SCIP directory. testset = [] primalsolutions = {} dualsolutions = {} tolerance = 1e-5 infinity = 1e20 testsetpath = 'check/testset/short.test' solufilepath = 'check/testset/short.solu' if not al...
2,667
28.644444
85
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_tsp.py
from pyscipopt import Model, Conshdlr, quicksum, SCIP_RESULT import pytest itertools = pytest.importorskip("itertools") networkx = pytest.importorskip("networkx") EPS = 1.e-6 # subtour elimination constraint handler class TSPconshdlr(Conshdlr): def __init__(self, variables): self.variables = variables...
3,707
30.159664
99
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/test_variablebounds.py
from pyscipopt import Model m = Model() x0 = m.addVar(lb=-5, ub=8) r1 = m.addVar() r2 = m.addVar() y0 = m.addVar(lb=3) t = m.addVar(lb=None) z = m.addVar() m.chgVarLbGlobal(x0, -2) m.chgVarUbGlobal(x0, 4) infeas, tightened = m.tightenVarLb(x0, -5) assert not infeas assert not tightened infeas, tightened = m.tighte...
899
17.367347
48
py
PB-DFS
PB-DFS-master/PySCIPOpt/tests/util.py
from pyscipopt.scip import Model, is_memory_freed def is_optimized_mode(): s = Model() return is_memory_freed()
123
14.5
49
py
PB-DFS
PB-DFS-master/TRIG-GCN/config.py
import argparse parser = argparse.ArgumentParser() parser.add_argument( 'problem', choices=['mis', 'ca', 'ds', 'vc'], ) parser.add_argument('--learning_rate', default=0.01) parser.add_argument('--epochs', default=200) parser.add_argument('--hidden1', default=64) parser.add_argument('--dropout', default=0) pa...
544
29.277778
52
py
PB-DFS
PB-DFS-master/TRIG-GCN/inits.py
import tensorflow 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) init.""" ...
791
28.333333
95
py
PB-DFS
PB-DFS-master/TRIG-GCN/layers.py
from inits import * import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers from config import args keras.backend.set_floatx('float32') import sys, os # global unique layer ID dictionary for layer name assignment _LAYER_UIDS = {} def get_layer_uid(layer_name=''): ""...
7,122
41.147929
152
py
PB-DFS
PB-DFS-master/TRIG-GCN/metrics.py
import tensorflow as tf def masked_softmax_cross_entropy(preds, labels, mask): """ Softmax cross-entropy loss with masking. """ loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, labels=labels) mask = tf.cast(mask, dtype=tf.float32) mask /= tf.reduce_mean(mask) loss *= mask r...
711
27.48
79
py
PB-DFS
PB-DFS-master/TRIG-GCN/models.py
import tensorflow as tf from tensorflow import keras from layers import * from metrics import * from config import args class GCN(keras.Model): def __init__(self, output_dim, **kwargs): super(GCN, self).__init__(**kwargs) self.output_dim = output_dim self.col_feats_dim = 57 ...
3,032
37.884615
98
py
PB-DFS
PB-DFS-master/TRIG-GCN/test.py
import time, sys, os from utils import * from models import GCN from config import args import scipy.io as sio import numpy as np from copy import deepcopy import scipy.sparse as sp import sklearn.metrics as metrics from os.path import expanduser import gzip import pickle import pathlib import tensorflow as ...
2,959
34.662651
99
py
PB-DFS
PB-DFS-master/TRIG-GCN/train.py
import time, sys, os from utils import * from models import GCN from config import args import scipy.io as sio import numpy as np from copy import deepcopy import scipy.sparse as sp import sklearn.metrics as metrics from os.path import expanduser import gzip import pickle import pathlib import tensorflow as ...
3,691
33.504673
102
py
PB-DFS
PB-DFS-master/TRIG-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 def parse_index_file(filename): """Parse index file.""" index ...
9,448
37.884774
179
py
PB-DFS
PB-DFS-master/data_generator/utils.py
import numpy as np import pyscipopt as scip def init_scip_params(model, seed, heuristics=False, presolving=False, separating=False, conflict=True): seed = seed % 2147483648 # SCIP seed range # set up randomization model.setBoolParam('randomization/permutevars', False) model.setIntParam('randomizatio...
2,228
32.268657
103
py
PB-DFS
PB-DFS-master/data_generator/ca/gen_inst_ca.py
import os, sys import argparse import numpy as np import scipy.sparse import scipy.io as sio from itertools import combinations from os.path import expanduser from os import path import re from functools import cmp_to_key import random import gurobipy as gp from gurobipy import * def generate_ca(random, filename, n_it...
9,967
36.473684
145
py
PB-DFS
PB-DFS-master/data_generator/ca/make_sample_ca.py
import os import sys import os sys.path.append( f'{os.path.dirname(os.path.realpath(__file__))}/../') import argparse import multiprocessing as mp import pickle import glob import numpy as np import shutil import gzip from os.path import expanduser import pyscipopt as scip import utils def read_sol_file(filepath): ...
4,648
31.739437
91
py
PB-DFS
PB-DFS-master/data_generator/ds/gen_inst_ds.py
import os, sys import argparse import numpy as np import scipy.sparse import scipy.io as sio from itertools import combinations from os.path import expanduser from os import path import re from functools import cmp_to_key import random import gurobipy as gp from gurobipy import * class Graph: """ Container fo...
5,785
33.035294
107
py
PB-DFS
PB-DFS-master/data_generator/ds/make_sample_ds.py
import os import sys import os sys.path.append( f'{os.path.dirname(os.path.realpath(__file__))}/../') import argparse import multiprocessing as mp import pickle import glob import numpy as np import shutil import gzip from os.path import expanduser import pyscipopt as scip import utils def read_sol_file(filepath): ...
4,623
31.335664
91
py
PB-DFS
PB-DFS-master/data_generator/mis/gen_inst_mis.py
import os, sys import argparse import numpy as np import scipy.sparse import scipy.io as sio from itertools import combinations from os.path import expanduser from os import path import re from functools import cmp_to_key import random class Graph: """ Container for a graph. Parameters ---------- ...
11,085
31.702065
108
py
PB-DFS
PB-DFS-master/data_generator/mis/make_sample_mis.py
import os import sys import os sys.path.append( f'{os.path.dirname(os.path.realpath(__file__))}/../') import argparse import multiprocessing as mp import pickle import glob import numpy as np import shutil import gzip from os.path import expanduser import pyscipopt as scip import utils def read_sol_file(filepath): ...
4,541
31.212766
91
py
PB-DFS
PB-DFS-master/data_generator/vc/gen_inst_vc.py
import os, sys import argparse import numpy as np import scipy.sparse import scipy.io as sio from itertools import combinations from os.path import expanduser from os import path import re from functools import cmp_to_key import random import gurobipy as gp from gurobipy import * class Graph: """ Container fo...
5,666
32.934132
107
py
PB-DFS
PB-DFS-master/data_generator/vc/make_sample_vc.py
import os import sys import os sys.path.append( f'{os.path.dirname(os.path.realpath(__file__))}/../') import argparse import multiprocessing as mp import pickle import glob import numpy as np import shutil import gzip from os.path import expanduser import pyscipopt as scip import utils def read_sol_file(filepath): ...
4,361
31.073529
91
py
PB-DFS
PB-DFS-master/src/branching_ml_dfs.cpp
#include "branching_ml_dfs.hpp" #include "utils.hpp" #include <boost/algorithm/string.hpp> #include <math.h> /** branching rule data */ struct SCIP_BranchruleData { scip::ObjBranchrule *objbranchrule; /**< branching rule object */ SCIP_Bool deleteobject; /**< should the branching rule object be del...
12,352
35.547337
168
cpp
PB-DFS
PB-DFS-master/src/branching_ml_dfs.hpp
#ifndef __SCIP_BRANCH_ML_DFS__ #define __SCIP_BRANCH_ML_DFS__ #include <vector> #include <utility> #include <cassert> #include <unordered_map> #include <chrono> #include <random> #include <stdio.h> #include <algorithm> #include <ctime> #include <string> #include <scip/scip.h> #include <objscip/objscip.h> #include <scip...
2,515
34.942857
139
hpp
PB-DFS
PB-DFS-master/src/branching_policy.cpp
#include "branching_policy.hpp" #include "utils.hpp" #define DEFAULT_REEVALAGE 10LL #define DEFAULT_MAXPROPROUNDS -2 #define DEFAULT_PROBINGBOUNDS TRUE #define SIMPLEX_ITERATION_LIMIT 500 #define DEFAULT_MAXLOOKAHEAD 9 /**< maximal number of further variables evaluated without better score */ #define DEFAULT_INIT...
22,522
36.475874
180
cpp
PB-DFS
PB-DFS-master/src/branching_policy.hpp
#ifndef __SCIP_BRANCH_DYNAMIC_H__ #define __SCIP_BRANCH_DYNAMIC_H__ #include <vector> #include <utility> #include <cassert> #include <unordered_map> #include <chrono> #include <random> #include <stdio.h> #include <algorithm> #include <ctime> #include <string> #include <scip/scip.h> #include <objscip/objscip.h> #inclu...
2,717
32.555556
139
hpp
PB-DFS
PB-DFS-master/src/global_config.cpp
#include "global_config.hpp" #include "utils.hpp" #include <time.h> #include <unistd.h> #include <sys/types.h> #include <pwd.h> #include <scip/struct_scip.h> #include <scip/struct_tree.h> #include <scip/struct_set.h> #include <scip/struct_mem.h> #include <scip/set.h> #include <scip/tree.h> #include <scip/cons_linear.h>...
9,444
33.345455
166
cpp
PB-DFS
PB-DFS-master/src/global_config.hpp
#ifndef __global__conf__ #define __global__conf__ #include <cstdlib> #include <string> #include <pwd.h> #include <unistd.h> #include <fstream> #include <vector> #include <unordered_map> #include <unordered_set> #include <queue> #include <boost/algorithm/string.hpp> #include <scip/type_retcode.h> #include <scip/scip.h>...
2,328
23.260417
111
hpp
PB-DFS
PB-DFS-master/src/heur_ml_subscip.cpp
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* This file is part of the program and library */ /* SCIP --- Solving Constraint Integer Programs */ ...
15,415
40
124
cpp
PB-DFS
PB-DFS-master/src/heur_ml_subscip.hpp
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* This file is part of the program and library */ /* SCIP --- Solving Constraint Integer Programs */ ...
1,795
41.761905
123
hpp
PB-DFS
PB-DFS-master/src/main.cpp
#include "preprocessor.hpp" #include <iostream> #include <time.h> #include <sys/time.h> #include "global_config.hpp" #include "scip_solver.hpp" double get_wall_time(){ struct timeval time; if (gettimeofday(&time,NULL)){ return 0; } return (double)time.tv_sec + (double)time.tv_usec * .000001; } ...
4,615
32.208633
108
cpp
PB-DFS
PB-DFS-master/src/nodesel_ml_dfs.cpp
#include <cassert> #include "nodesel_ml_dfs.hpp" #include "global_config.hpp" #include <scip/type_var.h> #include <scip/struct_var.h> #include <scip/type_tree.h> #include <scip/struct_tree.h> #include <scip/type_lp.h> /** node selector data */ struct SCIP_NodeselData { scip::ObjNodesel* objnodesel; /**< ...
8,658
27.483553
124
cpp
PB-DFS
PB-DFS-master/src/nodesel_ml_dfs.hpp
#ifndef __NODESEL_ML_DFS___ #define __NODESEL_ML_DFS___ #include <scip/scip.h> #include <objscip/objscip.h> namespace COML{ class Nodesel_ML_DFS: public scip::ObjNodesel { public: /** default constructor */ Nodesel_ML_DFS( SCIP* scip, /**< SCIP data structure */ const cha...
1,180
32.742857
124
hpp
PB-DFS
PB-DFS-master/src/preprocessor.cpp
#include "preprocessor.hpp" #include "global_config.hpp" #include <cmath> #include <limits> #include <assert.h> #include <set> #include <boost/algorithm/string.hpp> namespace COML { Preprocessor::Preprocessor() : predicted_real_value() {} void Preprocessor::load_prob_map_gcn(std::unordered_map<std::string, i...
1,431
28.833333
109
cpp
PB-DFS
PB-DFS-master/src/preprocessor.hpp
#ifndef PREPROCESSOR_H #define PREPROCESSOR_H #include <random> #include <algorithm> #include <iterator> #include <iostream> #include <numeric> // std::iota #include <vector> #include <cstring> #include <string> #include <time.h> #include <sys/time.h> #include <iomanip> #include <unordered_map> namespace COML {...
561
17.733333
73
hpp
PB-DFS
PB-DFS-master/src/scip_exception.hpp
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* This file is part of the examples to */ /* An introduction to SCIP */ ...
6,106
35.568862
135
hpp
PB-DFS
PB-DFS-master/src/scip_solver.cpp
#include <string> #include <algorithm> #include <utility> #include <iomanip> #include <iostream> #include <fstream> #include <cmath> #include <stdio.h> #include <scip/debug.h> #include <scip/struct_scip.h> #include <scip/type_scip.h> #include <scip/type_primal.h> #include <scip/struct_primal.h> #include <scip/type_stat...
22,195
37.601739
167
cpp
PB-DFS
PB-DFS-master/src/scip_solver.hpp
#ifndef SOLVER #define SOLVER #include <vector> #include <iostream> #include <scip/scip.h> #include <vector> #include "fstream" // headers of various plugins #include "scip/branch_allfullstrong.h" #include "scip/branch_cloud.h" #include "scip/branch_distribution.h" #include "scip/branch_fullstrong.h" #include "scip/...
6,362
28.733645
44
hpp
PB-DFS
PB-DFS-master/src/stats.cpp
#include "preprocessor.hpp" #include <iostream> #include <time.h> #include <sys/time.h> #include "global_config.hpp" #include "scip_solver.hpp" #include "scip/scip.h" #include "scip/scipdefplugins.h" void solve(std::string path) { } int main0(int argc, char* argv[]) { using namespace COML; const char * _hom...
3,797
27.556391
109
cpp
PB-DFS
PB-DFS-master/src/utils.cpp
#include "utils.hpp" #include <stdio.h> #include <string> #include <sys/stat.h> #include <dirent.h> #include <stdlib.h> #include <random> #include "global_config.hpp" #include <limits> #include <unordered_set> #include <sstream> // Get current date/time, format is YYYY-MM-DD.HH:mm:ss const std::string COML::currentDat...
8,134
21.787115
94
cpp
PB-DFS
PB-DFS-master/src/utils.hpp
#ifndef _MIPEXP_UTILS #define _MIPEXP_UTILS #include <vector> #include <limits> #include <cmath> #include <algorithm> #include <map> #include <scip/scip.h> #include <string> #include <algorithm> #include <cassert> #include <fstream> #include "global_config.hpp" #include <time.h> namespace COML { const std::...
1,674
34.638298
83
hpp
umap
umap-master/.pep8speaks.yml
pycodestyle: # Same as scanner.linter value. Other option is flake8 max-line-length: 88 # Default is 79 in PEP 8
119
39
68
yml
umap
umap-master/.travis.yml
language: python cache: apt: true # We use three different cache directory # to work around a Travis bug with multi-platform cache directories: - $HOME/.cache/pip - $HOME/download env: global: # Directory where tests are run from - TEST_DIR=/tmp/test_dir/ - MODULE=umap matrix: include: ...
1,046
28.083333
108
yml
umap
umap-master/CODE_OF_CONDUCT.md
# Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender...
3,221
67.553191
455
md
umap
umap-master/CONTRIBUTING.md
# Contributing Contributions of all kinds are welcome. In particular pull requests are appreciated. The authors will endeavour to help walk you through any issues in the pull request discussion, so please feel free to open a pull request even if you are new to such things. ## Issues The easiest contribution to make...
2,953
41.2
114
md
umap
umap-master/appveyor.yml
build: "off" environment: matrix: - PYTHON_VERSION: "3.7" MINICONDA: C:\Miniconda3-x64 - PYTHON_VERSION: "3.8" MINICONDA: C:\Miniconda3-x64 init: - "ECHO %PYTHON_VERSION% %MINICONDA%" install: - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - conda config --set always_yes yes --set c...
712
26.423077
150
yml