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
object MergeOverlappingIntervals extends App { | |
val intervals = Vector( | |
(0, 4), | |
(1, 3), | |
(3, 6), | |
(7, 9), | |
(9, 10), | |
(12, 14), | |
(13, 15), |
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
#import<iostream> | |
#import<list> | |
struct Node { | |
int value; | |
Node* next; | |
Node(int v, Node* n=NULL) : value(v), next(n) {} | |
}; | |
int main(int, char**) { |
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
package conann | |
import breeze.linalg._ | |
import breeze.plot._ | |
import breeze.stats.distributions._ | |
import breeze.stats._ | |
import scala.math._ | |
import java.awt.Color |
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
case class BranchAndBound[S <: BnBSolution[S], F <: Formula[F]]() { | |
def solve(initial_state: S): Option[S] = { | |
Logger.println(s"[BnB] starting new problem") | |
_solve(List(initial_state), None) | |
} | |
@tailrec | |
private final def _solve(state_stack: Seq[S], best_state: Option[S]): Option[S] = | |
if (state_stack.isEmpty) best_state |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#include<stdio.h> | |
#include<math.h> | |
// thanks Joe from stackoverflow | |
#include <sys/time.h> | |
#include <sys/resource.h> | |
double get_time() | |
{ | |
struct timeval t; |
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
@inline @fastmath function myexpm1(x :: Float64) | |
ln2_hi = 6.93147180369123816490e-01 | |
ln2_lo = 1.90821492927058770002e-10 | |
one = 1.0 | |
Q1 = -3.33333333333331316428e-02 | |
Q2 = 1.58730158725481460165e-03 | |
Q3 = -7.93650757867487942473e-05 | |
Q4 = 4.00821782732936239552e-06 | |
Q5 = -2.01099218183624371326e-07 | |
hi = x - ln2_hi |
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
import timeit | |
import numpy as np | |
def myexpm1(x): | |
ln2_hi = 6.93147180369123816490e-01 | |
ln2_lo = 1.90821492927058770002e-10 | |
one = 1.0 | |
Q = np.array([1.0, |