本文整理汇总了C#中Variables类的典型用法代码示例。如果您正苦于以下问题:C# Variables类的具体用法?C# Variables怎么用?C# Variables使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Variables类属于命名空间,在下文中一共展示了Variables类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DetermineProgress
public QpProgressReport DetermineProgress(Variables iterate, Residuals residuals, double mu, int count)
{
var code = QpTerminationCode.InProgress;
double residualsNorm = residuals.InfinityNorm();
double phi = ComputeMeritFunction(residuals, residualsNorm);
this.UpdateMeritFunctionHistory(phi, count);
bool isMuSatisfied = (mu < Tolerance);
bool isRnormSatisfied = (residualsNorm < Tolerance * this.dataInfinityNorm);
if (isMuSatisfied && isRnormSatisfied)
{
code = QpTerminationCode.Success;
}
else if (count >= MaxIterations)
{
code = QpTerminationCode.MaxIterationsExceeded;
}
else if (count > 20 && phi >= 1e-8 && phi >= 1e4 * this.phiMinimumHistory[count - 1])
{
code = QpTerminationCode.Infeasible;
}
else if (count >= 30 && this.phiMinimumHistory[count] >= .5 * this.phiMinimumHistory[count - 30])
{
code = QpTerminationCode.Unknown;
}
return includeDetailedReport || code != QpTerminationCode.InProgress ?
new QpProgressReport(code, count, phi, iterate.Clone()) :
new QpProgressReport(code, count, phi, null);
}
开发者ID:markiemarkus,项目名称:QuadProg,代码行数:32,代码来源:QpProgressAnalyser.cs
示例2: NewtonSystem
public NewtonSystem(QpProblem data, Variables initialPoint)
{
this.Q = data.Q;
this.A = data.A;
this.initialCholeskyFactor = this.Factorize(initialPoint);
}
开发者ID:markiemarkus,项目名称:QuadProg,代码行数:7,代码来源:NewtonSystem.cs
示例3: QpProgressReport
public QpProgressReport(QpTerminationCode status, int iterations, double meritFunction, Variables currentIterate)
{
this.solveStatus = status;
this.iterations = iterations;
this.currentIterate = currentIterate == null ? null : currentIterate.Clone();
this.meritFunction = meritFunction;
}
开发者ID:markiemarkus,项目名称:QuadProg,代码行数:7,代码来源:QpProgressReport.cs
示例4: Write
public void Write(FieldsParser information, string formName)
{
Variables variables = new Variables();
SqlTransaction sqlTransaction = SqlConn.BeginTransaction();
try
{
MasterConnection.SP.Execute(SqlConn, sqlTransaction, information.Master, variables);
foreach (FieldsGroupConnection detailConnection in DetailConnections)
{
foreach (FieldsParser.Fields fields in information.Details)
{
if (fields.NodeName == detailConnection.Name)
{
detailConnection.SP.Execute(SqlConn, sqlTransaction, fields, variables);
}
}
}
sqlTransaction.Commit();
}
catch
{
sqlTransaction.Rollback();
throw;
}
}
开发者ID:gcode-mirror,项目名称:chafam,代码行数:25,代码来源:SqlWriter.cs
示例5: Constructor_DetectsAdjacentCyclicalReference
public void Constructor_DetectsAdjacentCyclicalReference()
{
using (TestHostContext hc = new TestHostContext(this))
{
// Arrange.
var copy = new Dictionary<string, string>
{
{ "variable1", "1_$(variable2)" },
{ "variable2", "2_$(variable3)" },
{ "variable3", "3_$(variable2)" },
};
// Act.
List<string> warnings;
var variables = new Variables(hc, copy, new List<MaskHint>(), out warnings);
// Assert.
Assert.Equal(3, warnings.Count);
Assert.True(warnings.Any(x => string.Equals(x, StringUtil.Loc("Variable0ContainsCyclicalReference", "variable1"))));
Assert.True(warnings.Any(x => string.Equals(x, StringUtil.Loc("Variable0ContainsCyclicalReference", "variable2"))));
Assert.True(warnings.Any(x => string.Equals(x, StringUtil.Loc("Variable0ContainsCyclicalReference", "variable3"))));
Assert.Equal("1_$(variable2)", variables.Get("variable1"));
Assert.Equal("2_$(variable3)", variables.Get("variable2"));
Assert.Equal("3_$(variable2)", variables.Get("variable3"));
}
}
开发者ID:codedebug,项目名称:vsts-agent,代码行数:26,代码来源:VariablesL0.cs
示例6: Change
/// <summary>
/// Constructor
/// </summary>
/// <param name="variable"></param>
/// <param name="previousValue"></param>
/// <param name="newValue"></param>
public Change(Variables.IVariable variable, Values.IValue previousValue, Values.IValue newValue)
{
Variable = variable;
PreviousValue = previousValue;
NewValue = newValue;
Applied = false;
}
开发者ID:Assmann-Siemens,项目名称:ERTMSFormalSpecs,代码行数:13,代码来源:Change.cs
示例7: ButtonGenerate_Click
private void ButtonGenerate_Click(object sender, EventArgs e)
{
List<Variables> vList = new List<Variables>();
for (int i = 0; i < DGVProperties.Rows.Count - 1; i++)
{
Variables v = new Variables();
v.Name = DGVProperties.Rows[i].Cells[0].Value.ToString();
v.SQLType = DGVProperties.Rows[i].Cells[1].Value.ToString();
if (v.SQLType != null && v.SQLType != "")
v.CSharpType = SelectCSharpType(v.SQLType.ToLower());
if (DGVProperties.Rows[i].Cells[2].Value != null && DGVProperties.Rows[i].Cells[2].Value.ToString() != "")
v.VariableSize = Convert.ToInt32(DGVProperties.Rows[i].Cells[2].Value.ToString());
else
v.VariableSize = 0;
v.AllowNulls = Convert.ToBoolean(DGVProperties.Rows[i].Cells[3].Value);
vList.Add(v);
}
if (textBoxPath.Text.Length != 0 && textBoxPath.Text[textBoxPath.Text.Length - 1] != '\\')
textBoxPath.Text += "\\";
CreateClass.WriteProperties(vList, _className, textBoxPath.Text);
CreateClass.WriteData(vList, _className, textBoxPath.Text);
CreateClass.WriteBusiness(vList, _className, textBoxPath.Text);
CreateClass.WriteList(vList, _className, textBoxPath.Text);
}
开发者ID:bedashii,项目名称:ReturnMedz,代码行数:29,代码来源:MainMenu.cs
示例8: Constructor_AppliesMaskHints
public void Constructor_AppliesMaskHints()
{
using (TestHostContext hc = new TestHostContext(this))
{
// Arrange.
var copy = new Dictionary<string, string>
{
{ "MySecretName", "My secret value" },
{ "MyPublicVariable", "My public value" },
};
var maskHints = new List<MaskHint>
{
new MaskHint() { Type = MaskType.Variable, Value = "MySecretName" },
};
List<string> warnings;
var variables = new Variables(hc, copy, maskHints, out warnings);
// Act.
KeyValuePair<string, string>[] publicVariables = variables.Public.ToArray();
// Assert.
Assert.Equal(0, warnings.Count);
Assert.Equal(1, publicVariables.Length);
Assert.Equal("MyPublicVariable", publicVariables[0].Key);
Assert.Equal("My public value", publicVariables[0].Value);
Assert.Equal("My secret value", variables.Get("MySecretName"));
}
}
开发者ID:codedebug,项目名称:vsts-agent,代码行数:28,代码来源:VariablesL0.cs
示例9: ProcessFileContents
protected virtual void ProcessFileContents(File file, Variables.Root variables)
{
string[] contents = file.Contents.Split('\n');
int lineCount = 0, charCount = 0, maxCharsPerLine = 0;
foreach(string line in contents){
if (!line.Trim().Equals("{")){
++lineCount;
}
if (line.Length > 0){
int realLength = ParseUtils.CountCharacters(line);
charCount += realLength;
maxCharsPerLine = Math.Max(maxCharsPerLine, realLength);
}
}
variables.Increment(Key+"LinesTotal", lineCount);
variables.Increment(Key+"CharsTotal", charCount);
variables.Maximum(Key+"LinesMax", lineCount);
variables.Maximum(Key+"CharsMax", charCount);
variables.Maximum(Key+"CharsPerLineMax", maxCharsPerLine);
State state = variables.GetStateObject<State>(stateOwner);
FileIntValue fileLines = new FileIntValue(file, lineCount);
state.MaxLines.Add(fileLines);
state.MinLines.Add(fileLines);
FileIntValue fileChars = new FileIntValue(file, charCount);
state.MaxChars.Add(fileChars);
state.MinChars.Add(fileChars);
}
开发者ID:chylex,项目名称:Code-Statistics,代码行数:35,代码来源:AbstractLanguageFileHandler.cs
示例10: FinalizeProject
public override void FinalizeProject(Variables.Root variables)
{
base.FinalizeProject(variables);
variables.Average(Key+"LinesAvg", Key+"LinesTotal", Key+"CodeFiles");
variables.Average(Key+"CharsAvg", Key+"CharsTotal", Key+"CodeFiles");
variables.Average(Key+"CharsPerLineAvg", Key+"CharsTotal", Key+"LinesTotal");
State state = variables.GetStateObject<State>(stateOwner);
foreach(FileIntValue fi in state.MaxLines){
variables.AddToArray(Key+"LinesTop", GetFileObject(fi, variables));
}
foreach(FileIntValue fi in state.MinLines.Reverse()){
variables.AddToArray(Key+"LinesBottom", GetFileObject(fi, variables));
}
foreach(FileIntValue fi in state.MaxChars){
variables.AddToArray(Key+"CharsTop", GetFileObject(fi, variables));
}
foreach(FileIntValue fi in state.MinChars.Reverse()){
variables.AddToArray(Key+"CharsBottom", GetFileObject(fi, variables));
}
}
开发者ID:chylex,项目名称:Code-Statistics,代码行数:26,代码来源:AbstractLanguageFileHandler.cs
示例11: DynamicFunction
public DynamicFunction(string name, ParseNode node, Variables args, int minParameters = 0, int maxParameters = 0)
{
Node = node;
Arguments = args;
MinParameters = minParameters;
MaxParameters = maxParameters;
}
开发者ID:ErikBehar,项目名称:sequencer,代码行数:7,代码来源:Function.cs
示例12: Edit
/// <summary>
/// The edit.
/// </summary>
/// <param name="parentWindow">
/// The parent window.
/// </param>
/// <param name="variables">
/// The variables.
/// </param>
/// <param name="connections">
/// The connections.
/// </param>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
public bool Edit(IWin32Window parentWindow, Variables variables, Connections connections)
{
string jsonString = string.Empty;
var value = this.metaData.CustomPropertyCollection["Settings"].Value;
if (value != null)
{
jsonString = value.ToString();
}
List<InputColumnInfo> inputColumnInfos = new List<InputColumnInfo>();
foreach (IDTSInputColumn100 col in this.metaData.InputCollection[0].InputColumnCollection)
{
inputColumnInfos.Add(
new InputColumnInfo() { ColumnName = col.Name, DataType = col.DataType, LineageId = col.LineageID });
}
FillablePdfDestinationUIForm editor = new FillablePdfDestinationUIForm(
jsonString,
inputColumnInfos.ToArray());
editor.ShowDialog(parentWindow);
if (editor.DialogResult == DialogResult.OK || editor.DialogResult == DialogResult.Yes)
{
this.metaData.CustomPropertyCollection["Settings"].Value = editor.OutputConfigJsonString;
return true;
}
return false;
}
开发者ID:paradoxpotato,项目名称:SSIS_Components,代码行数:46,代码来源:FillablePdfDestinationUI.cs
示例13: Factorize
public ISolver<double> Factorize(Variables currentIterate, int iteration)
{
if (iteration == 0)
{
return this.initialCholeskyFactor;
}
return this.Factorize(currentIterate);
}
开发者ID:markiemarkus,项目名称:QuadProg,代码行数:9,代码来源:NewtonSystem.cs
示例14: Process
public override void Process(File file, Variables.Root variables)
{
base.Process(file, variables);
variables.Increment("fileTypeCode");
variables.Increment(Key+"CodeFiles");
ProcessFileContents(file, variables);
}
开发者ID:chylex,项目名称:Code-Statistics,代码行数:9,代码来源:AbstractLanguageFileHandler.cs
示例15: Script
static Script()
{
if (Vars == null)
Vars = new Variables();
if (Environment.OSVersion.Platform == PlatformID.Unix)
Environment.SetEnvironmentVariable("MONO_VISUAL_STYLES", "gtkplus");
Application.EnableVisualStyles();
}
开发者ID:BillTheBest,项目名称:IronAHK,代码行数:10,代码来源:Application.cs
示例16: Residuals
public Residuals(QpProblem data, Variables iterate)
{
this.Q = data.Q;
this.c = data.c;
this.A = data.A;
this.b = data.b;
this.Initialise();
this.Update(iterate);
}
开发者ID:markiemarkus,项目名称:QuadProg,代码行数:10,代码来源:Residuals.cs
示例17: Process
public override string Process(TemplateList list, Variables variables)
{
string processedText = text;
int offset = 0;
foreach(TemplateToken token in tokens){
offset = token.ReplaceToken(offset, list, variables, ref processedText);
}
return processedText;
}
开发者ID:chylex,项目名称:Code-Statistics,代码行数:11,代码来源:Template.cs
示例18: ProcessTemplate
public string ProcessTemplate(string templateName, Variables variables)
{
Template template;
if (templates.TryGetValue(templateName, out template)){
return template.Process(this, variables);
}
else{
throw new TemplateException(Lang.Get["TemplateErrorNotFound", templateName]);
}
}
开发者ID:chylex,项目名称:Code-Statistics,代码行数:11,代码来源:TemplateList.cs
示例19: GenerateInitialPoint
public Variables GenerateInitialPoint(QpProblem problem, Vector<double> x)
{
Vector<double> z = Vector<double>.Build.Dense(problem.A.ColumnCount, 1);
Vector<double> s = Vector<double>.Build.Dense(problem.A.ColumnCount, 1);
Variables initialPoint = new Variables(x, z, s);
this.startingResiduals = new Residuals(problem, initialPoint);
this.startingEquations = new NewtonSystem(problem, initialPoint);
return initialPoint;
}
开发者ID:markiemarkus,项目名称:QuadProg,代码行数:12,代码来源:QpSimpleStarter.cs
示例20: Frame
public Frame (Goal [] goals, Goal parent, BoundVariableSet boundVariables, Dictionary <string, Variable> variables)
{
this.goals = goals;
this.boundVariables = boundVariables;
this.HeadGoal = parent;
this.variables = new Variables(variables);
foreach (var goal in goals)
{
goal.Frame = this;
}
}
开发者ID:carriercomm,项目名称:prolog,代码行数:13,代码来源:Frame.cs
注:本文中的Variables类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论