- Fork the repo pysal/spopt
- Create a dev branch gsoc21-facloc in my forked repo
- Create the first notebook to familiarize me with the facility location problems following the example provided by mentor J. Gaboardi
- Design the architecture of the package using Builder Design Pattern for constraints
- Create the four models proposed: LSCP, MCLP, P-Median, [P-Center](https://github.com/py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copy and Paste this snippet and solve your homework 2.3 of Mongo course for Java Developers. | |
* Remember to import all libraries before you use. | |
* This project is handled by Maven so you have to use Maven too with the dependency of MongoJavaDriver | |
* | |
* Created By gegen07 | |
*/ | |
public class App { | |
public static void main( String[] args ) { | |
MongoClient client = new MongoClient("localhost", 27017); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getPisanoPeriodFast(n int) []int { | |
var period []int | |
period = append(period, 0, 1) | |
var remainder int | |
for index := 0; index < n*n; index++ { | |
remainder = (period[index] + period[index+1]) % n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fator = 2 | |
n = int(input()) | |
vetor = [] | |
aux = [] | |
while n > 1: | |
while n % fator == 0: | |
n /= fator | |
if len(vetor) > 0: | |
for i in vetor: | |
if (fator*i) not in vetor: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hasInverse(det): | |
return True if det != 0 else False | |
def det(mat, tam): | |
detPrim = detSec = 1 | |
for i in range(tam): | |
for j in range(tam): | |
if i == j: | |
detPrim *= mat[i][j] | |
if i + j == tam - 1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
int matriz[3][3], matriz1[3][3] = {{1, 2, 3}, {2, 3, 1}, {3, 2, 1}}, matriz2[3][3]={{1, 2, 3}, {2, 3, 1}, {3, 2, 1}}; | |
for (int k = 0; k < 3; k++) { | |
for (int i = 0; i < 3; i++) { | |
int aux = 0; | |
for (int j = 0; j < 3; j++) { | |
aux += matriz1[k][j] * matriz2[j][i]; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from spopt.locate.coverage import MCLP | |
mclp = MCLP.from_cost_matrix( | |
cost_matrix, | |
ai, | |
max_coverage=service_dist, | |
p_facilities=4, | |
) | |
mclp = mclp.solve(pulp.GLPK(msg=False)) |
Watched Eric Demaine's lecture and initially did not understand the reduction from 3-SAT to 3-dimensional matching.
- Complexity: P, NP, NP-completeness, Reductions https://youtu.be/eHZifpgyH_4?t=2786
To reduce 3-SAT to 3DM, we need to show how to express every 3-SAT problem as a 3DM problem. If 3DM has a solution, then that solution can be applied to solve any 3-SAT problem.