Commit 917098b7 authored by Christoph Richter's avatar Christoph Richter
Browse files

Ipopt also handle DNLP

parent 2b7a7ecb
......@@ -5,10 +5,11 @@ import de.monticore.lang.monticar.generator.Generator;
import de.monticore.lang.monticar.generator.cmake.CMakeFindModule;
import de.monticore.lang.monticar.generator.cpp.BluePrintCPP;
import de.monticore.lang.monticar.generator.cpp.GeneratorEMAMOpt2CPP;
import de.monticore.lang.monticar.generator.cpp.optimizationSolver.problem.DNLPProblem;
import de.monticore.lang.monticar.generator.cpp.optimizationSolver.problem.NLPProblem;
import de.monticore.lang.monticar.generator.cpp.optimizationSolver.problem.Problem;
import de.monticore.lang.monticar.generator.cpp.optimizationSolver.solver.NLPSolverGeneratorImplementation;
import de.monticore.lang.monticar.generator.cpp.optimizationSolver.solver.Solver;
import de.monticore.lang.monticar.generator.cpp.optimizationSolver.solver.SolverOptions;
import de.monticore.lang.monticar.generator.cpp.template.AllTemplates;
import de.monticore.lang.monticar.generator.cpp.template.TemplateHelper;
import de.se_rwth.commons.logging.Log;
......@@ -61,11 +62,14 @@ public class IpoptSolverGeneratorImplementation implements NLPSolverGeneratorImp
public String generateSolverCode(Problem optimizationProblem, List<FileContent> auxillaryFiles, BluePrintCPP bluePrint) {
String result = "";
GeneratorEMAMOpt2CPP generator = (GeneratorEMAMOpt2CPP) bluePrint.getGenerator();
if (optimizationProblem instanceof NLPProblem) {
NLPProblem nlpOptimizationProblem = (NLPProblem) optimizationProblem;
if ((optimizationProblem instanceof NLPProblem) || (optimizationProblem instanceof DNLPProblem)) {
// create view model from problem class
IpoptViewModel vm = new IpoptViewModel(nlpOptimizationProblem);
vm.setOptions(generator.getSolverOptions());
IpoptViewModel vm = new IpoptViewModel(optimizationProblem);
SolverOptions options = generator.getSolverOptions();
// retape if DNLP
if (optimizationProblem instanceof DNLPProblem)
options.put("Retape", "true");
vm.setOptions(options);
// set execute command
vm.setKnownVariablesFromBluePrint(bluePrint);
String knownVariables = ", ";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment