UNPKG

ecclesia

Version:

Framework for political and electoral simulations

29 lines (28 loc) 1.5 kB
import { DisagreementFunction } from "../election/voting"; import { OpinionsArray, OpinionsArrayManager } from "./opinionsArray"; type DiffFunction<N extends number> = DisagreementFunction<OpinionsArray<N>, OpinionsArray<N>>; type OpinParams<N extends number> = Pick<OpinionsArrayManager<N>, "nOpinions" | "opinMax">; /** * Typically used for comparison between instances of the same kind. */ export declare function symmetricDiff<N extends number>({ nOpinions, opinMax }: OpinParams<N>): DiffFunction<N>; /** * The second operand is the one ponderating the difference. * It's intended as the one whose point of view is taken, the "most human" of the two. */ export declare function ponderedDiff<N extends number>({ nOpinions, opinMax }: OpinParams<N>): DiffFunction<N>; /** * The second operand is again the "most human", the one whose point of view is taken. * This simulates agreeing plainly with laws that aren't going far enough, * but disagreeing with laws that go too far or that go the wrong way. * * For each opinion: * - if A's opinion a is of the opposite sign of B's opinion b, it "goes the wrong way". * - the difference is Math.abs(a * b) * - if A's opinion a is of the same sign as B's opinion b but closer to 0, it "doesn't go far enough". * - the difference is 0 * - otherwise, it "goes too far". * - the difference is Math.abs(a - b) */ export declare function fromMaxDiff<N extends number>({ nOpinions, opinMax }: OpinParams<N>): DiffFunction<N>; export {};