Skip to content

Commit

Permalink
fix: fix import paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonzalo Uceda committed Aug 26, 2022
1 parent 85a11c7 commit 7fc2f9e
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions demo/optimizeCombined.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,48 @@ import {
IAssociations,
IFrequencies,
MenuType,
} from '../declarations/dataStructures';
import { InnerObjectiveFnType } from '../objectiveFunctions';
} from '../src/declarations/dataStructures';
import { InnerObjectiveFnType } from '../src/objectiveFunctions';

// Group separators have to be provided as dashes ('-').
const menuEntries = ['open', 'save', '-', '-', 'close', 'saveas'];
const menuEntries = [
'open',
'save',
'close',
'saveas',
'print',
'undo',
'redo',
'about',
'-',
'-',
'-',
];

const frequencies: IFrequencies = { open: 4, save: 10, close: 1, saveas: 2 };
const frequencies: IFrequencies = {
open: 4,
save: 10,
close: 1,
saveas: 2,
undo: 34,
redo: 17,
};

// Associations with null size are not necessary.
const associations: IAssociations = {
open: { close: 1 },
save: { saveas: 0.9 },
close: { save: 0.4 },
undo: { redo: 1 },
about: { print: 0.5 },
};

const combinedObjFn: InnerObjectiveFnType = (candidate: MenuType) => {
return (
objectives.fitts({ frequencies })(candidate) +
0.5 * objectives.associations({ associations })(candidate)
);
return objectives.associations({ associations })(candidate);
};

const { bestDesign, bestScore } = optimizers.random({
iterations: 1000,
iterations: 100000,
seed: menuEntries,
objectiveFunction: combinedObjFn,
});
Expand Down

0 comments on commit 7fc2f9e

Please sign in to comment.