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
use rand::{Rng, thread_rng}; | |
use rand::distributions::{Uniform}; | |
use std::collections::{HashMap, HashSet}; | |
#[allow(dead_code)] | |
struct Env { | |
rg: f32, // ランダム位置範囲 (-rg, rg) | |
n: usize, // アンテナ数 | |
r: f32, // アンテナの半径 | |
a: Vec<[f32; 2]>, // アンテナの位置 |
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
use rand::distributions::{Bernoulli, Distribution}; | |
use rand::prelude::*; | |
// Armは以下の機能を持つ | |
// - 報酬を観察できる | |
trait Arm { | |
fn draw(&self) -> f64; | |
} | |
// ベルヌーイ分布に従うarm |
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
# -*- coding: utf-8 -*- | |
module Dijkstra | |
using DataStructures | |
mutable struct Edge | |
to::Int | |
cost::Int | |
end |
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 line_segment_intersection(p1, p2, p3, p4): | |
d = (p2[0] - p1[0]) * (p4[1] - p3[1]) - (p2[1] - p1[1]) * (p4[0] - p3[0]) | |
if d == 0.0: | |
return None | |
intersect = [0.0, 0.0] | |
u = ((p3[0] - p1[0]) * (p4[1] - p3[1]) - (p3[1] - p1[1]) * (p4[0] - p3[0])) / d | |
v = ((p3[0] - p1[0]) * (p2[1] - p1[1]) - (p3[1] - p1[1]) * (p2[0] - p1[0])) / d | |
if u < 0.0 or u > 1.0 or v < 0.0 or v > 1.0: | |
return None |
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
1 2 | |
1 3 | |
2 4 | |
3 4 | |
3 5 | |
4 5 |
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
use fast_paths::InputGraph; | |
use fast_paths::PreparationGraph; | |
use fast_paths::Dijkstra; | |
use fast_paths::contract_node; | |
fn main() { | |
let mut input_graph = InputGraph::new(); | |
// // 01234=ABCDE | |
// input_graph.add_edge_bidir(0, 2, 1); | |
// input_graph.add_edge_bidir(1, 2, 4); |
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
use fast_paths::InputGraph; | |
use fast_paths::PreparationGraph; | |
use fast_paths::Dijkstra; | |
use fast_paths::contract_node; | |
fn main() { | |
let mut input_graph = InputGraph::new(); | |
// // 01234=ABCDE | |
// input_graph.add_edge_bidir(0, 2, 1); | |
// input_graph.add_edge_bidir(1, 2, 4); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Flask Bokeh Sample</title> | |
{% autoescape False %} | |
{{ resources }} | |
{% endautoescape %} | |
</head> | |
<body> |
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
# -*- coding: utf-8 -*- | |
import json | |
from bokeh.embed import json_item | |
from bokeh.plotting import figure | |
from bokeh.resources import CDN | |
from bokeh.sampledata.iris import flowers | |
from bokeh.embed import components | |
from bokeh.plotting import figure | |
from flask import Flask, render_template |