We’re rewarding the question askers & reputations are being recalculated! Read more.
2 added syntax-highlighting
source | link

It sounds like all these conditional statements that you're talking about should really be data that configures your program rather than part of your program itself. If you can treat them that way, then you'll be free to modify the way your program works by just changing its configuration instead of having to modify your code and recompile every time you want to improve your model.

There are a lot of different ways to model the real world, depending on the nature of your problem. Your various conditions might become rules or constraints that are applied to the simulation. Instead of having code that looks like:

if (sunLevel > 0.75) {
   foreach(cow in cows) {
       cow.desireForShade += 0.5;
   }
}
if (precipitation > 0.2) {
   foreach(cow in cows) {
       cow.desireForShelter += 0.8;
   }
}
if (sunLevel > 0.75) {
   foreach(cow in cows) {
       cow.desireForShade += 0.5;
   }
}
if (precipitation > 0.2) {
   foreach(cow in cows) {
       cow.desireForShelter += 0.8;
   }
}

you can instead have code that looks like:

foreach(rule in rules) {
   foreach (cow in cows) {
      cow.apply(rule);
   }
}
foreach(rule in rules) {
   foreach (cow in cows) {
      cow.apply(rule);
   }
}

Or, if you can develop a linear program that models cow behavior given a number of inputs, each constraint might become a line in a system of equations. You might then turn that into a Markov model that you can iterate.

It's hard to say what the right approach is for your situation, but I think you'll have a much easier time of it if you consider your constraints to be inputs to your program and not code.

It sounds like all these conditional statements that you're talking about should really be data that configures your program rather than part of your program itself. If you can treat them that way, then you'll be free to modify the way your program works by just changing its configuration instead of having to modify your code and recompile every time you want to improve your model.

There are a lot of different ways to model the real world, depending on the nature of your problem. Your various conditions might become rules or constraints that are applied to the simulation. Instead of having code that looks like:

if (sunLevel > 0.75) {
   foreach(cow in cows) {
       cow.desireForShade += 0.5;
   }
}
if (precipitation > 0.2) {
   foreach(cow in cows) {
       cow.desireForShelter += 0.8;
   }
}

you can instead have code that looks like:

foreach(rule in rules) {
   foreach (cow in cows) {
      cow.apply(rule);
   }
}

Or, if you can develop a linear program that models cow behavior given a number of inputs, each constraint might become a line in a system of equations. You might then turn that into a Markov model that you can iterate.

It's hard to say what the right approach is for your situation, but I think you'll have a much easier time of it if you consider your constraints to be inputs to your program and not code.

It sounds like all these conditional statements that you're talking about should really be data that configures your program rather than part of your program itself. If you can treat them that way, then you'll be free to modify the way your program works by just changing its configuration instead of having to modify your code and recompile every time you want to improve your model.

There are a lot of different ways to model the real world, depending on the nature of your problem. Your various conditions might become rules or constraints that are applied to the simulation. Instead of having code that looks like:

if (sunLevel > 0.75) {
   foreach(cow in cows) {
       cow.desireForShade += 0.5;
   }
}
if (precipitation > 0.2) {
   foreach(cow in cows) {
       cow.desireForShelter += 0.8;
   }
}

you can instead have code that looks like:

foreach(rule in rules) {
   foreach (cow in cows) {
      cow.apply(rule);
   }
}

Or, if you can develop a linear program that models cow behavior given a number of inputs, each constraint might become a line in a system of equations. You might then turn that into a Markov model that you can iterate.

It's hard to say what the right approach is for your situation, but I think you'll have a much easier time of it if you consider your constraints to be inputs to your program and not code.

    Post Made Community Wiki by Dylan Rosario
1
source | link

It sounds like all these conditional statements that you're talking about should really be data that configures your program rather than part of your program itself. If you can treat them that way, then you'll be free to modify the way your program works by just changing its configuration instead of having to modify your code and recompile every time you want to improve your model.

There are a lot of different ways to model the real world, depending on the nature of your problem. Your various conditions might become rules or constraints that are applied to the simulation. Instead of having code that looks like:

if (sunLevel > 0.75) {
   foreach(cow in cows) {
       cow.desireForShade += 0.5;
   }
}
if (precipitation > 0.2) {
   foreach(cow in cows) {
       cow.desireForShelter += 0.8;
   }
}

you can instead have code that looks like:

foreach(rule in rules) {
   foreach (cow in cows) {
      cow.apply(rule);
   }
}

Or, if you can develop a linear program that models cow behavior given a number of inputs, each constraint might become a line in a system of equations. You might then turn that into a Markov model that you can iterate.

It's hard to say what the right approach is for your situation, but I think you'll have a much easier time of it if you consider your constraints to be inputs to your program and not code.