Commit 0b809a0f authored by Benoit Barbot's avatar Benoit Barbot

prog

parent d4a18740
......@@ -6,9 +6,9 @@ import re
from exportGrML import *
## Set Parameters
#prismpath="prism";
prismpath="prism";
#prismpath="/Users/barbot/Documents/discrepancy/prism-ptasmc/prism/bin/prism";
prismpath="~/Documents/prism/prism-ptasmc/prism/bin/prism ";
#prismpath="~/Documents/prism/prism-ptasmc/prism/bin/prism ";
if len(sys.argv)<2:
print("usage: script_tocosmos_PTA.sage prism_file [out_file] [num_poly (default 3)] [deadline (default -1)] [-isotropic])");
......
......@@ -20,4 +20,4 @@ void generateLHAfromStrat(
vector<double>& reward,
double H,
vector< vector<double> >& M,
bool);
\ No newline at end of file
bool);
......@@ -271,7 +271,7 @@ void makeselectlist(void){
}
/**
* This function launch a set of simulators and stop them once
* This function launches a set of simulators and stop them once
* The precision criterion is reach.
*/
void launchServer(parameters& P){
......
......@@ -33,6 +33,7 @@
//#include <boost/archive/text_iarchive.hpp>
//#include <boost/serialization/vector.hpp>
#ifndef _BATCHR_HPP
#define _BATCHR_HPP
......
......@@ -198,13 +198,14 @@ void KroneckerState::newTrajectory(){
}
double timeGen::sampleQuasiRandom(size_t){
return vanDerCorputSampler.sample();
//return kroneckerSampler.sample();
//return vanDerCorputSampler.sample();
return kroneckerSampler.sample();
}
void timeGen::reset(){
vanDerCorputSampler.newTrajectory();
kroneckerSampler.newTrajectory();
cerr << endl;
}
string timeGen::string_of_dist(DistributionType d,const array<double,PARAM_TBL_SIZE> &param, const CustomDistr &cd)const{
......@@ -402,30 +403,33 @@ double timeGen::GenerateTime(DistributionType distribution,size_t trid, const ar
std::uniform_real_distribution<> unif(0.0, 1.0);
gentime = unif(RandomNumber);
}
//cerr << gentime << endl;
cerr << gentime << "\t";
double lower = cd.userDefineLowerBound(param);
double upper = cd.userDefineUpperBound(param);
/*
//Isotrop Hack
/*//Isotrop Hack
std::uniform_real_distribution<> unif(lower, upper);
gentime = unif(RandomNumber);
//gentime = sampleQuasiRandom(trid);
//gentime = (upper-lower)*gentime + lower;
cerr << cd.userDefineCDF(param,gentime) << endl;
cerr << gentime << "\t";
//cerr << cd.userDefineCDF(param,gentime) << "\t";
return gentime;
//Isotrop Hack
*/
//cerr << "sample(" << gentime << ",[" << lower << "," << upper << "]):" <<endl;
double initialpt = (lower+upper)/ 2.0;
return boost_newton_raphson_iterate([&](double x){
double pt = boost_newton_raphson_iterate([&](double x){
const auto cdf = cd.userDefineCDF(param,x);
const auto pdf = cd.userDefinePDF(param,x);
// cerr << "it:" << x << endl;
return make_tuple(cdf-gentime, pdf);
}, initialpt, lower, upper, 100);
//cerr << pt << "\t";
return pt;
break;
}
......
......@@ -62,6 +62,8 @@ private:
unsigned int baseId;
};
double unif01ofint(unsigned long v);
class timeGen {
public:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment