
org.moeaframework.problem.NativeProblem Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of real-world-benchmarks Show documentation
Show all versions of real-world-benchmarks Show documentation
Real world benchmark problems for the MOEA Framework
The newest version!
/* Copyright 2009-2024 David Hadka and other contributors
*
* This file is part of the MOEA Framework.
*
* The MOEA Framework is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* The MOEA Framework is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the MOEA Framework. If not, see .
*/
package org.moeaframework.problem;
import java.io.IOException;
import org.moeaframework.core.FrameworkException;
public abstract class NativeProblem extends ExternalProblem {
private final NativeCommand command;
public NativeProblem(NativeCommand command) {
super(startProcessOrThrow(command));
this.command = command;
}
public NativeCommand getCommand() {
return command;
}
private static final Process startProcessOrThrow(NativeCommand command) {
try {
return command.exec();
} catch (IOException e) {
throw new FrameworkException("Failed to start native process", e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy