Skip to content

Commit

Permalink
Added auction work
Browse files Browse the repository at this point in the history
  • Loading branch information
degtiarev committed Nov 6, 2017
1 parent aac61e2 commit d132ca9
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 44 deletions.
19 changes: 8 additions & 11 deletions src/Auction.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
public class Auction {

double bid;
double price;
double price = 3;
boolean isParetoEfficient = false;

void start()
{

String action(double bidA, double bidB) {
if (bidA > bidB) return "AgentA";
else return "AgentB";
}

void end()
{

public double getPrice() {
return price;
}

void updatePrice()
{

public void setPrice(double price) {
this.price = price;
}

}
13 changes: 7 additions & 6 deletions src/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public class Controller {

Random r = new Random();

void adjustCeiling()
{
void adjustCeiling() {
double solarEnergy = 0;

if (currentWeather.isSunShines) {
Expand All @@ -28,6 +27,10 @@ void adjustCeiling()

energyCeiling = solarEnergy + additionalEnergy;

System.out.println("Solar energy:" + solarEnergy);
System.out.println("Additional energy:" + additionalEnergy);
System.out.println("Total energy:" + energyCeiling);

}


Expand All @@ -36,10 +39,8 @@ public void setCurrentWeather(Weather currentWeather) {
}


void makeStep()
{


void makeStep() {
adjustCeiling();


}
Expand Down
30 changes: 13 additions & 17 deletions src/Heater.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,44 @@ public class Heater {
int lowLimit;
int upLimit;
double consumptionCoefficient;

double currentTemperature;


Weather currentWeather;


public Heater (double consumptionCoefficient, int lowLimit, int upLimit)
{
public Heater(double consumptionCoefficient, int lowLimit, int upLimit) {
this.lowLimit = lowLimit;
this.upLimit = upLimit;
this.consumptionCoefficient = consumptionCoefficient;
}


public ArrayList<Double> computeEnergyDemand (double currentTemperature)
{
ArrayList<Double> energies = new ArrayList<Double>();
for (int i = lowLimit; i >= upLimit; i++) {
public ArrayList<Double> computeEnergyDemand(double currentTemperature) {
ArrayList<Double> energies = new ArrayList<Double>();
for (int i = lowLimit; i >= upLimit; i++) {

double energy = consumptionCoefficient + 0.5 * (i - currentTemperature);
energies.add(energy);
}
return energies;
double energy = consumptionCoefficient + 0.5 * (i - currentTemperature);
energies.add(energy);
}
return energies;
}

public void setCurrentWeather(Weather currentWeather) {
this.currentWeather = currentWeather;
}


public void heat(double currentTemperature)
{
public void heat(double currentTemperature) {


}

public void getCredits()
{
public void getCredits() {

}

public void getEnergy()
{
public void getEnergy() {

}

Expand Down
21 changes: 16 additions & 5 deletions src/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,31 @@ public class Main {
private static final int lowLimitB = 20;
private static final int upLimitB = 23;

private static Heater agentA = new Heater(consumtionCoeficintA, lowLimitA, upLimitA);;
private static Heater agentB = new Heater(consumtionCoeficintB, lowLimitB, upLimitB);;
private static Controller agentC = new Controller();;
private static Heater agentA = new Heater(consumtionCoeficintA, lowLimitA, upLimitA);
;
private static Heater agentB = new Heater(consumtionCoeficintB, lowLimitB, upLimitB);
;
private static Controller agentC = new Controller();
;
private static ArrayList<Weather> weatherSet = new ArrayList<Weather>();

public static void main(String[] args) {

populateWeatherSet();
int i = 0;

for (Weather weatherItem : weatherSet) {
System.out.println("Step: " + i);

for (Weather weatherItem: weatherSet)
{
agentA.setCurrentWeather(weatherItem);
agentB.setCurrentWeather(weatherItem);
agentC.setCurrentWeather(weatherItem);
agentC.makeStep();

i++;

System.out.println("*********************************************************");
System.out.println();
}

}
Expand Down
8 changes: 3 additions & 5 deletions src/SolarPanel.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
public class SolarPanel {

private static final double peakPower = 3;
private static final double peakPower = 3;

double sunLevel;
double amountOfGeneratedEnergy;


public void setSunLevel(double sunLevel)
{
public void setSunLevel(double sunLevel) {
this.sunLevel = sunLevel;

}

public void generateEnergy()
{
public void generateEnergy() {
amountOfGeneratedEnergy = peakPower * sunLevel;
}

Expand Down

0 comments on commit d132ca9

Please sign in to comment.