Skip to content

Commit

Permalink
Enable debugging mode on LRGV and WDS
Browse files Browse the repository at this point in the history
  • Loading branch information
dhadka committed Jan 1, 2025
1 parent 136939f commit 3bf5f97
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 3 deletions.
7 changes: 7 additions & 0 deletions native/LRGV/src/lrgv_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ int main(int argc, char **argv)
{
MOEA_Read_doubles(nvars,vars); //first read the solution

// TODO: Remove
MOEA_Debug("Vars: %lf %lf %lf %lf %lf %lf %lf %lf\n", vars[0], vars[1], vars[2], vars[3], vars[4], vars[5], vars[6], vars[7]);

//If the mode is 'combined' you need to run the drought scenario.
//Otherwise, you can skip it. NOTE we should probably check that if
//drtranscost is listed as an objective, or one of the other 'dr'
Expand All @@ -267,6 +270,10 @@ int main(int argc, char **argv)
calc_LRGV(vars, objs, consts, local_calcparam);
}

// TODO: Remove
MOEA_Debug("Objs: %lf %lf %lf %lf %lf %lf\n", objs[0], objs[1], objs[2], objs[3], objs[4], objs[5]);
MOEA_Debug("Constrs: %lf %lf %lf %lf %lf\n", consts[0], consts[1], consts[2], consts[3]);

MOEA_Write(objs, consts);
//cerr << "Just calculated" << endl;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/moeaframework/benchmarks/LRGV.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public class LRGV extends ExternalProblem {
public LRGV() {
super(new Builder()
.withCommand(SystemUtils.IS_OS_WINDOWS ? "lrgv.exe" : "lrgv", "-m", "std-io", "-b", "AllDecAll", "-c", "ten-year")
.withWorkingDirectory(new File("./native/LRGV/bin/")));
.withWorkingDirectory(new File("./native/LRGV/bin/"))
.withDebugging());
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/moeaframework/benchmarks/WDS.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ public double[] getEpsilon() {
public Builder getBuilder() {
return new Builder()
.withCommand(SystemUtils.IS_OS_WINDOWS ? getName() + ".exe" : getName())
.withWorkingDirectory(new File("./native/WDS/bin/"));
.withWorkingDirectory(new File("./native/WDS/bin/"))
.withDebugging();
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected void testSolution(String problemName, double[] variables, double[] exp
}

try {
Assert.assertArrayEquals("Constraints do not match", expectedConstraints, solution.getConstraintValues(), EPS);
Assert.assertArrayEquals("Constraints do not match", expectedConstraints, solution.getConstraintValues(), EPS);
} catch (AssertionError e) {
System.out.println("Actual Constraints: " + Arrays.toString(solution.getConstraintValues()));
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
*/
package org.moeaframework.benchmarks;

import org.junit.Ignore;
import org.junit.Test;

@Ignore
public class CarSideImpactTest extends AbstractProblemTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
*/
package org.moeaframework.benchmarks;

import org.junit.Ignore;
import org.junit.Test;

@Ignore
public class ElectricMotorTest extends AbstractProblemTest {

@Test
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/org/moeaframework/benchmarks/GAATest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
*/
package org.moeaframework.benchmarks;

import org.junit.Ignore;
import org.junit.Test;

@Ignore
public class GAATest extends AbstractProblemTest {

@Test
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/org/moeaframework/benchmarks/HBVTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
*/
package org.moeaframework.benchmarks;

import org.junit.Ignore;
import org.junit.Test;

@Ignore
public class HBVTest extends AbstractProblemTest {

@Test
Expand Down
24 changes: 24 additions & 0 deletions src/test/java/org/moeaframework/benchmarks/LRGVTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
*/
package org.moeaframework.benchmarks;

import org.junit.Ignore;
import org.junit.Test;

public class LRGVTest extends AbstractProblemTest {

@Test
@Ignore
public void testSolve() {
testSolve("LRGV");
}
Expand All @@ -44,4 +46,26 @@ public void testUpperBound() {
false);
}

// Windows:
// Starting process '.\native\LRGV\bin\lrgv.exe -m std-io -b AllDecAll -c ten-year'
// << 0.0 0.0 0.1 0.1 0.0 0.0 0.0 0.0
// >> 0.067799999999999999 0.54275000000000007 0.052332950946083 0 0 0 -0.6038095238095238 -0.45176767676767671 0 1372.9499999999534
// Actual Constraints: [-0.6038095238095238, -0.4517676767676767, 0.0, 1372.9499999999534]
// Waiting for process to exit...
// Process exited with code 0
// Starting process '.\native\LRGV\bin\lrgv.exe -m std-io -b AllDecAll -c ten-year'
// << 1.0 1.0 1.0 0.4 3.0 0.0 3.0 0.0
// >> 0.14688755308684337 1 0.73901009177481636 0.0013347587141167424 0.00081400000000000005 1.11011894436792e-311 0 0 -0.0080529641534905494 15
// Actual Constraints: [0.0, 0.0, -0.00805296415349055, 15.0]

// Linux:
// Starting process './lrgv -m std-io -b AllDecAll -c ten-year'
// << 0.0 0.0 0.1 0.1 0.0 0.0 0.0 0.0
// >> 0.067799999999999999 0.54275000000000007 0.052332950946083 0 0 8.2373232240163736e-67 -0.6038095238095238 -0.45176767676767671 0 0
// Waiting for process to exit...
// Process exited with code 0
// Starting process './lrgv -m std-io -b AllDecAll -c ten-year'
// << 1.0 1.0 1.0 0.4 3.0 0.0 3.0 0.0
// >> 0.14688755308684337 1 0.73901009177481636 0.0013347587141167424 0.00081400000000000005 8.2373232240163736e-67 0 0 -0.0080529641534905494 0

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
*/
package org.moeaframework.benchmarks;

import org.junit.Ignore;
import org.junit.Test;

@Ignore
public class LakeProblemTest extends AbstractProblemTest {

@Test
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/org/moeaframework/benchmarks/RadarTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
package org.moeaframework.benchmarks;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

@Ignore
public class RadarTest extends AbstractProblemTest {

@Before
Expand Down
24 changes: 24 additions & 0 deletions src/test/java/org/moeaframework/benchmarks/WDSTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
*/
package org.moeaframework.benchmarks;

import org.junit.Ignore;
import org.junit.Test;

@Ignore
public class WDSTest extends AbstractProblemTest {

@Test
Expand Down Expand Up @@ -49,4 +51,26 @@ public void testUpperBound() {
true);
}

// Windows:
// Starting process '.\native\WDS\bin\GOY.exe'
// << 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
// >> 0.17467288672924042 1.045642614364624 -1909.0999755859375
// Actual Objectives: [0.17467288672924042, 1.045642614364624]
// Waiting for process to exit...
// Process exited with code 0
// Starting process '.\native\WDS\bin\GOY.exe'
// << 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
// >> 0.32972565293312073 1.045642614364624 -1909.0999755859375
// Actual Objectives: [0.3297256529331207, 1.045642614364624]

// Linux:
// Starting process './GOY'
// << 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
// >> 0.17467288672924042 -6.1195673942565918 -2390.6025390625
// Waiting for process to exit...
// Process exited with code 0
// Starting process './GOY'
// << 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
// >> 0.32972565293312073 0.71250671148300171 -0

}

0 comments on commit 3bf5f97

Please sign in to comment.