本文整理汇总了C#中ITashaHousehold类的典型用法代码示例。如果您正苦于以下问题:C# ITashaHousehold类的具体用法?C# ITashaHousehold怎么用?C# ITashaHousehold使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITashaHousehold类属于命名空间,在下文中一共展示了ITashaHousehold类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Execute
public void Execute(ITashaHousehold household, int iteration)
{
foreach(var period in TimePeriods)
{
period.Execute(household);
}
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:7,代码来源:ExtractObservedDemandToPD.cs
示例2: GetWorkSchoolProjectStatus
public static HouseholdWorkSchoolProjectStatus GetWorkSchoolProjectStatus(ITashaHousehold household)
{
bool evening_workschool = false;
bool morning_workschool = false;
bool any_workschool = false;
foreach(var person in household.Persons)
{
PersonWorkSchoolProjectStatus workschoolProjectStatus = SchedulerPerson.GetWorkSchoolProjectStatus(person);
if(workschoolProjectStatus == PersonWorkSchoolProjectStatus.FullTimeEveningWorkOrSchool ||
workschoolProjectStatus == PersonWorkSchoolProjectStatus.FullTimeDayAndEveningWorkOrSchool ||
workschoolProjectStatus == PersonWorkSchoolProjectStatus.Other)
evening_workschool = true;
if(workschoolProjectStatus == PersonWorkSchoolProjectStatus.FullTimeNoEveningWorkOrSchool ||
workschoolProjectStatus == PersonWorkSchoolProjectStatus.FullTimeDayAndEveningWorkOrSchool ||
workschoolProjectStatus == PersonWorkSchoolProjectStatus.PartTimeDay ||
workschoolProjectStatus == PersonWorkSchoolProjectStatus.PartTimeEvening)
morning_workschool = true;
if(workschoolProjectStatus > 0) any_workschool = true;
}
if(!any_workschool) return HouseholdWorkSchoolProjectStatus.NoWorkOrSchool; // noone in hhld works or attends school today
else if(!evening_workschool) return HouseholdWorkSchoolProjectStatus.NoEveningWorkOrSchool; //there is work/school, but none after 6:00pm
else if(!morning_workschool) return HouseholdWorkSchoolProjectStatus.EveningWorkOrSchool; //there is evening work/school, but no work/school before 1:00pm
else return HouseholdWorkSchoolProjectStatus.DayAndEveningWorkOrSchool; // there is work/school before 1pm and after 6pm
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:26,代码来源:SchedulerHousehold.cs
示例3: Execute
public void Execute(ITashaHousehold household, int iteration)
{
lock ( this )
{
foreach ( var person in household.Persons )
{
foreach ( var tripChain in person.TripChains )
{
int CurrentNumberOfTrips = tripChain.Trips.Count;
if ( NumberOfTrips.ContainsKey( CurrentNumberOfTrips ) ) // Has this scenario occured previously?
{
NumberOfTrips[CurrentNumberOfTrips] += 1; // If it has, add one more occurence to it.
}
else
{
NumberOfTrips.Add( CurrentNumberOfTrips, 1 ); // If it hasn't, create the scenario and give it a value of one occurence at this point.
}
if ( CurrentNumberOfTrips == 1 )
{
throw new XTMFRuntimeException( "Household " + household.HouseholdId + " has a trip chain with only one trip. The trip chain belongs to person number " + person.Id );
}
}
}
}
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:27,代码来源:TripChainValidate.cs
示例4: Execute
public void Execute(ITashaHousehold household)
{
lock (this)
{
foreach(var person in household.Persons)
{
var expFactor = person.ExpansionFactor;
foreach(var tripChain in person.TripChains)
{
foreach(var trip in tripChain.Trips)
{
Dictionary<int, float> activityDictionary = GetDictionary(trip.Purpose);
int hour = trip.ActivityStartTime.Hours;
if(activityDictionary.ContainsKey(hour))
{
activityDictionary[hour] += expFactor;
}
else
{
activityDictionary.Add(hour, expFactor);
}
}
}
}
}
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:26,代码来源:StartTimeIPostScheduler.cs
示例5: Execute
public void Execute(ITashaHousehold household, int iteration)
{
var persons = household.Persons;
bool taken = false;
WriteLock.Enter(ref taken);
for(int i = 0; i < persons.Length; i++)
{
var expanionFactor = persons[i].ExpansionFactor;
var tripChains = persons[i].TripChains;
for(int j = 0; j < tripChains.Count; j++)
{
var tripChain = tripChains[j].Trips;
for(int k = 0; k < tripChain.Count; k++)
{
var mode = tripChain[k].Mode;
for(int l = 0; l < Modes.Length; l++)
{
if(Modes[l] == mode)
{
Counts[l] += expanionFactor;
break;
}
}
}
}
}
if(taken) WriteLock.Exit(true);
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:28,代码来源:ModeSplit.cs
示例6: HouseholdComplete
public void HouseholdComplete(ITashaHousehold household, bool success)
{
if ( success )
{
lock ( this )
{
var writeHeader = !File.Exists( OutputFile );
using ( StreamWriter writer = new StreamWriter( OutputFile, true ) )
{
if ( writeHeader )
{
writer.WriteLine( "HouseholdID,HouseholdIteration,Household Utility" );
}
var util = Utilities[household.HouseholdId];
for ( int i = 0; i < util.Length; i++ )
{
writer.Write( household.HouseholdId );
writer.Write( ',' );
writer.Write( i );
writer.Write( ',' );
writer.WriteLine( util[i] );
}
}
}
}
else
{
throw new XTMFRuntimeException( "A household was not able to be resolved." );
}
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:30,代码来源:HouseholdUtilities.cs
示例7: Execute
public void Execute(ITashaHousehold household)
{
lock ( this )
{
var householdData = household["SData"] as Tasha.Scheduler.SchedHouseholdData;
ResultDict["JointMarket"] += household.ExpansionFactor * householdData.JointMarketProject.Schedule.EpisodeCount;
NumberDict["JointMarket"] += householdData.JointMarketProject.Schedule.EpisodeCount;
ResultDict["JointOther"] += household.ExpansionFactor * householdData.JointOtherProject.Schedule.EpisodeCount;
NumberDict["JointOther"] += householdData.JointOtherProject.Schedule.EpisodeCount;
foreach ( var person in household.Persons )
{
var schedData = person["SData"];
var personData = person["SData"] as Tasha.Scheduler.SchedulerPersonData;
var workSched = personData.WorkSchedule.Schedule;
var schoolSched = personData.SchoolSchedule.Schedule;
var marketSched = personData.MarketSchedule.Schedule;
var otherSched = personData.OtherSchedule.Schedule;
ResultDict["Work"] += household.ExpansionFactor * workSched.EpisodeCount;
NumberDict["Work"] += workSched.EpisodeCount;
ResultDict["School"] += schoolSched.EpisodeCount * household.ExpansionFactor;
NumberDict["School"] += schoolSched.EpisodeCount;
ResultDict["Market"] += marketSched.EpisodeCount * household.ExpansionFactor;
NumberDict["Market"] += marketSched.EpisodeCount;
ResultDict["Other"] += household.ExpansionFactor * otherSched.EpisodeCount;
NumberDict["Other"] += otherSched.EpisodeCount;
}
}
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:35,代码来源:ProjectLevel.cs
示例8: Execute
public void Execute(ITashaHousehold household, int iteration)
{
lock ( this )
{
foreach ( var person in household.Persons )
{
foreach ( var tripChain in person.TripChains )
{
foreach ( var trip in tripChain.Trips )
{
var householdIterations = trip.ModesChosen == null ? 1 : trip.ModesChosen.Length;
for ( int i = 0; i < householdIterations; i++ )
{
if ( trip.ModesChosen[i] == null )
{
this.Validate1.Write( "Problem in household #" );
this.Validate1.WriteLine( household.HouseholdId );
}
else
{
if ( trip.ModesChosen[i].ModeName == "Auto" )
{
Count += 1;
}
}
}
}
}
}
}
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:31,代码来源:AutoSanityCheck.cs
示例9: Execute
public void Execute(ITashaHousehold household, int iteration)
{
var autoNetworkData = this.Root.NetworkData.FirstOrDefault( (network) => network.NetworkType == this.NetworkName );
var zones = this.Root.ZoneSystem.ZoneArray.GetFlatData();
if ( autoNetworkData == null )
{
throw new XTMFRuntimeException( "We could not find the '" + this.NetworkName + "' network!" );
}
foreach ( var person in household.Persons )
{
foreach ( var tripChain in person.TripChains )
{
for ( int i = 0; i < tripChain.Trips.Count - 1; i++ )
{
var trip = tripChain.Trips[i];
var nextTrip = tripChain.Trips[i + 1];
if ( trip.Purpose == Activity.Market && nextTrip.Purpose == Activity.Market )
{
var originIndex = this.Root.ZoneSystem.ZoneArray.GetFlatIndex( trip.OriginalZone.ZoneNumber );
// run my logic here
for(int j = 0; j < zones.Length; j++)
{
var travelTime = autoNetworkData.TravelTime( originIndex, j, trip.TripStartTime );
}
}
}
}
}
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:31,代码来源:DemoSparseArray.cs
示例10: Execute
public void Execute(ITashaHousehold household, int iteration)
{
var persons = household.Persons;
for (int i = 0; i < persons.Length; i++)
{
if (persons[i].Age >= MinimumAge)
{
var expansionFactor = persons[i].ExpansionFactor;
var tripChains = persons[i].TripChains;
for (int j = 0; j < tripChains.Count; j++)
{
var tripChain = tripChains[j].Trips;
for (int k = 0; k < tripChain.Count; k++)
{
int index = (((int)(TripStartTime ? tripChain[k].TripStartTime : tripChain[k].ActivityStartTime).ToMinutes()) / 30);
var tripStartIndex = index < 0 ? (index % NumberOfTimeBins + NumberOfTimeBins) % NumberOfTimeBins : index % NumberOfTimeBins;
var array = GetPurposeCount(tripChain, k);
var tripModeIndex = GetTripModeIndex(tripChain[k].Mode);
if (tripModeIndex >= 0)
{
var row = array[tripStartIndex];
lock (array[tripStartIndex])
{
row[tripModeIndex] += expansionFactor;
}
}
}
}
}
}
}
开发者ID:dianatle,项目名称:XTMF,代码行数:31,代码来源:StartTimeDistributions.cs
示例11: Execute
public void Execute(ITashaHousehold household, int iteration)
{
//Determine the worker category
int nVehicles = household.Vehicles.Length;
int nDrivers = household.Persons.Count((ITashaPerson p) => p.Licence);
int wcat;
if (nVehicles == 0)
{
wcat = 0;
}
else
{
wcat = (nVehicles > nDrivers) ? 2 : 1;
}
foreach (var person in household.Persons)
{
var empStat = person.EmploymentStatus;
if (empStat == TMG.TTSEmploymentStatus.FullTime | empStat == TMG.TTSEmploymentStatus.PartTime) continue; //Skip unemployed persons
IZone employmentZone = person.EmploymentZone;
if ( employmentZone == null ) continue;
var distance = (int) (this._ZoneDistances[household.HomeZone.ZoneNumber, employmentZone.ZoneNumber] * this.CoordinateFactor);
int index = this.HistogramBins.IndexOf(distance);
if (index < 0)
{
index = this.HistogramBins.Count;
}
bool taken = false;
WriteLock.Enter(ref taken);
this._BinData[index][wcat] += person.ExpansionFactor;
if (taken) WriteLock.Exit(true);
}
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:34,代码来源:LinkageDistanceHistogram.cs
示例12: HouseholdIterationComplete
public void HouseholdIterationComplete(ITashaHousehold household, int hhldIteration, int totalHouseholdIterations)
{
for ( int i = 0; i < household.Persons.Length; i++ )
{
for ( int j = 0; j < household.Persons[i].TripChains.Count; j++ )
{
if ( household.Persons[i].TripChains[j].JointTrip && !household.Persons[i].TripChains[j].JointTripRep )
{
continue;
}
for ( int k = 0; k < household.Persons[i].TripChains[j].Trips.Count; k++ )
{
var trip = household.Persons[i].TripChains[j].Trips[k];
if ( trip.Mode == this.Root.AllModes[PassengerIndex] )
{
using ( StreamWriter Writer = new StreamWriter( this.OutputFile, true ) )
{
var originalTrip = trip["Driver"] as ITrip;
var originalDistance = this.Root.ZoneSystem.Distances[originalTrip.OriginalZone.ZoneNumber, originalTrip.DestinationZone.ZoneNumber];
var passengerDistance = this.Root.ZoneSystem.Distances[trip.OriginalZone.ZoneNumber, trip.DestinationZone.ZoneNumber];
float firstLeg;
float secondLeg;
if ( originalTrip.OriginalZone == trip.OriginalZone )
{
firstLeg = 0;
}
if ( originalTrip.DestinationZone == trip.DestinationZone )
{
secondLeg = 0;
}
firstLeg = this.Root.ZoneSystem.Distances[originalTrip.OriginalZone.ZoneNumber, trip.OriginalZone.ZoneNumber];
secondLeg = this.Root.ZoneSystem.Distances[trip.DestinationZone.ZoneNumber, originalTrip.DestinationZone.ZoneNumber];
var newDistance = ( passengerDistance + firstLeg + secondLeg );
if ( Data.Keys.Contains( passengerDistance ) )
{
Data[passengerDistance].Add( newDistance );
}
else
{
Data.TryAdd( passengerDistance, new List<float>() );
Data[passengerDistance].Add( newDistance );
}
//Writer.WriteLine( "{0}, {1}, {2}, {3}, {4}", household.HouseholdId, household.Persons[i].Id, originalTrip.TripChain.Person.Id, passengerDistance, newDistance );
}
}
}
}
}
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:58,代码来源:ValidatePass.cs
示例13: Run
public void Run(ITashaHousehold household)
{
Random householdRandom = new Random( this.Seed * household.HouseholdId );
var persons = household.Persons;
List<IActivityEpisode>[] episodes = InitializeEpisodes( persons );
GenerateEpisodes( household, householdRandom, persons, episodes );
OrderPriorities( episodes );
ScheduleEpisodes( household, householdRandom, persons, episodes );
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:9,代码来源:Scheduler.cs
示例14: Execute
public void Execute(ITashaHousehold household, int iteration)
{
var householdFitness = (float)EvaluateHousehold(household);
bool taken = false;
FitnessUpdateLock.Enter(ref taken);
Thread.MemoryBarrier();
Fitness += householdFitness;
if(taken) FitnessUpdateLock.Exit(true);
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:9,代码来源:IntegrateIntoEstimationFramework.cs
示例15: ModeChoiceHouseholdData
public ModeChoiceHouseholdData(ITashaHousehold household, int numberOfModes, int numberOfVehicleTypes)
{
var persons = household.Persons;
var personData = PersonData = new ModeChoicePersonData[persons.Length];
for ( int i = 0; i < personData.Length; i++ )
{
personData[i] = new ModeChoicePersonData( persons[i].TripChains, numberOfModes, numberOfVehicleTypes );
}
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:9,代码来源:ModeChoiceHouseholdData.cs
示例16: Execute
public void Execute(ITashaHousehold household, int iteration)
{
var persons = household.Persons;
var pd = household.HomeZone.PlanningDistrict;
var expFactor = household.ExpansionFactor;
for ( int i = 0; i < persons.Length; i++ )
{
this.Data.AddEntry( persons[i], pd, expFactor );
}
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:10,代码来源:ExtractPersonData.cs
示例17: Person
/// <summary>
/// Creates a new person
/// </summary>
/// <param name="household">The household that this person belongs to, may not be null!</param>
/// <param name="id">The identifyer for this person</param>
/// <param name="age">The age of this person</param>
/// <param name="employmentStatus">How this person is employed, if at all</param>
/// <param name="studentStatus">If this person is a student, and if so what type of student</param>
/// <param name="female">Is this person female</param>
/// <param name="licence">Does this person have a driver's licence</param>
public Person(ITashaHousehold household, int id, int age, Occupation occupation, TTSEmploymentStatus employmentStatus, StudentStatus studentStatus, bool license, bool female)
: this()
{
this.Household = household;
this.Id = id;
this.Age = age;
this.Occupation = occupation;
this.EmploymentStatus = employmentStatus;
this.StudentStatus = studentStatus;
this.Licence = license;
this.Female = female;
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:22,代码来源:Person.cs
示例18: Person
/// <summary>
/// Creates a new person
/// </summary>
/// <param name="household">The household that this person belongs to, may not be null!</param>
/// <param name="id">The identifyer for this person</param>
/// <param name="age">The age of this person</param>
/// <param name="employmentStatus">How this person is employed, if at all</param>
/// <param name="studentStatus">If this person is a student, and if so what type of student</param>
/// <param name="female">Is this person female</param>
/// <param name="licence">Does this person have a driver's licence</param>
public Person(ITashaHousehold household, int id, int age, Occupation occupation, TTSEmploymentStatus employmentStatus, StudentStatus studentStatus, bool license, bool female)
: this()
{
Household = household;
Id = id;
Age = age;
Occupation = occupation;
EmploymentStatus = employmentStatus;
StudentStatus = studentStatus;
Licence = license;
Female = female;
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:22,代码来源:Person.cs
示例19: Execute
public void Execute(ITashaHousehold household, int iteration)
{
lock ( this )
{
foreach ( var p in household.Persons )
{
if ( p.TripChains.Count < 1 )
continue; //Skip people with no trips
var sb = new StringBuilder();
if ( string.IsNullOrEmpty( this.HomeAnchorOverrideName ) )
{
sb.Append( Activity.Home.ToString() );
}
else
{
var x = p.TripChains[0].GetVariable( this.HomeAnchorOverrideName );
if ( x != null ) sb.Append( x.ToString() );
else sb.Append( Activity.Home.ToString() );
}
foreach ( var trip in p.TripChains[0].Trips )
{
sb.AppendFormat( ",{0}", trip.Purpose.ToString() );
}
var key = sb.ToString();
if ( this.data.ContainsKey( key ) )
{
if ( this.UseExpansionFactor )
{
this.data[key] += household.ExpansionFactor;
}
else
{
this.data[key]++;
}
}
else
{
if ( this.UseExpansionFactor )
{
this.data.Add( key, household.ExpansionFactor );
}
else
{
this.data.Add( key, 1 );
}
}
}
}
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:52,代码来源:EnumerateTourTypes.cs
示例20: Generate
public void Generate(ITashaHousehold household, ITashaPerson person, List<IActivityEpisode> episodes, Random rand)
{
if ( person.StudentStatus == StudentStatus.FullTime )
{
this.School.Generate( household, person, episodes, rand );
this.Work.Generate( household, person, episodes, rand );
}
else
{
this.Work.Generate( household, person, episodes, rand );
this.School.Generate( household, person, episodes, rand );
}
}
开发者ID:Cocotus,项目名称:XTMF,代码行数:13,代码来源:WorkSchoolProject.cs
注:本文中的ITashaHousehold类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论