Random Request Species Module – cyclopts.random_request_species

This module defines a ProblemSpecies subclass and related classes for reactor-request-based resources exchanges that are randomly populated (i.e., not related to a specific fuel cycle).

author:Matthew Gidden <matthew.gidden _at_ gmail.com>
class cyclopts.random_request_species.RandomRequest[source]

A problem species for random (non-fuel cycle specific) reactor request exchanges.

gen_inst(point)[source]
Parameters:

point : RandomRequestPoint

A representation of a point in parameter space

Returns:

inst : tuple of lists of ExGroups, ExNodes, and ExArgs

A representation of a problem instance to be used by this species’ family

points()[source]
Returns:

point : RandomRequestPoint

A representation of a point in parameter space to be used by this species

read_space(space_dict)[source]
Parameters:

space_dict : dict

A dictionary container resulting from the reading in of a run control file

record_point(point, param_uuid, tables)[source]
Parameters:

point : RandomRequestPoint

A representation of a point in parameter space

param_uuid : uuid

The uuid of the point in parameter space

tables : list of cyclopts_io.Table

The tables that can be written to

register_tables(h5file, prefix)[source]
Parameters:

h5file : PyTables File

the hdf5 file

prefix : string

the absolute path to the group for tables of this species

Returns:

tables : list of cyclopts_io.Tables

All tables that could be written to by this species.

family[source]
Returns:

family : ResourceExchange

An instance of this species’ family

n_points[source]
Returns:

n : int

The total number of points in the parameter space

name[source]
Returns:

name : string

The name of this species

class cyclopts.random_request_species.RandomRequestBuilder(sampler, commod_offset=0, req_g_offset=0, sup_g_offset=0, req_n_offset=0, sup_n_offset=0, arc_offset=0, *args, **kwargs)[source]

A helper class to translate sampling parameters for a reactor request scenario into an instance of GraphParams used by the cyclopts.execute module.

The params member can be populated in a single step by the populate() member function, or the various supply/request parameters can be generated by the generate_request and generate_supply member functions and then the params member can be populated with the appropriate arguments to the populate_params member function.

This builder can be incorporated with other builders by providing the appropriate offsets.

Parameters:

sampler : ReactorRequestSampler

a parameter sampling container

params : GraphParams, optional

a pre-populated ExecParam object to populate

commod_offset : int, optional

an offset for commodity ids

req_g_offset : int, optional

an offset for request group ids

sup_g_offset : int, optional

an offset for supply group ids

req_n_offset : int, optional

an offset for request node ids

sup_n_offset : int, optional

an offset for supply node ids

arc_offset : int, optional

an offset for arc ids

build(*args, **kwargs)[source]

Builds Group, Node, and Arc components of a Reactor-Request based Resource Exchange

generate_request(commods, requesters, *args, **kwargs)[source]

Returns all requests as a dictionary of requester ids to a list of assembly requests, where each assembly request is a list of id-commodity two-tuples that can satisfy such a request.

Parameters:

commods : set

the commodities

requesters : list

the requesters

generate_supply(commods, suppliers, *args, **kwargs)[source]

Returns a mapping from supplier to a list of 2-tuples of supply node id and request node id and a mapping from supply group id to a list of commodities supplied by the supplier.

Parameters:

commods : set

the commodities

suppliers : list

the suppliers

populate_params(request, supply, supplier_commods)[source]

Populates params (the GraphParams structure) given known supply and request

Parameters:

request : as returned by generate_request

supply : as returned by generate_supply

supplier_commods : commods supplied by suppliers, as returned by

generate_supply

valid()[source]

Screens the provided sampler to determine if it provides a valid point in solution space (e.g., if parameter C requires that the sum of parameters A and B be less than some value, valid() will return false if that condition is not met).

Returns:

b : bool

whether the sampler’s parameters form a valid point in the sampler’s parameter space

class cyclopts.random_request_species.RandomRequestPoint(n_commods=None, n_request=None, assem_per_req=None, req_qty=None, assem_multi_commod=None, req_multi_commods=None, exclusive=None, n_req_constr=None, n_supply=None, sup_multi=None, sup_multi_commods=None, n_sup_constr=None, sup_constr_val=None, connection=None, constr_coeff=None, pref_coeff=None)[source]

A container class representing a point in parameter space for RandomRequest problem species.

Parameters:

n_commods : Param or similar, optional

the number of commodities

n_request : Param or similar, optional

the number of requesters (i.e., RequestGroups)

assem_per_req : Param or similar, optional

the number of assemblies in a request

req_qty : Param or similar, optional

the quantity associated with each request

assem_multi_commod : BoolParam or similar, optional

whether an assembly request can be satisfied by multiple commodities

req_multi_commods : Param or similar, optional

the number of commodities in a multicommodity zone

exclusive : BoolParam or similar, optional

the probability that a reactor assembly request is exclusive

n_req_constr : Param or similar, optional

the number of constraints associated with a given request group

n_supply : Param or similar, optional

the number of suppliers (i.e., supply ExchangeNodeGroups)

sup_multi : BoolParam or similar, optional

whether a supplier supplies more than one commodity

sup_multi_commods : Param or similar, optional

the number of commodities a multicommodity supplier supplies

n_sup_constr : Param or similar, optional

the number of constraints associated with a given supply group

sup_constr_val : SupConstrParam or similar, optional

the supply constraint rhs value (as a fraction of the total request amount for a commodity)

connection : BoolParam or similar, optional

the probability that a possible connection between supply and request nodes is added

constr_coeff : CoeffParam or similar, optional

constraint coefficients

pref_coeff : CoeffParam or similar, optional

preference coefficients

dtype()[source]

Returns a numpy dtype describing all composed objects.

valid()[source]

Provides a best-guess estimate as to whether or not a given data point, as represented by this Sampler, is valid in the domain-defined parameter space.

Returns:

bool :

whether the sampler’s parameters form a valid point in the sampler’s parameter space

This Page