All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fuookami.ospf.kotlin.framework.solver.ColumnGenerationSolver.kt Maven / Gradle / Ivy

There is a newer version: 1.0.31
Show newest version
package fuookami.ospf.kotlin.framework.solver

import kotlin.time.*
import fuookami.ospf.kotlin.utils.math.*
import fuookami.ospf.kotlin.utils.functional.*
import fuookami.ospf.kotlin.core.frontend.model.*
import fuookami.ospf.kotlin.core.frontend.model.mechanism.*
import fuookami.ospf.kotlin.core.backend.solver.output.*

interface ColumnGenerationSolver {
    val name: String

    suspend fun solveMILP(
        name: String,
        metaModel: LinearMetaModel,
        toLogModel: Boolean = false
    ): Ret

    suspend fun solveMILP(
        name: String,
        metaModel: LinearMetaModel,
        amount: UInt64,
        toLogModel: Boolean = false
    ): Ret>> {
        return solveMILP(name, metaModel, toLogModel)
            .map { Pair(it, listOf(it.solution)) }
    }

    data class LPResult(
        val result: SolverOutput,
        val dualSolution: Solution
    ) {
        val obj: Flt64 by result::obj
        val solution: Solution by result::solution
        val time: Duration by result::time
        val possibleBestObj by result::possibleBestObj
        val gap: Flt64 by result::gap
    }

    suspend fun solveLP(
        name: String,
        metaModel: LinearMetaModel,
        toLogModel: Boolean = false
    ): Ret
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy