Ensure that the model objects mixing variables are added to its list of
        individual variables.
763480
def _add_mixing_variable_names_to_individual_vars(self):
        
        assert isinstance(self.ind_var_names, list)
        # Note that if one estimates a mixed logit model, then the mixing
        # variables will be added to individual vars. And if one estimates
        # the model again (perhaps from different starting values), then
        # an error will be raised when creating the coefs series because we
        # will have added the mixing variables twice. The condition below
        # should prevent this error.
        already_included = any(["Sigma " in x for x in self.ind_var_names])

        if self.mixing_vars is not None and not already_included:
            new_ind_var_names = ["Sigma " + x for x in self.mixing_vars]
            self.ind_var_names += new_ind_var_names
        return None
1058509
def create_dummy_vars():
  """"""
  var_names = set([v.name for v in tf.global_variables()])
  if "losses_avg/problem_0/total_loss:0" in var_names:
    return
  with tf.variable_scope("losses_avg"):
    with tf.variable_scope("problem_0"):
      for var_name in ["total", "extra", "training"]:
        tf.get_variable(
            "%s_loss" % var_name, initializer=100.0, trainable=False)
  with tf.variable_scope("train_stats"):
    tf.get_variable("problem_0_steps", initializer=0, trainable=False)
1018118
def add_variables(*vars)
      # create bound variables for each variable
      bound_vars = vars.collect do |v|
        BoundVariable.new v, self
      end

      # add all the bound variables to the variables hash
      keys = vars.collect(&:name)
      append_hash = Hash[ keys.zip(bound_vars) ]
      @variables_hash.merge!(append_hash) do |key, oldval, newval|
        oldval # the first bound variable
      end
    end
1254242
private void initVariables() {
        if (this.currentChunk == null) {
            this.currentChunk = new Instances(this.getModelContext());
        }

        if (this.classDistributions == null) {
            this.classDistributions = new long[this.getModelContext().classAttribute().numValues()];

            for (int i = 0; i < this.classDistributions.length; i++) {
                this.classDistributions[i] = 0;
            }
        }
    }
664125
def expand_and_merge_variables(objs, priority_arg=None):
    
    expanded = expand_variable_dicts(objs)
    priority_vars = _get_priority_vars(objs, priority_arg)
    variables = merge_variables(expanded, priority_vars)
    return variables
821989
def combine_vars(data, environment=None, vars=None, drop=True):
    
    if not vars:
        return pd.DataFrame()

    # For each layer, compute the facet values
    values = [eval_facet_vars(df, vars, environment)
              for df in data if df is not None]

    # Form the base data frame which contains all combinations
    # of facetting variables that appear in the data
    has_all = [x.shape[1] == len(vars) for x in values]
    if not any(has_all):
        raise PlotnineError(
            "At least one layer must contain all variables " +
            "used for facetting")
    base = pd.concat([x for i, x in enumerate(values) if has_all[i]],
                     axis=0)
    base = base.drop_duplicates()

    if not drop:
        base = unique_combs(base)

    # sorts according to order of factor levels
    base = base.sort_values(list(base.columns))

    # Systematically add on missing combinations
    for i, value in enumerate(values):
        if has_all[i] or len(value.columns) == 0:
            continue
        old = base.loc[:, base.columns - value.columns]
        new = value.loc[:, base.columns & value.columns].drop_duplicates()
        if not drop:
            new = unique_combs(new)
        base = base.append(cross_join(old, new), ignore_index=True)

    if len(base) == 0:
        raise PlotnineError(
            "Faceting variables must have at least one value")

    base = base.reset_index(drop=True)
    return base
774282
public TemplateVariables concat(Collection<TemplateVariable> variables) {

		List<TemplateVariable> result = new ArrayList<>(this.variables.size() + variables.size());
		result.addAll(this.variables);

		List<TemplateVariable> filtered = variables.stream() //
				.filter(variable -> !containsEquivalentFor(variable)).collect(Collectors.toList());

		result.addAll(filtered);

		return new TemplateVariables(result);
	}
40550
def __add_variables(self, *args, **kwargs):
        

        for variable in args:
            self.__variables[variable] = None
        self.__variables.update(kwargs)
28093
def set_conditions(self, variables, constraints):
        
        self._vars, self._constraints = variables, []
        self._constraints_for_var = {}
        vars_constraint_count = {}
        # build constraint objects
        for func, variables, values in constraints:
            c = Constraint(func, variables, values, self._compute_search_spaces(variables))
            self._constraints.append(c)
            for var in variables:
                self._constraints_for_var[var] = self._constraints_for_var.get(var, []) + [c]
                vars_constraint_count[var] = vars_constraint_count.get(var, 0) + 1
        # sort into most constraining first
        self._constraints.sort()

        self._variable_expand_order = tuple(sorted(self._vars.keys(), key=vars_constraint_count.get, reverse=True))
132288
def _merge_variables(new, cur):
    
    new_added = set([])
    out = []
    for cur_var in cur:
        updated = False
        for new_var in new:
            if get_base_id(new_var["id"]) == get_base_id(cur_var["id"]):
                out.append(new_var)
                new_added.add(new_var["id"])
                updated = True
                break
        if not updated:
            out.append(cur_var)
    for new_var in new:
        if new_var["id"] not in new_added:
            out.append(new_var)
    return out
1302594
def setup_mult_dirs(self):
        
        # setup dirs to hold the original and multiplier model input quantities
        set_dirs = []
#        if len(self.pp_props) > 0 or len(self.zone_props) > 0 or \
#                        len(self.grid_props) > 0:
        if self.pp_props is not None or \
                        self.zone_props is not None or \
                        self.grid_props is not None or\
                        self.const_props is not None or \
                        self.kl_props is not None:
            set_dirs.append(self.arr_org)
            set_dirs.append(self.arr_mlt)
 #       if len(self.bc_props) > 0:
        if len(self.temporal_list_props) > 0 or len(self.spatial_list_props) > 0:
            set_dirs.append(self.list_org)
        if len(self.spatial_list_props):
            set_dirs.append(self.list_mlt)

        for d in set_dirs:
            d = os.path.join(self.m.model_ws,d)
            self.log("setting up '{0}' dir".format(d))
            if os.path.exists(d):
                if self.remove_existing:
                    shutil.rmtree(d,onerror=remove_readonly)
                else:
                    raise Exception("dir '{0}' already exists".
                                    format(d))
            os.mkdir(d)
            self.log("setting up '{0}' dir".format(d))
974950
def _ensure_value_is_in_objects(self,val):
        
        if not (val in self.objects):
           self.objects.append(val)
908311
protected void initVariables(){
    	int ensembleSize = (int)this.memberCountOption.getValue();
        this.ensemble = new Classifier[ensembleSize];
        this.ensembleAges = new double[ensembleSize];
        this.ensembleWindows = new int[ensembleSize][(int)this.evaluationSizeOption.getValue()];    
    }
485008
private void addSubMatrixVariables(List<TokenList.Token> inputs, List<Variable> variables) {
        for (int i = 0; i < inputs.size(); i++) {
            TokenList.Token t = inputs.get(i);
            if( t.getType() != Type.VARIABLE )
                throw new ParseError("Expected variables only in sub-matrix input, not "+t.getType());
            Variable v = t.getVariable();
            if( v.getType() == VariableType.INTEGER_SEQUENCE || isVariableInteger(t) ) {
                variables.add(v);
            } else {
                throw new ParseError("Expected an integer, integer sequence, or array range to define a submatrix");
            }
        }
    }
260629
def _add_minimization_vars(self):
        """"""

        self._z = self._prob.namespace(self._model.reactions, lower=0)

        # Define constraints
        v = self._v.set(self._model.reactions)
        z = self._z.set(self._model.reactions)

        self._prob.add_linear_constraints(z >= v, v >= -z)
1048219
def store_variable(var)
      # Update the variable to track the index in the model
      index = @var_count + 1
      var.model = self
      var.index = index
      var.freeze
      @var_count += 1

      ret = LPSolve.add_columnex @ptr, 0, nil, nil
      fail if ret != 1

      # Set variable properties
      set_variable_type index, var.type

      ret = LPSolve.set_col_name(@ptr, index, var.name)
      fail if ret != 1

      ret = LPSolve.set_obj(@ptr, index, var.coefficient)
      fail if ret != 1

      set_variable_bounds index, var.lower_bound, var.upper_bound

      @variables << var
    end
72040
public void addDependentVariables(Variable ... depVars) {
		ArrayList<Variable> newDepVars = new ArrayList<Variable>();
		for (Variable v : this.dependentVariables) newDepVars.add(v);
		for (Variable v : depVars) newDepVars.add(v);
		this.dependentVariables = newDepVars.toArray(new Variable[newDepVars.size()]);
	}