def making_threats():
    """
    Making threats
    --------------
    (making_threats)


    """
    return functions.if_then_else(
        protest() > 0, functions.if_then_else(
            preference_for_repression() >= 0, threat_rate(), 0), 0)
def making_concessions():
    """
    Making concessions
    ------------------
    (making_concessions)


    """
    return functions.if_then_else(
        protest() > 0,
        functions.if_then_else(preference_for_repression() < 0,
                               concession_rate(), 0), 0)
def making_threats():
    """
    Making threats
    --------------
    (making_threats)


    """
    return functions.if_then_else(
        protest() > 0,
        functions.if_then_else(preference_for_repression() >= 0, threat_rate(),
                               0), 0)
def making_concessions():
    """
    Making concessions
    ------------------
    (making_concessions)


    """
    return functions.if_then_else(
        protest() > 0,
        functions.if_then_else(
            preference_for_repression() < 0,
            concession_rate(),
            0),
        0)
Example #5
0
def equality():
    """
    
    """
    loc_dimension_dir = 0 
    output = functions.if_then_else(quotient()==quotient_target(), 1,0)

    return output
def regime_survival():
    """
    Regime Survival
    ---------------
    (regime_survival)


    """
    return functions.if_then_else(total_cost() < regime_capability(), 1, 0)
def regime_survival():
    """
    Regime Survival
    ---------------
    (regime_survival)


    """
    return functions.if_then_else(total_cost() < regime_capability(), 1, 0)
def protest():
    """
    Protest
    -------
    (protest)


    """
    return functions.if_then_else(expected_net_gain_from_protest_g() > 0, 1, 0)
def protest():
    """
    Protest
    -------
    (protest)


    """
    return functions.if_then_else(expected_net_gain_from_protest_g() > 0, 1, 0)
def equality():
    """
    equality
    --------
    (equality)


    """
    return functions.if_then_else(quotient() == quotient_target(), 1, 0)
Example #11
0
def still_employed():
    """
    Still Employed

    Dmnl


    """
    return functions.if_then_else(motivation() > motivation_threshold(), 1, 0)
Example #12
0
def equality():
    """
    equality




    """
    return functions.if_then_else(quotient() == quotient_target(), 1, 0)
Example #13
0
def sales_effort_available():
    """
    Sales Effort Available

    Hours/Month


    """
    return functions.if_then_else(still_employed() > 0,
                                  total_effort_available() * fraction_of_effort_for_sales(), 0)
def still_employed():
    """
    Still Employed
    --------------
    (still_employed)
    Dmnl
    Flag for whether the agent is still with the firm. Goes to zero when the
                buffer becomes negative.
    """
    return functions.if_then_else(months_of_buffer() < 0, 0, 1)
def income():
    """
    Income
    ------
    (income)
    Months/Month
    The total income from commissions on sales to all tiers.
    """
    return tier_1_income() + tier_2_income() + functions.if_then_else(
        time() < startup_subsidy_length(), startup_subsidy(), 0)
Example #16
0
def still_employed():
    """
    Still Employed
    --------------
    (still_employed)
    Dmnl
    Flag for whether the agent is still with the firm. Goes to zero when the
                buffer becomes negative.
    """
    return functions.if_then_else(months_of_buffer() < 0, 0, 1)
Example #17
0
def income():
    """
    Income
    ------
    (income)
    Months/Month
    The total income from commissions on sales to all tiers.
    """
    return tier_1_income() + tier_2_income() + functions.if_then_else(time()
                                                                      < startup_subsidy_length(), startup_subsidy(), 0)
Example #18
0
def income():
    """
    Income

    Dmnl

    Technically in units of months of expenses earned per month
    """
    return months_of_expenses_per_sale() * sales() + functions.if_then_else(
        time() < startup_subsidy_length(), startup_subsidy(), 0)
Example #19
0
def switch_seir_or_sir():
    """
    Switch SEIR or SIR
    ------------------
    (switch_seir_or_sir)
    Dmnl [1,1,2]
    Modified to take RealParameter input from EMA between 0 and 1. Converts 
        EMA's RealParameter (between 0 and 1) to CategoricalParameter (0 or 1) for 
        Vensim.
    """
    return functions.if_then_else(switchinput() < 0.5, 0, 1)
Example #20
0
def incubation():
    """
    Incubation
    ----------
    (incubation)
    Person/Day

    """
    return functions.if_then_else(
        switch_seir_or_sir() == 1,
        exposed_population() / average_incubation_time(), infecting())
def adjusting_concession_expectation():
    """
    Adjusting concession expectation
    --------------------------------
    (adjusting_concession_expectation)


    """
    return functions.if_then_else(
        protest() > 0,
        concessions() * concession_fractional_adjustment() -
        expectation_of_concessions_needed(), 0)
def adjusting_repression_expectation():
    """
    Adjusting repression expectation
    --------------------------------
    (adjusting_repression_expectation)


    """
    return functions.if_then_else(
        protest() > 0,
        repressive_threat_tr() * repression_fractional_adjustment() -
        expectation_of_repression_needed(), 0)
def equality():
    """
    equality
    --------
    (equality)


<<<<<<< HEAD

=======
>>>>>>> 25bd4206de9f5719aad5a04a2320edc93351758a
    """
    return functions.if_then_else(quotient() == quotient_target(), 1, 0)
def adjusting_repression_expectation():
    """
    Adjusting repression expectation
    --------------------------------
    (adjusting_repression_expectation)


    """
    return functions.if_then_else(
        protest() > 0,
        repressive_threat_tr() *
        repression_fractional_adjustment() -
        expectation_of_repression_needed(),
        0)
def adjusting_concession_expectation():
    """
    Adjusting concession expectation
    --------------------------------
    (adjusting_concession_expectation)


    """
    return functions.if_then_else(
        protest() > 0,
        concessions() *
        concession_fractional_adjustment() -
        expectation_of_concessions_needed(),
        0)
Example #26
0
 def test_if_then_else_basic(self):
     """ If Then Else function"""
     from pysd.functions import if_then_else
     self.assertEqual(if_then_else(True, 1, 0), 1)
     self.assertEqual(if_then_else(False, 1, 0), 0)
Example #27
0
 def test_if_then_else_basic(self):
     """ If Then Else function"""
     from pysd.functions import if_then_else
     self.assertEqual(if_then_else(True, 1, 0), 1)
     self.assertEqual(if_then_else(False, 1, 0), 0)