shaojiashuai123456的博客
shaojiashuai123456 · 共 128 篇文章
jsprit学习笔记 -- 车辆管理
车辆管理 有限车辆 位置:VehicleFleetManagerImpl.java 主要是实现了车辆的获取,锁定和放回功能 无限车辆 位置:InfiniteVehicles.java 主要实现车辆的获取
2021-09-24 15:07 · jsprit · 评论(0)
jsprit学习笔记 -- 时间窗策略
时间窗策略 约束判断 位置:VehicleDependentTimeWindowConstraints.java 流程 1.获取插入位置后一个服务点的最晚到达时间,对于结束点,直接使用车辆的最晚到达时间就行 2. 插入的服务点,插入位置的前后服务点都需要小于 最晚到达时间 3.如果插入的服务点最晚时间<插入点前的最早处理时间,则不合法 4.计算在新车辆下原来的状态是否能满足要求,也就是前节点+前节点到后节点的时间<后节点允许的最晚到达时间 5.如果插入的服务几点最早时间>插入点后的最晚到达时间,则不合法 6. 推演插入后新节点到达时间,然后计算 插入点的最晚触发时间 7.如果新节点到达时间》…
2021-09-24 14:59 · jsprit · 评论(0)
tensorflow 实现lr
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt rng = np.random # Parameters learning_rate = 0.01 training_epochs = 1000 display_step = 50 batch_size = 10 # Training Data train_X = np.asarray([3.3,4.4,5.5,6.71,6.93,4.168,9.779,6.182,7.59,2.167, 7.042,10.791,5.313,7.997,5.…
2021-09-22 17:36 · 学习笔记 · 评论(0)
tensorflow 损失函数
#**********************回归损失 import matplotlib.pyplot as plt import tensorflow as tf from tensorflow.python.framework import ops ops.reset_default_graph() sess = tf.Session() # Various Predicted X-values x_vals = tf.linspace(-1., 1., 500) # Create our target of zero target = tf.constant(0.) # L2正则损失…
2021-09-22 12:04 · 评论(0)
tensorflow 实现 svr
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt rng = np.random # Parameters learning_rate = 0.01 training_epochs = 1000 display_step = 50 batch_size = 10 # Training Data train_X = np.asarray([3.3,4.4,5.5,6.71,6.93,4.168,9.779,6.182,7.59,2.167, 7.042,10.791,5.313,7.997,5.…
2021-09-22 11:50 · 学习笔记 · 评论(0)
jsprit学习笔记--主要策略
jsprit的策略: (1)ruin (破坏) a.随机破坏 (RuinRadom.java) , 随机删除路径上的节点 b.最差破坏 (RuinWorst.java) , 选取代价最大的n个节点 c.聚类破坏(RuinClusters.java) 通过ruin/DBSCANCluster.java计算聚类距离, 逻辑:循环10次,对于一个路线,选集选择2个节点,查看距离,计算平均距离和最小距离,距离半径=(平均距离-最小距离)*(0.5+random(0,1)) , 聚类某辆车的节点,删除某个聚类所有节点 注意:Jsprit.java中对 聚类策略 进行了jobneighborhoods的…
2021-09-01 10:12 · jsprit · 评论(0)
jsprit学习笔记--主要结构
jsprit 的主要处理结构,jsprit是一个开源的解决VRP(车辆路径问题)问题的工具,其中主要使用的是Ruin And Rebuild算法。 车辆信息: 车辆类型,costParameter 车辆花费参数 容量限制 起终点坐标 最早出发时间 最晚到达时间 是否回到终点 特性,如 冷场等 服务节点: 容量需求 服务时间窗 服务时长 特性需求 节点位置 节点编号 节点优先级(1-10),默认是2,用来在计算中优先插入优先级高的 algorithm: problem输入的参数 ruin和recreate策略管理器 ruin破坏策略 recreate修复策略 cost 代价计算 acceprt…
2021-08-30 20:49 · jsprit · 评论(0)
jsprit代价计算
总方案计算 private SolutionCostCalculator getObjectiveFunction(final VehicleRoutingProblem vrp, final double maxCosts) { if (objectiveFunction != null) return objectiveFunction; SolutionCostCalculator solutionCostCalculator = new SolutionCostCalculator() { @Override public double getCosts(VehicleRouting…
2021-08-06 11:21 · jsprit · 评论(0)
jsprit学习笔记
转载:https://my.oschina.net/u/3173942/blog/1572842 jsprit简介 jsprit是一个开源的解决VRP(车辆路径问题)问题的工具,其中主要使用的是Ruin And Rebuild算法。 基本概念 jsprit中包含几个基本的概念,包括车辆,车辆类型等,以及他们能挂载的诸多属性。 jsprit的结果(solution)结构如图 Ruin And Rebuild流程 Rebuild流程 选取现在还未分配的一个服务点 尝试加入每个完整路径中 在每个完整路径中选取一段路径进行插入 比较插入后新增的路径和原始段中路径的长度差 选取一个增量最小的位置返回该…
2021-08-06 11:16 · jsprit · 评论(0)
分支定界法
#include <stdio.h> #include <string> #include <iostream> #include <algorithm> #include <iterator> #include <cstdlib> #include <queue> #include "bb_algorithm.h" namespace bb { BranchBound::BranchBound(TspGraph& graph, std::vector<NodeType>& nodes_info) :m_graph(graph), m_nodes_info(nodes_info) { n =…
2021-08-04 17:42 · c项目常用 · 评论(0)
蚁群算法 (转载)
原文链接:https://blog.csdn.net/x454045816/article/details/108744637 一、算法介绍 蚁群算法,最早是1992年由Marco Dorigo在他的博士论文中提出的,是一种通过模拟自然界蚂蚁寻径的行为,提出的一种全新的模拟进化算法。据昆虫学家的观察和研究发现,生物世界中的蚂蚁有能力在没有任何可见提示下找到从其巢穴到食物源的最短路径,并能随环境的变化而变化,适应性地搜索新的路径,产生新的选择。这是因为蚂蚁在寻找路径时会在路径上释放一种特殊的分泌物——信息素,使得一定范围内的其他蚂蚁能够觉察并影响它们以后的寻径行为。当一些路径上通过的蚂蚁越来越…
2021-05-28 19:54 · 评论(0)
python crontab使用
from crontab import CronTab import os,sys #crontab操作 class CrontabUpdate(object): def __init__(self, username='admin'): self._user = username # 创建当前用户的crontab,当然也可以创建其他用户的,但得有足够权限 self.cron = CronTab(user=self._user) ''' eg. cmmand_line : python /home/admin/test.py time_str : 1 * * * * comment_name…
2020-04-12 08:47 · python常用 · 评论(0)
单例模式模版类
#ifndef _COMMON_SINGLETON_H_ #define _COMMON_SINGLETON_H_ template<typename T> class Singleton { public: template<typename... Args> static T* Instance(Args&& ...args) { if (m_pInstance == nullptr) { m_pInstance = new T(std::forward<Args>(args)...); } return m_pInstance; } static T* GetInstance() { …
2020-03-20 14:01 · c函数库 · 评论(0)
python tornado 框架使用 (6)
tornaodo 实现文件上传 页面主要代码 <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gbk" /> <link type="text/css" rel="stylesheet" href="/static/main.css" /> <title></title> </head> <body> <script language="javascript" src="/static/js/jquery-3.3.1.min.js"></script> <scr…
2020-02-08 15:19 · python常用 · 评论(0)
python pandas
import sys from pandas import Series,DataFrame import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn import preprocessing plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签 plt.rcParams['axes.unicode_minus']=False #用来正常显示负号 data = pd.read_csv("./train_samples_all.c…
2019-04-12 16:45 · python常用 · 评论(0)