Exemplo n.º 1
0
int main(int argc, char const *argv[]){

	srand(time(0));

	unsigned long germe[6] = { rand(), rand(), rand(), rand(), rand(), rand() };
    RngStream_SetPackageSeed (germe);
    RngStream g1 = RngStream_CreateStream ("Laplace");

    double (*fObj)(int, int, double[]);

    printf("Funcion 1\n");
    fObj=function;
    GWO(lb, ub, fObj, g1);
    showPack();
    
    printf("Funcion 6\n");
    fObj=function6;
    GWO(lb, ub, fObj, g1);
    showPack();

    printf("Funcion 7\n");
    fObj=function7;
    GWO(-1.28, 1.28, fObj, g1);
    showPack();

    printf("Funcion 8\n");
    fObj = function8;
    GWO(-500, 500, fObj, g1);
    showPack();

    RngStream_DeleteStream (&g1); 
    return 0;
}
Exemplo n.º 2
0
void primal_destroy (primal_t *primal)
{
	instance_destroy(primal->inst);
	RngStream_DeleteStream(primal->rng);
	free(primal->best_x);
	free(primal->improving_partial_x);
	free(primal->guiding_x);
	free(primal);
}
Exemplo n.º 3
0
int main (int argc, char const *argv[])
{
    srand(time(0));
    for (int i = 0; i < 30; ++i){
        unsigned long germe[6] = { rand(), rand(), rand(), rand(), rand(), rand() };
        RngStream_SetPackageSeed (germe);
        g1 = RngStream_CreateStream ("Laplace");
        GWO();
        showPack();
        RngStream_DeleteStream (&g1);   
    }
    return 0;
}
Exemplo n.º 4
0
void R_RngStreams_free (SEXP R_stream)
     /*----------------------------------------------------------------------*/
     /* Free Stream generator object.                                        */
     /*                                                                      */
     /* parameters:                                                          */
     /*   R_stream ... (pointer) ... pointer the Stream object               */
     /*----------------------------------------------------------------------*/
{
  RngStream stream;

  /* check pointer */
  CHECK_STREAM_PTR(R_stream);

  /* Extract pointer to generator */
  stream = R_ExternalPtrAddr(R_stream);
  if (stream == NULL) return;

  /* free generator object */
  RngStream_DeleteStream (&stream);
  R_ClearExternalPtr(R_stream);

} /* end of R_RngStreams_free() */
Exemplo n.º 5
0
SEXP r_create_stream (SEXP sexp_name)
{
    RngStream newstream;
    SEXP sexp_newstream;
    int i;

    const char *name = CHAR(STRING_ELT(sexp_name,0));
    newstream =  RngStream_CreateStream(name);

    PROTECT(sexp_newstream = allocVector(REALSXP, 20));

    for (i = 0; i < 6; ++i) {
        REAL(sexp_newstream)[i] = (double) newstream->Cg[i];
        REAL(sexp_newstream)[i+6] = (double) newstream->Bg[i];
        REAL(sexp_newstream)[i+12] = (double) newstream->Ig[i];
    }
    REAL(sexp_newstream)[18] = (int) newstream->Anti;
    REAL(sexp_newstream)[19] = (int) newstream->IncPrec;
    UNPROTECT(1);

    RngStream_DeleteStream(&newstream);
    return(sexp_newstream);
}
Exemplo n.º 6
0
void rng_free(void* ptr) {
  RngStream stream = (RngStream) ptr;
  RngStream_DeleteStream(&stream);
}
Exemplo n.º 7
0
	~RNG_lecuyer() { RngStream_DeleteStream(&_stream);}
Exemplo n.º 8
0
JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_nativeFinalize(JNIEnv *env, jobject jrngstream) {
  RngStream rngstream = jrngstream_to_native(env, jrngstream);
  RngStream_DeleteStream(&rngstream);
  env->SetLongField(jrngstream, jrngstream_bind, (intptr_t)nullptr);
}
Exemplo n.º 9
0
 xbt_dynar_foreach(host_list, i, host) {
   RngStream stream = MSG_host_get_data(host);
   RngStream_DeleteStream(&stream);
 }