本文整理汇总了C++中calculate_path函数的典型用法代码示例。如果您正苦于以下问题:C++ calculate_path函数的具体用法?C++ calculate_path怎么用?C++ calculate_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了calculate_path函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Py_GetExecPrefix
wchar_t *
Py_GetExecPrefix(void)
{
if (!module_search_path)
calculate_path();
return exec_prefix;
}
开发者ID:469306621,项目名称:Languages,代码行数:7,代码来源:getpath.c
示例2: Py_GetProgramFullPath
wchar_t *
Py_GetProgramFullPath(void)
{
if (!module_search_path)
calculate_path();
return progpath;
}
开发者ID:469306621,项目名称:Languages,代码行数:7,代码来源:getpath.c
示例3: Py_GetPrefix
char *
Py_GetPrefix(void)
{
if (!module_search_path)
calculate_path();
return prefix;
}
开发者ID:0xcc,项目名称:python-read,代码行数:7,代码来源:getpathp.c
示例4: Py_GetPath
wchar_t *
Py_GetPath(void)
{
if (!module_search_path)
calculate_path();
return module_search_path;
}
开发者ID:469306621,项目名称:Languages,代码行数:7,代码来源:getpath.c
示例5: get_map_data
// Public methods
void GlobalPlanner::send_next_step(){
get_map_data();
populate_all_nodes();
get_destination();
get_current_location();
calculate_path();
find_next_step();
}
开发者ID:GCRobotics,项目名称:GCRepo,代码行数:9,代码来源:GlobalPlanner.cpp
示例6: create_path_copy
NodePath* Dijkstra::get_path(Node* start, Node* dest) {
/**
* After running the find_paths function, you can here extract the exact way from start to destination.
*/
if (saved_paths.find(NodePair(start, dest)) != saved_paths.end()) {
return create_path_copy(saved_paths[NodePair(start, dest)]);
}
// otherwise calculate a new path
return calculate_path(start, dest);
}
开发者ID:trew,项目名称:TDP005,代码行数:12,代码来源:Dijkstra.cpp
示例7: calculate_path
char* FileList::create_path(int number_override)
{
if(asset->format != list_type) return asset->path;
table_lock->lock("FileList::create_path");
char *path = (char*)"";
char output[BCTEXTLEN];
if(file->current_frame >= path_list.total || !asset->use_header)
{
int number;
if(number_override < 0)
number = file->current_frame++;
else
{
number = number_override;
file->current_frame++;
}
if(!asset->use_header)
{
number += first_number;
}
calculate_path(number, output);
path = new char[strlen(output) + 1];
strcpy(path, output);
path_list.append(path);
}
else
{
// Overwrite an old path
path = path_list.values[file->current_frame];
}
table_lock->unlock();
return path;
}
开发者ID:Cuchulain,项目名称:cinelerra,代码行数:43,代码来源:filelist.C
示例8: route_calculate
//.........这里部分代码省略.........
}
sort_hyperbolic_route(nbr_to_dest,nbr_dist, faces,0,num_link);
if (nlsr->max_faces_per_prefix == 0 )
{
for ( i=0 ; i < num_link; i++)
{
update_routing_table_with_new_hyperbolic_route(me->mapping,faces[i],nbr_to_dest[i]);
}
}
else if ( nlsr->max_faces_per_prefix > 0 )
{
if ( num_link <= nlsr->max_faces_per_prefix )
{
for ( i=0 ; i < num_link; i++)
{
update_routing_table_with_new_hyperbolic_route(me->mapping,faces[i],nbr_to_dest[i]);
}
}
else if (num_link > nlsr->max_faces_per_prefix)
{
for ( i=0 ; i < nlsr->max_faces_per_prefix; i++)
{
update_routing_table_with_new_hyperbolic_route(me->mapping,faces[i],nbr_to_dest[i]);
}
}
}
free(faces);
free(nbr_dist);
free(nbr_to_dest);
}
}
hashtb_end(e);
free(links);
free(link_costs);
}
else if (nlsr->is_hyperbolic_calc == 0 )
{
long int *parent=(long int *)malloc(map_element * sizeof(long int));
long int *dist=(long int *)malloc(map_element * sizeof(long int));
if ( (num_link == 0) || (nlsr->max_faces_per_prefix == 1 ) )
{
calculate_path(adj_matrix,parent,dist, map_element, source);
print_all_path_from_source(parent,source);
print_all_next_hop(parent,source);
update_routing_table_with_new_route(parent, dist,source);
}
else if ( (num_link != 0) && (nlsr->max_faces_per_prefix == 0 || nlsr->max_faces_per_prefix > 1 ) )
{
long int *links=(long int *)malloc(num_link*sizeof(long int));
long int *link_costs=(long int *)malloc(num_link*sizeof(long int));
get_links_from_adj_matrix(adj_matrix, map_element , links, link_costs, source);
for ( i=0 ; i < num_link; i++)
{
adjust_adj_matrix(adj_matrix, map_element,source,links[i],link_costs[i]);
calculate_path(adj_matrix,parent,dist, map_element, source);
print_all_path_from_source(parent,source);
print_all_next_hop(parent,source);
update_routing_table_with_new_route(parent, dist,source);
}
free(links);
free(link_costs);
}
free(parent);
free(dist);
}
print_routing_table();
print_npt();
update_npt_with_new_route();
print_routing_table();
print_npt();
for(i = 0; i < map_element; i++)
{
free(adj_matrix[i]);
}
free(adj_matrix);
destroy_map();
destroy_rev_map();
//hashtb_destroy(&nlsr->map);
//hashtb_destroy(&nlsr->rev_map);
}
nlsr->is_route_calculation_scheduled=0;
nlsr_unlock();
return 0;
}
开发者ID:akaash-nigam,项目名称:NLSR0.0,代码行数:101,代码来源:nlsr_route.c
示例9: garch_price
/**
* Computes garch price for GARCH model
* @param[in] today_price taday price
* @param[in] alpha_zero garch parameter
* @param[in] alpha_one garch parameter
* @param[in] lambda the constant unit risk premium
* @param[in] beta_one garch parameter
* @param[in] interest the annulized interest
* @param[in] K exercise price
* @param[in] frequency frequency
* @param[in] T time to mutrity
* @param[in] choice emscorrection(ems_on or ems_off)
* @param[in] type_generator the type of generator for random number
* @param[out] garch option price
* garch->call obtains call option price
* garch->put obtains put option price
* @return OK if ok otherwise return FAIL
*/
static int garch_price(NumFunc_1 *p,double today_price,double alpha_zero,double alpha_one,double beta_one,double lambda,double interest,int frequency,double K,int T,int N,int choice,int type_generator,double *price,double *delta)
{
double sum_callorput;
double sum_delta;
double s_T;
double garch_delta;
int i;
PnlMat *path_ems, *path, *path1D;
PnlVect *h;
path=pnl_mat_create(T,N);
h=pnl_vect_create (1);
sum_callorput=0;
sum_delta=0;
pnl_vect_set(h,0,today_price);
if (calculate_path(h,path,interest,frequency,N,T,alpha_zero,alpha_one,lambda,beta_one,type_generator)==FAIL)
{
pnl_vect_free(&h);
pnl_mat_free(&path);
return FAIL;
}
//if we choose ems option
switch (choice)
{
case 1:
pnl_vect_free(&h);
pnl_rand_init(type_generator,N,T);
path_ems=pnl_mat_create(T,N);
if(ems(path,interest,frequency,path_ems)==FAIL)
{
pnl_mat_free(&path);
pnl_mat_free(&path_ems);
return FAIL;
}
pnl_mat_clone(path, path_ems);
for(i=0;i<N;i++)
{
s_T=pnl_mat_get(path,T-1,i);
sum_callorput=sum_callorput+(p->Compute)(p->Par,pnl_mat_get(path,T-1,i));
if(s_T>K) garch_delta=1.;
sum_delta=sum_delta+(s_T/today_price)*garch_delta;
}
pnl_mat_free(&path_ems);
break;
case 2:
path1D=pnl_mat_create(T,1);
pnl_rand_init(type_generator,1,T);
for(i=0;i<N;i++)
{
calculate_path(h,path1D,interest,frequency,1,T,alpha_zero,alpha_one,lambda,beta_one,type_generator);
s_T=pnl_mat_get(path1D,T-1,0);
sum_callorput=sum_callorput+(p->Compute)(p->Par,pnl_mat_get(path,T-1,i));
if(s_T>K) garch_delta=1.;
sum_delta=sum_delta+(s_T/today_price)*garch_delta;
}
pnl_vect_free(&h);
pnl_mat_free(&path1D);
break;
default:
printf ("Wrong value for parameter EMS\n");
return FAIL;
}
interest=(interest*frequency)/252.;
//Price
*price=sum_callorput/(N*pow(M_E,(interest*T)));
*delta=sum_delta/(N*pow(M_E,(T*interest)));
if ((p->Compute)==&Put) *delta=*delta-1;
pnl_mat_free(&path);
return OK ;
}
开发者ID:jayhsieh,项目名称:premia-13,代码行数:94,代码来源:mc_duan.c
示例10: calculate_path
static void
calculate_path(void)
{
extern char *Py_GetProgramName(void);
static char delimiter[2] = {DELIM, '\0'};
static char separator[2] = {SEP, '\0'};
char *pythonpath = PYTHONPATH;
char *rtpypath = Py_GETENV("PYTHONPATH");
char *home = Py_GetPythonHome();
#ifndef _AMIGA
char *path = getenv("PATH");
char *prog = Py_GetProgramName();
#endif
char argv0_path[MAXPATHLEN+1];
char zip_path[MAXPATHLEN+1];
int pfound, efound; /* 1 if found; -1 if found build directory */
char *buf;
size_t bufsz;
size_t prefixsz;
char *defpath = pythonpath;
#ifdef WITH_NEXT_FRAMEWORK
NSModule pythonModule;
#endif
#ifdef _AMIGA
strcpy(progpath,fullprogpath());
#else /* !_AMIGA */
/* If there is no slash in the argv0 path, then we have to
* assume python is on the user's $PATH, since there's no
* other way to find a directory to start the search from. If
* $PATH isn't exported, you lose.
*/
if (strchr(prog, SEP))
strncpy(progpath, prog, MAXPATHLEN);
else if (path) {
while (1) {
char *delim = strchr(path, DELIM);
if (delim) {
size_t len = delim - path;
if (len > MAXPATHLEN)
len = MAXPATHLEN;
strncpy(progpath, path, len);
*(progpath + len) = '\0';
}
else
strncpy(progpath, path, MAXPATHLEN);
joinpath(progpath, prog);
if (isxfile(progpath))
break;
if (!delim) {
progpath[0] = '\0';
break;
}
path = delim + 1;
}
}
else
progpath[0] = '\0';
if (progpath[0] != SEP)
absolutize(progpath);
strncpy(argv0_path, progpath, MAXPATHLEN);
argv0_path[MAXPATHLEN] = '\0';
#ifdef WITH_NEXT_FRAMEWORK
/* On Mac OS X we have a special case if we're running from a framework.
** This is because the python home should be set relative to the library,
** which is in the framework, not relative to the executable, which may
** be outside of the framework. Except when we're in the build directory...
*/
pythonModule = NSModuleForSymbol(NSLookupAndBindSymbol("_Py_Initialize"));
/* Use dylib functions to find out where the framework was loaded from */
buf = (char *)NSLibraryNameForModule(pythonModule);
if (buf != NULL) {
/* We're in a framework. */
/* See if we might be in the build directory. The framework in the
** build directory is incomplete, it only has the .dylib and a few
** needed symlinks, it doesn't have the Lib directories and such.
** If we're running with the framework from the build directory we must
** be running the interpreter in the build directory, so we use the
** build-directory-specific logic to find Lib and such.
*/
strncpy(argv0_path, buf, MAXPATHLEN);
reduce(argv0_path);
joinpath(argv0_path, lib_python);
joinpath(argv0_path, LANDMARK);
#endif /* !_AMIGA */
if (!ismodule(argv0_path)) {
/* We are in the build directory so use the name of the
executable - we know that the absolute path is passed */
strncpy(argv0_path, prog, MAXPATHLEN);
}
else {
/* Use the location of the library as the progpath */
strncpy(argv0_path, buf, MAXPATHLEN);
}
//.........这里部分代码省略.........
开发者ID:Belxjander,项目名称:Kirito,代码行数:101,代码来源:getpath.c
注:本文中的calculate_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论