|
k-dot-p 0.1
|
#include <digital_alloy_optimizer_1d.h++>
Collaboration diagram for kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d:Public Types | |
| enum | goal { MAXIMIZE, MAXIMIZE_ABS, MINIMIZE, MAKE_ZERO } |
| typedef void(* | set_point_callback )(unsigned X, const kdotp::libmodelxx::structure::material *mat, void *privdat) |
Public Member Functions | |
| digital_alloy_optimizer_1d (kdotp::libmodelxx::structure::material *marker_material, kdotp::libmodelxx::structure::material *_mat1, kdotp::libmodelxx::structure::material *_mat0, kdotp::libmodelxx::structure::generic_structure *s, set_point_callback _set_point, unsigned _blocksize, enum goal _goal, GError **err, void *privdat, unsigned _N_blocks=0, long unsigned int rng_seed=0, GList *assignments=NULL, struct::kdotp::libmodelxx::postprocessing::function_exp *assignment_expr=NULL, GHashTable *global_symbols=NULL) | |
| void | reset_optimum_array () |
| void | randomize_array (short unsigned *array, unsigned int N) |
| bool | is_improved (double value) |
| unsigned | get_random_unoptimized_block () |
| void | toggle_block (unsigned block, void *privdat) |
| void | set_block (unsigned block, void *privdat) |
| void | set_block_as_optimum (unsigned block) |
| void | set_material_from_current_assignments (void *privdat) |
| int | do_first_step (double value, void *privdat) |
| int | do_second_step (double value, void *privdat) |
| int | do_subsequent_step (double value, void *privdat) |
| int | do_generic_step (double value, void *privdat) |
| GError * | do_optimization (double(*get_value)(void *privdat, unsigned assignment, long unsigned iteration), void *get_value_privdat, void *set_point_privdat) |
| void | initialize (void *privdat) |
| void | initialize (const short unsigned *state, void *privdat) |
| ~digital_alloy_optimizer_1d () | |
Public Attributes | |
| kdotp::libmodelxx::structure::material * | mat1 |
| kdotp::libmodelxx::structure::material * | mat0 |
| short unsigned * | current_assignments |
| short unsigned * | material_is_optimum |
| kdotp::libmodelxx::structure::generic_structure * | genstruct |
| set_point_callback | call_set_point_callback |
| unsigned | start_X |
| unsigned | stop_X |
| unsigned | blocksize |
| unsigned * | points_in_block |
| unsigned * | point_start |
| unsigned | N_blocks |
| unsigned | N_optimum |
| double | previous_value |
| unsigned * | current_block |
| enum goal | goal |
| gsl_rng * | rng |
| unsigned long int | seed |
Private Member Functions | |
| digital_alloy_optimizer_1d () | |
| bool | operator== (const digital_alloy_optimizer_1d &o) |
| digital_alloy_optimizer_1d | operator= (const digital_alloy_optimizer_1d &o) |
| digital_alloy_optimizer_1d (const digital_alloy_optimizer_1d &o) | |
Definition at line 35 of file digital_alloy_optimizer_1d.h++.
| typedef void(* kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::set_point_callback)(unsigned X, const kdotp::libmodelxx::structure::material *mat, void *privdat) |
Definition at line 37 of file digital_alloy_optimizer_1d.h++.
Definition at line 38 of file digital_alloy_optimizer_1d.h++.
{
MAXIMIZE,
MAXIMIZE_ABS,
MINIMIZE,
MAKE_ZERO
};
| kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::digital_alloy_optimizer_1d | ( | kdotp::libmodelxx::structure::material * | marker_material, |
| kdotp::libmodelxx::structure::material * | _mat1, | ||
| kdotp::libmodelxx::structure::material * | _mat0, | ||
| kdotp::libmodelxx::structure::generic_structure * | s, | ||
| set_point_callback | _set_point, | ||
| unsigned | _blocksize, | ||
| enum goal | _goal, | ||
| GError ** | err, | ||
| void * | privdat, | ||
| unsigned | _N_blocks = 0, |
||
| long unsigned int | rng_seed = 0, |
||
| GList * | assignments = NULL, |
||
| struct::kdotp::libmodelxx::postprocessing::function_exp * | assignment_expr = NULL, |
||
| GHashTable * | global_symbols = NULL |
||
| ) |
constructor and initializer in one
| marker_material | material used to mark the region to be optimized |
| a | material to be used if the block is zero |
| b | material to be used if the block is one |
| s | generic_structure to be optimized |
| set_point | callback to use when setting a point, or NULL if you don't want to do anything |
| blocksize | number of points per block |
| err | GError information if something failed. Untouched if successful. |
| assignements | list of initial material assignments for each block (or for all blocks) |
| assignement_expr | function to evaluate to get the initial material assignments. |
TODO: need to finish symbol assignments, make the local symbol table, and then do the loop.
Definition at line 40 of file digital_alloy_optimizer_1d.c++.
References kdotp::libmodelxx::postprocessing::CONSTANT_SYMBOL, DIGITAL_ALLOY_OPTIMIZER_1D_GERROR_DOMAIN, kdp::constants::e, kdotp::libmodelxx::grid::cartesian_grid< T, D, Nc >::get_point_r(), kdotp::libmodelxx::randomness::get_urandom_unsigned_long_int(), kdotp::libmodelxx::grid::cartesian_grid< T, D, Nc >::L, and kdotp::libmodelxx::postprocessing::SCALAR.
: mat1(_mat1), mat0(_mat0), current_assignments(NULL), material_is_optimum(NULL), genstruct(s), call_set_point_callback(_set_point), blocksize(_blocksize), points_in_block(NULL), point_start(NULL), N_blocks(_N_blocks), previous_value(0), current_block(NULL), goal(_goal), seed(rng_seed) { cartesian_grid<material*, 1, 1>* matgrid = (cartesian_grid<material*, 1, 1>*)(genstruct->material_grid); /*First, we need to find the extents of the region.*/ bool started=false; /*Easy way to make this a GList: start off with list=NULL, create a new (start,end) struct * on start, save it to the list on end. leave the started variable as it is. */ for(unsigned X=0; X<matgrid->L[0]; X++) { if((**(matgrid->get_point_r(&X))) == *marker_material) { if(!started) { start_X = X; started=1; } }else if(started) { /*We've stopped*/ stop_X = X; started=0; } } if(started) { /*We started but hit the end without switching out of the material. Odd, but solvable.*/ stop_X = matgrid->L[0]; } /*We could probably do this with rounding, but this only happens once and works.*/ if(_N_blocks > 0) { N_blocks = (unsigned)_N_blocks; blocksize = ((stop_X-start_X) - (stop_X-start_X)%N_blocks)/N_blocks; }else{ N_blocks = ((stop_X-start_X) - (stop_X-start_X)%blocksize)/blocksize; } /*Allocate arrays*/ points_in_block = new unsigned[N_blocks]; point_start = new unsigned[N_blocks]; current_assignments = new short unsigned[N_blocks]; /*Previous assignments is NULL in order to know that we have no previous assignment or value.*/ material_is_optimum = new short unsigned[N_blocks]; /*Map the points to the blocks*/ for(unsigned i=0; i<N_blocks; i++) { points_in_block[i] = blocksize; } unsigned points_remaining = (stop_X - start_X)%blocksize; if(points_remaining != 0) { fprintf(stderr, "N_blocks=%u\n", N_blocks); unsigned pos=points_remaining/N_blocks; for(unsigned pt=0; pt<points_remaining; pt++) { points_in_block[pos]++; pos += points_remaining/N_blocks; if(pos >= N_blocks) pos = pos%N_blocks; } } /*Put in the offsets.*/ unsigned final_point = start_X; for(unsigned block=0; block<N_blocks; block++) { point_start[block] = final_point; final_point += points_in_block[block]; } /*allocate and then seed the random number generator*/ GError *e = NULL; gsl_rng_env_setup(); rng = gsl_rng_alloc(gsl_rng_default); if(rng == NULL) { *err = g_error_new(DIGITAL_ALLOY_OPTIMIZER_1D_GERROR_DOMAIN, 0, "kdotp::libkdotp::optimizer::digital_alloy_optimizer_1d.c::digital_alloy_optimizer_1d(constructor): Failed to set up GSL random number generator."); return; } /*Set the seed randomly if it's not already set*/ if(rng_seed == 0) { /*A seed value of 0 is special to GSL, so don't allow a seed of 0. Loop until it's not, or an error has occurred*/ seed=0; while((seed == 0) && (e == NULL)) { seed = kdotp::libmodelxx::randomness::get_urandom_unsigned_long_int(&e); } if(e != NULL) { g_propagate_prefixed_error(err, e, "kdotp::libkdotp::optimizer::digital_alloy_optimizer_1d.c::digital_alloy_optimizer_1d(constructor): Failed to get random seed:\n\t"); return; } fprintf(stderr, "rng_seed was zero, so got new one (seed=%lu rng_seed=%lu)\n", seed, rng_seed); }else{ fprintf(stderr, "rng_seed was non-zero, so keeping it (seed=%lu rng_seed=%lu)\n", seed, rng_seed); } fprintf(stderr, "\n\nseed is %lu\n\n", seed); /*We now seed the rng*/ gsl_rng_set(rng, seed); /*Begin initialization.*/ if((assignments != NULL) || (assignment_expr != NULL)) { /*NOTE that assignments takes precedence over assignment_expr*/ short unsigned* state = new short unsigned[N_blocks]; if(assignments != NULL) { if(assignments->next == NULL) { /*Assign each block based on the single user-supplied value.*/ if(*(double*)(assignments->data) < 0.5) { for(unsigned i=0; i<N_blocks; i++) state[i] = 0; }else{ for(unsigned i=0; i<N_blocks; i++) state[i] = 1; } }else{ /*Assign each block based on the user's specification.*/ GList* ll=assignments; for(unsigned i=0; i<N_blocks; i++) { state[i] = (*(double*)(ll->data) < 0.5)?0:1; ll = ll->next; if(ll == NULL) { *err = g_error_new(DIGITAL_ALLOY_OPTIMIZER_1D_GERROR_DOMAIN, 5, "kdotp::libkdotp::optimizer::digital_alloy_optimizer_1d.c::digital_alloy_optimizer_1d(constructor): ERROR while assigning materials according to user input: there were not enough values for each block (Got %u values but had %u blocks!\n", i+1, N_blocks); return; } } } }else{ /*Evaluate the expression at each point in the blocks.*/ struct ::kdotp::libmodelxx::postprocessing::symbol_table_entry_const start_x = {::kdotp::libmodelxx::postprocessing::CONSTANT_SYMBOL, ::kdotp::libmodelxx::postprocessing::SCALAR, NULL}; struct ::kdotp::libmodelxx::postprocessing::symbol_table_entry_const mid_x = {::kdotp::libmodelxx::postprocessing::CONSTANT_SYMBOL, ::kdotp::libmodelxx::postprocessing::SCALAR, NULL}; struct ::kdotp::libmodelxx::postprocessing::symbol_table_entry_const end_x = {::kdotp::libmodelxx::postprocessing::CONSTANT_SYMBOL, ::kdotp::libmodelxx::postprocessing::SCALAR, NULL}; struct ::kdotp::libmodelxx::postprocessing::symbol_table_entry_const start_X = {::kdotp::libmodelxx::postprocessing::CONSTANT_SYMBOL, ::kdotp::libmodelxx::postprocessing::SCALAR, NULL}; struct ::kdotp::libmodelxx::postprocessing::symbol_table_entry_const mid_X = {::kdotp::libmodelxx::postprocessing::CONSTANT_SYMBOL, ::kdotp::libmodelxx::postprocessing::SCALAR, NULL}; struct ::kdotp::libmodelxx::postprocessing::symbol_table_entry_const end_X = {::kdotp::libmodelxx::postprocessing::CONSTANT_SYMBOL, ::kdotp::libmodelxx::postprocessing::SCALAR, NULL}; /**TODO: need to finish symbol assignments, make the local symbol table, and then do the loop.*/ } initialize(state, privdat); }else{ initialize(privdat); } /*At this point, we should be set up. *The user should perform their first calculation, and call us back using one of the do_*_step funx.*/ }
Here is the call graph for this function:| kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::~digital_alloy_optimizer_1d | ( | ) |
Definition at line 215 of file digital_alloy_optimizer_1d.c++.
{
if(mat1 != NULL) delete mat1;
if(mat0 != NULL) delete mat0;
if(current_assignments != NULL) delete[] current_assignments;
if(material_is_optimum != NULL) delete[] material_is_optimum;
if(points_in_block != NULL) delete[] points_in_block;
if(current_block != NULL) delete current_block;
}
| kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::digital_alloy_optimizer_1d | ( | ) | [inline, private] |
Definition at line 257 of file digital_alloy_optimizer_1d.h++.
{}
| kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::digital_alloy_optimizer_1d | ( | const digital_alloy_optimizer_1d & | o | ) | [inline, private] |
Definition at line 260 of file digital_alloy_optimizer_1d.h++.
{}
| int kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::do_first_step | ( | double | value, |
| void * | privdat | ||
| ) |
Does the first step in the algorithm.
| value | the value that we're tracking |
| privdat | pointer to data for the set_point callback. |
Definition at line 229 of file digital_alloy_optimizer_1d.c++.
{
/*There's no way we can yet be converged. We don't even know if this
* point is optimal. This is our first point.*/
previous_value=value;
current_block = new unsigned;
*current_block = get_random_unoptimized_block();
toggle_block(*current_block, privdat);
return 0;
}
| int kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::do_generic_step | ( | double | value, |
| void * | privdat | ||
| ) |
Does any step in the algorithm, but checks to see if we've taken the first step yet.
| value | the value that we're tracking |
| privdat | pointer to data for the set_point callback. |
Does any step in the algorithm, but checks to see if we've taken the first step yet
| value | the value that we're tracking |
| privdat | pointer to data for the set_point callback. |
Definition at line 281 of file digital_alloy_optimizer_1d.c++.
{
if(current_block == NULL) {
return do_first_step(value, privdat);
}
return do_subsequent_step(value, privdat);
}
| GError * kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::do_optimization | ( | double(*)(void *privdat, unsigned assignment, long unsigned iteration) | get_value, |
| void * | get_value_privdat, | ||
| void * | set_point_privdat | ||
| ) |
Definition at line 296 of file digital_alloy_optimizer_1d.c++.
References DIGITAL_ALLOY_OPTIMIZER_1D_GERROR_DOMAIN, and unlikely.
Referenced by main().
{
long unsigned iteration=0;
double value = get_value(get_value_privdat, 0, iteration);
if(unlikely(isnan(value))) {
return g_error_new(DIGITAL_ALLOY_OPTIMIZER_1D_GERROR_DOMAIN, 101, "kdotp::libkdotp::optimizer::digital_alloy_optimizer_1d.c::do_optimization: Got NaN (%g) from get_value callback in the %lu%s iteration. Iteration has been halted.\n", value, iteration, (iteration%10==1&&iteration!=11)?"st":(iteration%10==2&&iteration!=12)?"nd":(iteration%10==3&&iteration!=13)?"rd":"th");
}else if(unlikely(isinf(value))) {
return g_error_new(DIGITAL_ALLOY_OPTIMIZER_1D_GERROR_DOMAIN, 101, "kdotp::libkdotp::optimizer::digital_alloy_optimizer_1d.c::do_optimization: Got inf (%g) from get_value callback in the %lu%s iteration. Iteration has been halted.\n", value, iteration, (iteration%10==1&&iteration!=11)?"st":(iteration%10==2&&iteration!=12)?"nd":(iteration%10==3&&iteration!=13)?"rd":"th");
}
do_first_step(value, set_point_privdat);
do {
value = get_value(get_value_privdat, 0, ++iteration);
if(unlikely(isnan(value))) {
return g_error_new(DIGITAL_ALLOY_OPTIMIZER_1D_GERROR_DOMAIN, 101, "kdotp::libkdotp::optimizer::digital_alloy_optimizer_1d.c::do_optimization: Got NaN (%g) from get_value callback in the %lu%s iteration. Iteration has been halted.\n", value, iteration, (iteration%10==1&&iteration!=11)?"st":(iteration%10==2&&iteration!=12)?"nd":(iteration%10==3&&iteration!=13)?"rd":"th");
}else if(unlikely(isinf(value))) {
return g_error_new(DIGITAL_ALLOY_OPTIMIZER_1D_GERROR_DOMAIN, 101, "kdotp::libkdotp::optimizer::digital_alloy_optimizer_1d.c::do_optimization: Got inf (%g) from get_value callback in the %lu%s iteration. Iteration has been halted.\n", value, iteration, (iteration%10==1&&iteration!=11)?"st":(iteration%10==2&&iteration!=12)?"nd":(iteration%10==3&&iteration!=13)?"rd":"th");
}
}while(!(do_subsequent_step(value, set_point_privdat)));
return NULL;
}
Here is the caller graph for this function:| int kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::do_second_step | ( | double | value, |
| void * | privdat | ||
| ) |
Does the later steps in the algorithm
| value | the value that we're tracking |
| privdat | pointer to data for the set_point callback. |
| int kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::do_subsequent_step | ( | double | value, |
| void * | privdat | ||
| ) |
Does the later steps in the algorithm
| value | the value that we're tracking |
| privdat | pointer to data for the set_point callback. |
Set the previous value.
Definition at line 243 of file digital_alloy_optimizer_1d.c++.
{
if(is_improved(value)) {
/*This is an improved point!*/
/*We don't know right now if any other points are optimized.*/
reset_optimum_array();
/**Set the previous value.
*\note if structure is now optimum, we have the final value in previous_value.
*/
previous_value = value;
fprintf(stderr, "RESET ARRAY: previous_value=%g (value=%g)\n", previous_value, value);
}else{
/*Choosing this point worsened the structure. Go back, set this as optimized, and choose a new point.*/
toggle_block(*current_block, privdat);
fprintf(stderr, "REVERT BLOCK %u: previous_value=%g (value=%g)\n", *current_block, previous_value, value);
/*Note that we don't set the previous value to this current value;
*it's not an improvement!
*/
}
/*We know that the block that just got changed is optimized.*/
set_block_as_optimum(*current_block);
/*Check to see if they're all optimized.*/
if(N_optimum == N_blocks) {
fprintf(stderr, "ALPHA IS LOCAL OPTIMUM: N_optimum=%u N_blocks=%u\n", N_optimum, N_blocks);
return 1;
}else{
fprintf(stderr, "ALPHA IS (NOT) LOCAL OPTIMUM: N_optimum=%u N_blocks=%u\n", N_optimum, N_blocks);
}
/*Get the randomly-selected new block.*/
*current_block = get_random_unoptimized_block();
/*Set the block.*/
toggle_block(*current_block, privdat);
return 0;
}
| unsigned kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::get_random_unoptimized_block | ( | ) | [inline] |
Definition at line 167 of file digital_alloy_optimizer_1d.h++.
References material_is_optimum, N_blocks, N_optimum, and rng.
{
unsigned check = (unsigned)floor(gsl_rng_uniform(rng)*(N_blocks - N_optimum-1));
unsigned j=0;
/*we need to find the check-th un-optimized block.
*algorithm: walk through the list incrementing j when we have an unoptimized block
* return the block where j becomes check.
*/
for(unsigned block=0; block<N_blocks; block++) {
if(!material_is_optimum[block]) {
if(j++ == check) return block;
}
}
return N_blocks;
}
| void kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::initialize | ( | void * | privdat | ) |
Resets the state to get ready to do an optimization.
Definition at line 195 of file digital_alloy_optimizer_1d.c++.
{
if(current_block != NULL) {
delete current_block;
current_block = NULL;
}
reset_optimum_array();
randomize_array(current_assignments, N_blocks);
set_material_from_current_assignments(privdat);
}
| void kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::initialize | ( | const short unsigned * | state, |
| void * | privdat | ||
| ) |
Initializes to a known state.
| state | the state to initialize to (array of N_blocks short unsigned ints) |
Definition at line 205 of file digital_alloy_optimizer_1d.c++.
{
if(current_block != NULL) {
delete current_block;
current_block = NULL;
}
reset_optimum_array();
for(unsigned i=0; i<N_blocks; i++) current_assignments[i] = state[i];
set_material_from_current_assignments(privdat);
}
| bool kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::is_improved | ( | double | value | ) | [inline] |
Definition at line 149 of file digital_alloy_optimizer_1d.h++.
References MAKE_ZERO, MAXIMIZE, MAXIMIZE_ABS, MINIMIZE, and previous_value.
{
switch(goal) {
case MAXIMIZE:
return (value > previous_value);
break;
case MAXIMIZE_ABS:
fprintf(stderr, "maximize_abs: value=%g previous_value=%g\n", value, previous_value);
return (fabs(value) > fabs(previous_value));
break;
case MINIMIZE:
return (value < previous_value);
break;
case MAKE_ZERO:
return (fabs(value) < fabs(previous_value));
break;
}
return false;
}
| digital_alloy_optimizer_1d kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::operator= | ( | const digital_alloy_optimizer_1d & | o | ) | [inline, private] |
Definition at line 259 of file digital_alloy_optimizer_1d.h++.
{return *this;}
| bool kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::operator== | ( | const digital_alloy_optimizer_1d & | o | ) | [inline, private] |
Definition at line 258 of file digital_alloy_optimizer_1d.h++.
{return false;}
| void kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::randomize_array | ( | short unsigned * | array, |
| unsigned int | N | ||
| ) | [inline] |
Definition at line 136 of file digital_alloy_optimizer_1d.h++.
References rng.
{
for(unsigned i=0; i<N; i++) {
/**\note that gsl_rng_uniform returns [0,1), so 0.5 will be considered in the upper half,
* so that both options will be equally probable
*\note Upper half of [0,1) => 1; lower => 0.
*/
if(gsl_rng_uniform(rng) >= 0.5) {
array[i]=1;
}else{
array[i]=0;
}
}
}
| void kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::reset_optimum_array | ( | ) | [inline] |
Definition at line 132 of file digital_alloy_optimizer_1d.h++.
References material_is_optimum, N_blocks, and N_optimum.
{
for(unsigned i=0; i<N_blocks; i++) material_is_optimum[i]=0;
N_optimum=0;
}
| void kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::set_block | ( | unsigned | block, |
| void * | privdat | ||
| ) | [inline] |
Definition at line 189 of file digital_alloy_optimizer_1d.h++.
References call_set_point_callback, current_assignments, genstruct, mat0, mat1, kdotp::libmodelxx::structure::generic_structure::material_grid, point_start, points_in_block, and kdotp::libmodelxx::grid::cartesian_grid< T, D, Nc >::set_point().
Referenced by set_material_from_current_assignments(), and toggle_block().
{
::kdotp::libmodelxx::grid::cartesian_grid< ::kdotp::libmodelxx::structure::material*, 1, 1>* matgrid
= (::kdotp::libmodelxx::grid::cartesian_grid< ::kdotp::libmodelxx::structure::material*, 1, 1>*)
(genstruct->material_grid);
unsigned final_point = point_start[block];
for(unsigned pt=0; pt<points_in_block[block]; pt++) {
matgrid->set_point(&final_point, (current_assignments[block]==0)?&mat0:&mat1);
if(call_set_point_callback != NULL)
call_set_point_callback(final_point, (current_assignments[block]==0)?mat0:mat1, privdat);
final_point++;
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| void kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::set_block_as_optimum | ( | unsigned | block | ) | [inline] |
Definition at line 201 of file digital_alloy_optimizer_1d.h++.
References material_is_optimum, and N_optimum.
{
material_is_optimum[block]=1;
N_optimum++;
}
| void kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::set_material_from_current_assignments | ( | void * | privdat | ) | [inline] |
Definition at line 206 of file digital_alloy_optimizer_1d.h++.
References N_blocks, and set_block().
Here is the call graph for this function:| void kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::toggle_block | ( | unsigned | block, |
| void * | privdat | ||
| ) | [inline] |
Definition at line 181 of file digital_alloy_optimizer_1d.h++.
References current_assignments, and set_block().
{
if(current_assignments[block] == 0) {
current_assignments[block] = 1;
}else{
current_assignments[block] = 0;
}
set_block(block, privdat);
}
Here is the call graph for this function:Definition at line 107 of file digital_alloy_optimizer_1d.h++.
| set_point_callback kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::call_set_point_callback |
Definition at line 100 of file digital_alloy_optimizer_1d.h++.
Referenced by set_block().
Definition at line 87 of file digital_alloy_optimizer_1d.h++.
Referenced by set_block(), and toggle_block().
Which block was last changed.
Definition at line 124 of file digital_alloy_optimizer_1d.h++.
| kdotp::libmodelxx::structure::generic_structure* kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::genstruct |
Definition at line 98 of file digital_alloy_optimizer_1d.h++.
Referenced by set_block().
Definition at line 125 of file digital_alloy_optimizer_1d.h++.
| kdotp::libmodelxx::structure::material* kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::mat0 |
Definition at line 85 of file digital_alloy_optimizer_1d.h++.
Referenced by set_block().
| kdotp::libmodelxx::structure::material* kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::mat1 |
Definition at line 84 of file digital_alloy_optimizer_1d.h++.
Referenced by set_block().
Definition at line 89 of file digital_alloy_optimizer_1d.h++.
Referenced by get_random_unoptimized_block(), reset_optimum_array(), and set_block_as_optimum().
the number of blocks
Definition at line 113 of file digital_alloy_optimizer_1d.h++.
Referenced by get_random_unoptimized_block(), reset_optimum_array(), and set_material_from_current_assignments().
This could be gleaned by counting material_is_optimum, but is faster.
Definition at line 115 of file digital_alloy_optimizer_1d.h++.
Referenced by get_random_unoptimized_block(), reset_optimum_array(), and set_block_as_optimum().
Definition at line 111 of file digital_alloy_optimizer_1d.h++.
Referenced by set_block().
Definition at line 109 of file digital_alloy_optimizer_1d.h++.
Referenced by set_block().
Previous value we're to track, to compare how we're changing.
Definition at line 119 of file digital_alloy_optimizer_1d.h++.
Referenced by is_improved().
The GSL random number generator information.
Definition at line 127 of file digital_alloy_optimizer_1d.h++.
Referenced by get_random_unoptimized_block(), and randomize_array().
| unsigned long int kdotp::libmetacalc::optimizer::digital_alloy_optimizer_1d::seed |
Definition at line 128 of file digital_alloy_optimizer_1d.h++.
Definition at line 103 of file digital_alloy_optimizer_1d.h++.
Definition at line 105 of file digital_alloy_optimizer_1d.h++.