pub struct Superoptimiser {
pub instruction_set: Vec<String>,
pub max_length: usize,
pub tested: usize,
}Expand description
A superoptimiser that searches for the shortest equivalent program.
Fields§
§instruction_set: Vec<String>Instruction set available to the target program.
max_length: usizeMaximum program length to enumerate.
tested: usizeNumber of programs tested.
Implementations§
Source§impl Superoptimiser
impl Superoptimiser
Sourcepub fn new(instruction_set: Vec<String>, max_length: usize) -> Self
pub fn new(instruction_set: Vec<String>, max_length: usize) -> Self
Create a new superoptimiser.
use oxilean_std::program_synthesis::Superoptimiser;
let so = Superoptimiser::new(vec!["add".into(), "mul".into()], 4);
assert_eq!(so.max_length, 4);Sourcepub fn enumerate_length(&self, length: usize) -> Vec<Vec<String>>
pub fn enumerate_length(&self, length: usize) -> Vec<Vec<String>>
Enumerate all programs of the given length.
Sourcepub fn test_equivalent(
&mut self,
_candidate: &[String],
_reference: &[String],
) -> bool
pub fn test_equivalent( &mut self, _candidate: &[String], _reference: &[String], ) -> bool
Test a candidate program against a reference (placeholder).
Trait Implementations§
Source§impl Clone for Superoptimiser
impl Clone for Superoptimiser
Source§fn clone(&self) -> Superoptimiser
fn clone(&self) -> Superoptimiser
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Superoptimiser
impl RefUnwindSafe for Superoptimiser
impl Send for Superoptimiser
impl Sync for Superoptimiser
impl Unpin for Superoptimiser
impl UnsafeUnpin for Superoptimiser
impl UnwindSafe for Superoptimiser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more